Commit 9dd8fa0f293b6efddc668b4a2c061daaca2a7a64

Authored by Birendra Kumar
1 parent 630b21e1

updated export image count for 3 modules DA,AA and CI.

400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
... ... @@ -29,6 +29,8 @@ namespace AIAHTML5.API.Constants
29 29 public const string LICENSE_TERM_CONDITION_UPDATE_SUCCESS = "License Term Accepted field updated successfully.";
30 30 public const string LICENSE_TERM_CONDITION_UPDATE_FAILED = "License Term Accepted field update failed.";
31 31  
  32 + public const string EXPORTED_IMAGE_INSERT_FAILED = "Image not Exported.";
  33 +
32 34 public const string KEY_CONTENT = "content";
33 35  
34 36 public const string LICENSE_KEY_ID = "LicenseId";
... ...
400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs
... ... @@ -34,5 +34,7 @@ namespace AIAHTML5.API.Constants
34 34 public const string GET_LICENSE_EDITIONS_FOR_MODESTY = "GetLicenseEditionsForModesty";
35 35 public const string GET_PRODUCT_FEATURES = "GetProductFeatures";
36 36 public const string GET_MODESTY_FOR_THIS_LICENSE = "usp_GetModestyForThisLicense";
  37 + public const string GET_COUNT_EXPORTED_IMAGE = "usp_GetCountExportedImage";
  38 + public const string INSERT_EXPORTED_IMAGE = "usp_InsertExportedImage";
37 39 }
38 40 }
39 41 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... ... @@ -182,6 +182,57 @@ namespace AIAHTML5.API.Controllers
182 182  
183 183 }
184 184  
  185 + [HttpPost]
  186 + [Route("api/ExportImage")]
  187 + public HttpResponseMessage InserExportImageDetail([FromBody]JObject jsonData)
  188 + {
  189 + int Status = 0;
  190 + dynamic responseData;
  191 + LicenseUserInsertImageDetail inserExportImageDetail = new LicenseUserInsertImageDetail();
  192 +
  193 + try
  194 + {
  195 + inserExportImageDetail.LicenseId = jsonData["LicenseId"].Value<int>();
  196 + inserExportImageDetail.UserId = jsonData["UserId"].Value<int>();
  197 +
  198 + inserExportImageDetail.ImageName = jsonData["ImageName"].Value<string>();
  199 + inserExportImageDetail.OriginalFileName = jsonData["OriginalFileName"].Value<string>();
  200 + inserExportImageDetail.Title = jsonData["Title"].Value<string>();
  201 + inserExportImageDetail.ModuleName = jsonData["ModuleName"].Value<string>();
  202 +
  203 + Status = InsertExportImageDetail(inserExportImageDetail );
  204 + if (Status==-1)
  205 + {
  206 + if(inserExportImageDetail.LicenseId>0)
  207 + {
  208 + // for user
  209 + var getexportedImagedetail = GetLicenseExportImageDetail(inserExportImageDetail.LicenseId);
  210 + responseData = JsonConvert.SerializeObject(getexportedImagedetail);
  211 + }
  212 + else
  213 + {
  214 + // for admin
  215 + responseData = "ADMIN";
  216 +
  217 + }
  218 +
  219 +
  220 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseData) };
  221 +
  222 + }
  223 + else
  224 + {
  225 + responseData = AIAConstants.EXPORTED_IMAGE_INSERT_FAILED;
  226 + return new HttpResponseMessage { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent(responseData) };
  227 + }
  228 + }
  229 + catch (Exception ex)
  230 + {
  231 + // Log exception code goes here
  232 + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
  233 + }
  234 + }
  235 +
185 236 private static void GetModulesBasedOnUserType(User userInfo)
186 237 {
187 238 //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0.
... ... @@ -208,6 +259,10 @@ namespace AIAHTML5.API.Controllers
208 259 {
209 260 GetModulesBasedOnLicense(userInfo, false);
210 261 }
  262 +
  263 + // get exported image detail
  264 +
  265 + userInfo.UserExportImageDetail = GetLicenseExportImageDetail(userInfo.LicenseId);
211 266 }
212 267 }
213 268  
... ... @@ -290,7 +345,21 @@ namespace AIAHTML5.API.Controllers
290 345 }
291 346 }
292 347  
  348 + private static LicenseUserExportedImageDetail GetLicenseExportImageDetail(int licenseId)
  349 + {
  350 + LicenseUserExportedImageDetail exportedImageDetail = null;
  351 + exportedImageDetail = AIAHTML5.API.Models.Users.getExportedImageDetail(licenseId);
  352 +
  353 + return exportedImageDetail;
  354 + }
293 355  
  356 + private static int InsertExportImageDetail(LicenseUserInsertImageDetail imageDetail)
  357 + {
  358 + int insertImageResult = 0;
  359 + insertImageResult = AIAHTML5.API.Models.Users.InsertExportedImageDetail(imageDetail);
  360 +
  361 + return insertImageResult;
  362 + }
294 363  
295 364 // PUT api/authenticate/5
296 365 public void Put(int id, [FromBody]string value)
... ...
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -465,6 +465,86 @@ namespace AIAHTML5.API.Models
465 465 return license;
466 466 }
467 467  
  468 + internal LicenseUserExportedImageDetail GetLicenseUserExportImageDetail(int licenseId)
  469 + {
  470 + logger.Debug(" inside GetLicenseUserExportImageDetail for LicenseId = " + licenseId);
  471 +
  472 + LicenseUserExportedImageDetail exportImageDetails = null;
  473 +
  474 + SqlConnection conn = new SqlConnection(dbConnectionString);
  475 + SqlCommand cmd = new SqlCommand();
  476 + SqlDataAdapter adapter;
  477 + SqlParameter param;
  478 + DataSet ds = new DataSet();
  479 +
  480 + cmd.Connection = conn;
  481 + cmd.CommandText = DBConstants.GET_COUNT_EXPORTED_IMAGE;
  482 + cmd.CommandType = CommandType.StoredProcedure;
  483 +
  484 + param = new SqlParameter("@LicenseId", licenseId);
  485 + param.Direction = ParameterDirection.Input;
  486 + param.DbType = DbType.Int32;
  487 + cmd.Parameters.Add(param);
  488 +
  489 + adapter = new SqlDataAdapter(cmd);
  490 + adapter.Fill(ds);
  491 +
  492 + if (ds != null && ds.Tables.Count > 0)
  493 + {
  494 + exportImageDetails = new LicenseUserExportedImageDetail();
  495 + DataTable dt = ds.Tables[0];
  496 +
  497 + if (dt.Rows.Count > 0)
  498 + {
  499 + foreach (DataRow dr in dt.Rows)
  500 + {
  501 + exportImageDetails.isExportImage = Convert.ToBoolean(dr["isExportImage"]);
  502 + exportImageDetails.CountExportedImage = Convert.ToInt32(dr["CountExportedImage"]);
  503 + exportImageDetails.ExptImageLimit = Convert.ToInt32(dr["ExptImageLimit"]);
  504 +
  505 + }
  506 + }
  507 + }
  508 +
  509 + return exportImageDetails;
  510 + }
  511 +
  512 + internal int LicenseUserInsertExportedImageDetail(LicenseUserInsertImageDetail imageDetail)
  513 + {
  514 + logger.Debug(" inside LicenseUserInsertExportedImageDetail for Image= " + imageDetail.ImageName);
  515 +
  516 + int result = 0;
  517 + SqlConnection conn = null;
  518 + try
  519 + {
  520 + conn = new SqlConnection(dbConnectionString);
  521 + SqlCommand cmd = new SqlCommand();
  522 + conn.Open();
  523 + cmd.Connection = conn;
  524 + cmd.CommandText = DBConstants.INSERT_EXPORTED_IMAGE;
  525 + cmd.CommandType = CommandType.StoredProcedure;
  526 + cmd.Parameters.AddWithValue("@UserId", imageDetail.UserId);
  527 + cmd.Parameters.AddWithValue("@LicenseId", imageDetail.LicenseId);
  528 + cmd.Parameters.AddWithValue("@ImageName", imageDetail.ImageName);
  529 + cmd.Parameters.AddWithValue("@OriginalFileName", imageDetail.OriginalFileName);
  530 + cmd.Parameters.AddWithValue("@Title", imageDetail.Title);
  531 + cmd.Parameters.AddWithValue("@ModuleName", imageDetail.ModuleName);
  532 +
  533 + result = cmd.ExecuteNonQuery();
  534 + }
  535 + catch (SqlException ex)
  536 + {
  537 + logger.Fatal("Exception in LicenseUserInsertExportedImageDetail for Image= " + imageDetail.ImageName + ", Exception= " + ex.Message + ", STACKTRACE=" + ex.StackTrace);
  538 + throw;
  539 + }
  540 + finally
  541 + {
  542 + conn.Dispose();
  543 + }
  544 +
  545 + return result;
  546 + }
  547 +
468 548 internal static int UpdateLicenseTermStatus(string accountNumber)
469 549 {
470 550 logger.Debug(" inside UpdateLicenseTermStatus for AccountNumber = " + accountNumber);
... ...
400-SOURCECODE/AIAHTML5.API/Models/User.cs
... ... @@ -37,9 +37,12 @@ namespace AIAHTML5.API.Models
37 37 public Int16 LoginFailureCauseId { get; set; }
38 38 public bool IsModestyOn { get; set; }
39 39 public ArrayList Modules { get; set; }
  40 + public int siteId { get; set; }
40 41  
41 42 public License LicenseInfo { get; set; }
42 43 public LicenseSubscriptionDetails LicenseSubscriptions { get; set; }
  44 + public LicenseUserExportedImageDetail UserExportImageDetail { get; set; }
  45 +
43 46 public bool IsSubscriptionExpired { get; set; }
44 47 public string SubscriptionExpirationDate { get; set; }
45 48 public string TermsAndConditionsTitle { get; set; }
... ... @@ -108,6 +111,24 @@ namespace AIAHTML5.API.Models
108 111 public double AmountPending { get; set; }
109 112 public int NoOfImages { get; set; }
110 113 }
  114 + public class LicenseUserExportedImageDetail
  115 + {
  116 + public bool isExportImage { get; set; }
  117 + public int CountExportedImage { get; set; }
  118 + public int ExptImageLimit { get; set; }
  119 + }
  120 +
  121 + public class LicenseUserInsertImageDetail
  122 + {
  123 + public int LicenseId { get; set; }
  124 + public int UserId { get; set; }
  125 + public string ImageName { get; set; }
  126 + public string OriginalFileName { get; set; }
  127 + public string Title { get; set; }
  128 + public string ModuleName { get; set; }
  129 +
  130 + }
  131 +
111 132  
112 133 public class BlockedUser
113 134 {
... ...
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... ... @@ -281,6 +281,32 @@ namespace AIAHTML5.API.Models
281 281 return userSubscriptionDetail;
282 282 }
283 283  
  284 + internal static LicenseUserExportedImageDetail getExportedImageDetail(int licenseId)
  285 + {
  286 + logger.Debug("inside getLicenseDetails for LicenseId =" + licenseId);
  287 +
  288 + LicenseUserExportedImageDetail imageDetail = null;
  289 +
  290 + DBModel objModel = new DBModel();
  291 + imageDetail = objModel.GetLicenseUserExportImageDetail(licenseId);
  292 +
  293 + return imageDetail;
  294 + }
  295 +
  296 + internal static int InsertExportedImageDetail(LicenseUserInsertImageDetail imageDetail)
  297 + {
  298 + logger.Debug("inside InsertExportedImageDetail for Image =" + imageDetail.ImageName);
  299 +
  300 + int result = 0;
  301 +
  302 + DBModel objModel = new DBModel();
  303 + result = objModel.LicenseUserInsertExportedImageDetail(imageDetail);
  304 +
  305 + return result;
  306 + }
  307 +
  308 +
  309 +
284 310 internal static void isCredentialCorrect(Newtonsoft.Json.Linq.JObject credentials, User userInfo, out bool isCorrectLoginId, out bool isCorrectPassword)
285 311 {
286 312 isCorrectLoginId = false;
... ... @@ -557,15 +583,11 @@ namespace AIAHTML5.API.Models
557 583 else
558 584 userInfo.Modules = getAllModulesList();
559 585  
560   - // objResponse.AddData(LoginConst.USER_CONTEXT, objUserContext);
561   -
562   -
563   - // Hashtable arrModuleList = LicenseHelper.GetInstance().GetAllModuleByLicenseId(objLicenseRow.Id);
564   - //if (arrModuleList[9].Equals(true)) {
565   - // SessionManager.GetInstance().AddModSession("ModuleNameIP10", "IP10");
566   - //}
567 586  
568   - //logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, 0, strSiteIP, strEdition, strUrlReferer);
  587 + // get exported image detail
  588 + //note: not tested
  589 + userInfo.UserExportImageDetail = getExportedImageDetail(userInfo.LicenseId);
  590 +
569 591 }
570 592 else
571 593 {
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js
... ... @@ -603,6 +603,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
603 603 .where('_id == ' + $scope.voId)
604 604 .select('_contentImage');
605 605  
  606 + // store image for export
  607 + var tittle = $rootScope.getLocalStorageValue("currentViewTitle");
  608 + $rootScope.StoreTitleName(tittle);
  609 + $rootScope.StoreOrgImageName(clickedCIImage[0]._contentImage);
  610 +
  611 +
606 612 $scope.clickedCIImage = "~/../content/images/ci/images/" + clickedCIImage[0]._contentImage;
607 613  
608 614 var clickedCISummary = [];
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -6,7 +6,7 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
6 6  
7 7  
8 8 $scope.genderId = "";
9   - $scope.BodyViewData;
  9 + $rootScope.BodyViewData;
10 10 $scope.selectedGenderBodyViewData;
11 11 $scope.imagePath = "";
12 12 $rootScope.BodyRegionData;
... ... @@ -219,7 +219,7 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
219 219 }
220 220  
221 221 $scope.selectedGenderBodyViewData = new jinqJs()
222   - .from($scope.BodyViewData.BodyViews.view)
  222 + .from($rootScope.BodyViewData.BodyViews.view)
223 223 .where('_gender == ' + $scope.genderId)
224 224 .select();
225 225  
... ... @@ -328,7 +328,7 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
328 328 localStorage.setItem("currentViewTitleFromJson", $event.currentTarget.textContent);
329 329 localStorage.setItem("currentViewTitle", $event.currentTarget.textContent);
330 330 localStorage.setItem("currentBodyViewId", $event.currentTarget.id);
331   -
  331 +
332 332 var u = $location.url();
333 333 $location.url('/da-body-view');
334 334  
... ... @@ -444,7 +444,7 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
444 444 $rootScope.CommonData = result;
445 445 $http({ method: 'GET', url: '~/../content/data/json/da/da_dat_contentlist.json' }).success(function (data) {
446 446  
447   - $scope.BodyViewData = data;
  447 + $rootScope.BodyViewData = data;
448 448  
449 449 $scope.getDAViewList();
450 450  
... ... @@ -532,6 +532,13 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
532 532 var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson");
533 533 localStorage.setItem("currentViewTitle", tittle);
534 534  
  535 + // store image title for export image
  536 + var tittle = $rootScope.getLocalStorageValue("currentViewTitle");
  537 + $rootScope.StoreTitleName(tittle);
  538 +
  539 + // store image for export
  540 + $scope.LoadImageToExport();
  541 +
535 542 //WILL BE USED WHEN MULTI VIEWOPEN FUNCTIONALITY IS IMPELMNETD
536 543 //if (openViews != null && openViews != undefined) {
537 544 // angular.forEach(openViews, function (value, key) {
... ... @@ -903,6 +910,8 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
903 910 }
904 911 }
905 912  
  913 + // store image for export
  914 + $scope.LoadImageToExport();
906 915  
907 916 //console.log("s" + $rootScope.vocabTermDataArray);
908 917 //call watch on '$scope.VocabTermTxt and compile <li> and append to <ul> on first time load
... ... @@ -1033,6 +1042,50 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
1033 1042 });
1034 1043 }
1035 1044  
  1045 + // load image to export
  1046 + $scope.LoadImageToExport = function()
  1047 + {
  1048 + $scope.genderId = $rootScope.getLocalStorageValue("genderId");
  1049 + var currentBodyViewId = $rootScope.getLocalStorageValue("currentBodyViewId");
  1050 +
  1051 + var selectBodyViewData = new jinqJs()
  1052 + .from($rootScope.BodyViewData.BodyViews.view)
  1053 + .where('_gender == ' + $scope.genderId,'_id == ' + currentBodyViewId)
  1054 + .select();
  1055 +
  1056 + var userEthnicity;
  1057 + var userModestysettings;
  1058 + var curentEthnicity = $rootScope.getLocalStorageValue("globalEthnicity");
  1059 + if (typeof (curentEthnicity) !== "undefined" && curentEthnicity !== null) {
  1060 + userEthnicity = curentEthnicity;
  1061 + }
  1062 + else {
  1063 + userEthnicity = $rootScope.globalSetting.ethnicity;
  1064 + }
  1065 +
  1066 + var curentmodesty = $rootScope.getLocalStorageValue("globalModesty");
  1067 + if (typeof (curentmodesty) !== "undefined" && curentmodesty !== null) {
  1068 + userModestysettings = curentmodesty;
  1069 + }
  1070 + else {
  1071 + userModestysettings = $rootScope.globalSetting.modesty;
  1072 + }
  1073 +
  1074 + var viewid=selectBodyViewData[0]._id;
  1075 + var thumbImage=selectBodyViewData[0]._thumbnailImage;
  1076 +
  1077 + var OriginalImage;
  1078 + if ((viewid == 1) || (viewid == 3) || (viewid== 5) || (viewid == 6) || (viewid== 7) || (viewid == 11))
  1079 + {
  1080 + OriginalImage = ((thumbImage).replace('.jpg', '_' + userEthnicity + userModestysettings)) + '.jpg';
  1081 + }
  1082 + else
  1083 + {
  1084 + OriginalImage = ((thumbImage).replace('.jpg', '_' + userEthnicity)) + '.jpg';
  1085 + }
  1086 +
  1087 + $rootScope.StoreOrgImageName(OriginalImage);
  1088 + }
1036 1089  
1037 1090 $scope.LoadDefaultLayerImage = function () {
1038 1091 console.log('inside LoadDefaultLayerImage')
... ... @@ -7972,7 +8025,11 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
7972 8025 $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = $rootScope.getLocalStorageValue("currentViewTitle").replace('Female', 'Male');
7973 8026  
7974 8027 localStorage.setItem("currentViewTitle", $rootScope.getLocalStorageValue("currentViewTitle").replace('Female', 'Male'));
7975   -
  8028 +
  8029 + // store image for export
  8030 + var tittle = $rootScope.getLocalStorageValue("currentViewTitle");
  8031 + $rootScope.StoreTitleName(tittle);
  8032 + $scope.LoadImageToExport();
7976 8033  
7977 8034 $rootScope.isLoading = true;
7978 8035  
... ... @@ -8005,7 +8062,11 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8005 8062 $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = $rootScope.getLocalStorageValue("currentViewTitle").replace('Male', 'Female');
8006 8063  
8007 8064 localStorage.setItem("currentViewTitle", $rootScope.getLocalStorageValue("currentViewTitle").replace('Male', 'Female'));
8008   -
  8065 +
  8066 + // store image for export
  8067 + var tittle = $rootScope.getLocalStorageValue("currentViewTitle");
  8068 + $rootScope.StoreTitleName(tittle);
  8069 + $scope.LoadImageToExport();
8009 8070  
8010 8071 $rootScope.isLoading = true;
8011 8072  
... ... @@ -8298,7 +8359,11 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8298 8359 $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = $rootScope.getLocalStorageValue("genderId") + " " + event.currentTarget.title;
8299 8360 localStorage.setItem("currentViewTitle", $rootScope.getLocalStorageValue("genderId") + " " + event.currentTarget.title);
8300 8361  
8301   -
  8362 + // store image for export
  8363 + var tittle = $rootScope.getLocalStorageValue("currentViewTitle");
  8364 + $rootScope.StoreTitleName(tittle);
  8365 + $scope.LoadImageToExport();
  8366 +
8302 8367 $rootScope.openViews.push(
8303 8368 {
8304 8369 "module": $rootScope.currentActiveModuleTitle, "bodyView": $rootScope.getLocalStorageValue("currentViewTitle"), "state": 'max', "BodyViewId": $rootScope.voId,
... ... @@ -8423,9 +8488,9 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8423 8488  
8424 8489 $scope.loadNavigatorForSelectedBodyView = function (currentBodyViewId) {
8425 8490  
8426   - //$rootScope.voId = currentBodyViewId;
8427 8491  
8428   - //$scope.skinTone = $rootScope.globalSetting.ethnicity;
  8492 + // store image for export
  8493 + $scope.LoadImageToExport();
8429 8494  
8430 8495 if ($rootScope.NavigatorData != null || $rootScope.NavigatorData != undefined) {
8431 8496 var navdtlOrient = new jinqJs()
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -42,7 +42,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
42 42  
43 43 // on refersh this variable will also get null that is why we are only checking this variable on initialize that if it is null that means page gets refershed.
44 44 $rootScope.refreshcheck = null;
45   - var isCommingSoonModel = true;
  45 + var isCommingSoonModel = true;
46 46  
47 47 $rootScope.isCloseSettingClicked = false;
48 48  
... ... @@ -133,7 +133,6 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
133 133  
134 134 }
135 135  
136   -
137 136 $rootScope.initializeAIA = function () {
138 137 if (params != null && params != undefined && params!="") {
139 138  
... ... @@ -227,8 +226,11 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
227 226 }
228 227 else {
229 228  
  229 + // birendra// initialize exp img detail object
  230 + $rootScope.initializeUserForExportImage(result.Id);
  231 +
230 232 //code for modesty setting
231   - if (result.LicenseInfo != null) {
  233 + if (result.LicenseInfo != null) {
232 234 if (result.IsModestyOn) {
233 235 $rootScope.isModestyOn = true;
234 236 $rootScope.isModestyOff = false;
... ... @@ -326,6 +328,13 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
326 328 //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true
327 329 if (result.LicenseId == 0 && result.IsActive)
328 330 {
  331 +
  332 + // set license id -1 for admin
  333 + $scope.UpdateUserExportImageData(result.Id,'LicenseId',-1)
  334 +
  335 + // set enable export image for admin
  336 + $scope.UpdateUserExportImageData(result.Id,'isExportImage',true);
  337 +
329 338 $rootScope.haveRoleAdmin = true;
330 339  
331 340 $rootScope.userData = result;
... ... @@ -358,26 +367,55 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
358 367 else {
359 368 if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted)
360 369 {
  370 +
  371 + // set license id
  372 + $scope.UpdateUserExportImageData(result.Id,'LicenseId',result.LicenseId)
  373 +
  374 + // set license type :note 5 for demo/test license
  375 + $scope.UpdateUserExportImageData(result.Id,'LicenseTypeId',result.LicenseInfo.LicenseTypeId);
  376 +
  377 + if(result.UserExportImageDetail!=null)
  378 + {
  379 + // set already export image count
  380 + $scope.UpdateUserExportImageData(result.Id,'CountExportImage',result.UserExportImageDetail.CountExportedImage);
  381 +
  382 + // set Image limit
  383 + $scope.UpdateUserExportImageData(result.Id,'ExptImageLimit',result.UserExportImageDetail.ExptImageLimit);
  384 +
  385 + // set is enable for export image
  386 + $scope.UpdateUserExportImageData(result.Id,'isExportImage',result.UserExportImageDetail.isExportImage);
  387 + }
  388 +
  389 +
  390 + // disable export image option for demo and for cross the Image limit
  391 + if(result.LicenseInfo.LicenseTypeId==5 || result.UserExportImageDetail.isExportImage==false)
  392 + {
  393 + $rootScope.exportImage = "disableSubMenu";
  394 + }
  395 +
361 396 //0.
362 397 $rootScope.userData = result;
363 398 $rootScope.userModules = result.Modules;
364 399  
365 400 //1. set haveRoleAdmin = false because LicenseInfo is not null
366   - if (result.LicenseTypeId != 5) {
  401 +
  402 + if (result.LicenseTypeId != 5 ) {
367 403  
368 404 $rootScope.haveRoleAdmin = true;
369 405  
370 406 }
371   - if (result.UserTypeId == 8){
  407 + if (result.UserTypeId == 8)
  408 + {
372 409  
373 410 $rootScope.haveRoleAdmin = false;
374 411 }
375   - // Remove Admin Link for LicenseEditionId 3/4 of student
376   - if(result.EditionId==3 ||result.EditionId==4)
377   - {
378   - $rootScope.haveRoleAdmin = false;
379 412  
380   - }
  413 + // Remove Admin Link for LicenseEditionId 3/4 of student
  414 + if(result.EditionId==3 ||result.EditionId==4)
  415 + {
  416 + $rootScope.haveRoleAdmin = false;
  417 +
  418 + }
381 419  
382 420 $("#modestyDiv").css("pointer-events", "none");
383 421 $("#modestyDiv").css("opacity", 0.5);
... ... @@ -452,7 +490,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
452 490  
453 491  
454 492 $scope.ValidateClientSiteUrl = function () {
455   -
  493 +
456 494 $rootScope.isCallFromSite = true;
457 495  
458 496 var siteInfo = params.split('&');
... ... @@ -605,97 +643,108 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
605 643 $rootScope.UpdateAndCloseSetting($rootScope.formsetting)
606 644 }
607 645 //code for modesty setting
  646 +
  647 + $rootscope.siteId = result.siteId;
608 648  
  649 + // birendra// initialize exp img detail object
  650 + $rootScope.initializeUserForExportImage(result.Id);
609 651  
610   - $rootScope.siteId = result.siteId;
611   -
612   - //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true
613   - if (result.LicenseId == 0) {
614   - $rootScope.haveRoleAdmin = true;
615   -
616   - $rootScope.userData = result;
617   - $rootScope.userModules = result.Modules;
618   -
619   - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
620   - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
621   - }
622   -
623   - if (isCommingSoonModel == true) {
624   -
625   - ShowAssignedModulesPopup(result.Modules);
626   -
627   - //if (userInfo.rememberChk) {
628   -
629   - // $scope.saveRemeberMeDetails(result, userInfo);
630   - //}
631   -
632   - sessionStorage.setItem("loginSession", "true");
633   - localStorage.setItem('isCommingSoonModel', false);
634   -
635   - $rootScope.isVisibleLogin = false;
636   - }
637   -
  652 + //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true
  653 + if (result.LicenseId == 0) {
  654 + $rootScope.haveRoleAdmin = true;
638 655  
639   - $location.path('/');
  656 + // set license id -1 for admin
  657 + $scope.UpdateUserExportImageData(result.Id,'LicenseId',-1)
  658 +
  659 + // set enable export image for admin
  660 + $scope.UpdateUserExportImageData(result.Id,'isExportImage',true);
640 661  
641   - }
642   - else {
643   - if (result.LicenseInfo != null) {
644   - //0.
645 662 $rootScope.userData = result;
646 663 $rootScope.userModules = result.Modules;
647 664  
648   - //1. set haveRoleAdmin = false because LicenseInfo is not null
649   - $rootScope.haveRoleAdmin = false;
650   -
651   - //2.
652 665 if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
653   -
654 666 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
655 667 }
656 668  
657   - // 3.ShowAssignedModulesPopup
658   - //isCommingSoonModel =true only when user comes first time on application and login
659   - //if (isCommingSoonModel == true) {
660   -
661   - // ShowAssignedModulesPopup(result.Modules);
662   - //}
  669 + if (isCommingSoonModel == true) {
663 670  
664   - //4.
665   - //if ($scope.rememberChk) {
  671 + ShowAssignedModulesPopup(result.Modules);
666 672  
667   - // $scope.saveRemeberMeDetails(result, userInfo);
668   - //}
  673 +
  674 + sessionStorage.setItem("loginSession", "true");
  675 + localStorage.setItem('isCommingSoonModel', false);
669 676  
670   - //5.
671   - sessionStorage.setItem("loginSession", "true");
672   - $rootScope.isVisibleLogin = false;
  677 + $rootScope.isVisibleLogin = false;
  678 + }
673 679  
674   - //6. reset the isCommingSoonModel to false in local storage so that upcomming module pop up would not show again to the user after firts time
675   - // localStorage.setItem('isCommingSoonModel', false);
676 680  
677 681 $location.path('/');
678 682  
679 683 }
680 684 else {
681   - if ($('#dvTerms').length > 0) {
682   - $('#dvTerms').html(result.TermsAndConditionsText);
  685 + if (result.LicenseInfo != null ) {
  686 +
  687 + if(result.UserExportImageDetail!=null)
  688 + {
  689 + // set already export image count
  690 + $scope.UpdateUserExportImageData(result.Id,'CountExportImage',result.UserExportImageDetail.CountExportedImage);
  691 +
  692 + // set Image limit
  693 + $scope.UpdateUserExportImageData(result.Id,'ExptImageLimit',result.UserExportImageDetail.ExptImageLimit);
  694 +
  695 + // set is enable for export image
  696 + $scope.UpdateUserExportImageData(result.Id,'isExportImage',result.UserExportImageDetail.isExportImage);
  697 + }
  698 +
  699 +
  700 + // disable export image option for demo and for cross the Image limit
  701 + if(result.LicenseInfo.LicenseTypeId==5 || result.UserExportImageDetail.isExportImage==false)
  702 + {
  703 + $rootScope.exportImage = "disableSubMenu";
  704 + }
  705 +
  706 + $rootScope.userData = result;
  707 + $rootScope.userModules = result.Modules;
  708 +
  709 + //1. set haveRoleAdmin = false because LicenseInfo is not null
  710 + $rootScope.haveRoleAdmin = false;
  711 +
  712 + //2.
  713 + if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
  714 +
  715 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  716 + }
  717 +
  718 +
  719 + //5.
  720 + sessionStorage.setItem("loginSession", "true");
  721 + $rootScope.isVisibleLogin = false;
  722 +
  723 + //6. reset the isCommingSoonModel to false in local storage so that upcomming module pop up would not show again to the user after firts time
  724 + // localStorage.setItem('isCommingSoonModel', false);
  725 +
  726 + $location.path('/');
  727 +
  728 + }
  729 + else {
  730 + if ($('#dvTerms').length > 0) {
  731 + $('#dvTerms').html(result.TermsAndConditionsText);
  732 + }
  733 + $rootScope.isVisibleLogin = true;
  734 + $('#dvTermCondition').fadeIn();
  735 + $rootScope.userData = result;
  736 + $rootScope.haveRoleAdmin = false;
  737 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  738 + $location.path('/');
683 739 }
684   - $rootScope.isVisibleLogin = true;
685   - $('#dvTermCondition').fadeIn();
686   - $rootScope.userData = result;
687   - $rootScope.haveRoleAdmin = false;
688   - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
689   - $location.path('/');
690 740 }
691 741 }
692   - }
693 742  
694 743  
  744 + }
695 745 }
696   - }
697   -
698 746  
  747 +
699 748  
700 749 },
701 750  
... ... @@ -720,8 +769,6 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
720 769  
721 770 }
722 771  
723   -
724   -
725 772 $scope.saveRemeberMeDetails = function (result, userInfo) {
726 773  
727 774 localStorage.setItem('RememberMeLoginId', result.LoginId);
... ... @@ -1241,11 +1288,10 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
1241 1288 $("#optionsListManagerTab").removeClass("disableMenuoption");
1242 1289 $("#optiontSetting").removeClass("disableSubMenu");
1243 1290  
1244   -
1245 1291 if (($location.url() == "/da-body-view")) {
1246 1292 $rootScope.disableMenuannotation = " ";
1247 1293 $rootScope.disableMenuoption = " ";
1248   - $rootScope.disableSubMenu = "disableSubMenu";
  1294 + $rootScope.disableSubMenu = "disableSubMenu";
1249 1295 $rootScope.disableFileMenu = " ";
1250 1296 }
1251 1297 else if ($location.url() == "/clinical-illustrations-detail") {
... ... @@ -1315,6 +1361,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
1315 1361 }, 300);
1316 1362 }
1317 1363  
  1364 +
1318 1365 $rootScope.openParent = function (slug) {
1319 1366 if ($('#jsPanel-1').length > 0) {
1320 1367  
... ... @@ -5771,6 +5818,137 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
5771 5818  
5772 5819 };
5773 5820  
  5821 + $rootScope.initializeUserForExportImage = function (userloggedInId) {
  5822 +
  5823 + $rootScope.UserImageExportData = [];
  5824 + $rootScope.UserImageExportData.push(
  5825 + {
  5826 + 'UserId' : userloggedInId,
  5827 + 'LicenseId': null,
  5828 + 'LicenseTypeId': null,
  5829 + 'isExportImage':false,
  5830 + 'ExptImageLimit': 0,
  5831 + 'CountExportImage': 0,
  5832 + 'Title': null,
  5833 + 'ModuleName': null,
  5834 + 'ImageName': null,
  5835 + 'OriginalFileName': null
  5836 +
  5837 + });
  5838 +
  5839 + }
  5840 +
  5841 +
  5842 + $scope.UpdateUserExportImageData=function(userloggedInId,keyname,value)
  5843 + {
  5844 + for(var x=0 ;x < $rootScope.UserImageExportData.length;x++){
  5845 +
  5846 + if($rootScope.UserImageExportData[x].UserId==userloggedInId)
  5847 + {
  5848 + $rootScope.UserImageExportData[x][keyname]=value;
  5849 + }
  5850 + }
  5851 + }
  5852 +
  5853 + $scope.GetUserExportImageData=function(userloggedInId,keyname)
  5854 + {
  5855 + for(var x=0 ;x < $rootScope.UserImageExportData.length;x++){
  5856 +
  5857 + if($rootScope.UserImageExportData[x].UserId==userloggedInId)
  5858 + {
  5859 + return $rootScope.UserImageExportData[x][keyname];
  5860 + }
  5861 + }
  5862 + }
  5863 +
  5864 + $rootScope.StoreModuleName = function (moduleName) {
  5865 +
  5866 + var userid= $rootScope.userData.Id;
  5867 + $scope.UpdateUserExportImageData(userid,'ModuleName',moduleName);
  5868 +
  5869 + }
  5870 +
  5871 + $rootScope.StoreTitleName = function (titleName) {
  5872 +
  5873 + var userid= $rootScope.userData.Id;
  5874 + $scope.UpdateUserExportImageData(userid,'Title',titleName);
  5875 +
  5876 + }
  5877 + $rootScope.StoreOrgImageName = function (orgImage) {
  5878 +
  5879 + var userid= $rootScope.userData.Id;
  5880 + $scope.UpdateUserExportImageData(userid,'OriginalFileName',orgImage);
  5881 +
  5882 + }
  5883 +
  5884 + $rootScope.StoreImageName = function (imageName) {
  5885 +
  5886 + var userid= $rootScope.userData.Id;
  5887 + $scope.UpdateUserExportImageData(userid,'ImageName',imageName);
  5888 +
  5889 + }
  5890 +
  5891 +
  5892 + $rootScope.SaveImagefile = function () {
  5893 + $("#canvasDiv").append("<img id='exportlogo' class='img-responsive' src='content/images/adam-logo-small.png'/>");
  5894 + html2canvas($("#canvasDiv"), {
  5895 + onrendered: function (canvas) {
  5896 + var fileName = document.getElementById("filename").value + '.jpg';
  5897 + if (typeof (fileName) == "undefined" || fileName == ".jpg")
  5898 + fileName = "Untitled.jpg"
  5899 +
  5900 + //store image to export
  5901 + $rootScope.StoreImageName(fileName);
  5902 +
  5903 + if( $rootScope.UserImageExportData.length>0)
  5904 + {
  5905 + var imageInfo=$rootScope.UserImageExportData[0];
  5906 +
  5907 + AuthenticationService.UserLicenseExportImage(imageInfo)
  5908 + .then(
  5909 + function (result) {
  5910 +
  5911 + var dataURL = canvas.toDataURL("image/jpeg");
  5912 + var blob = dataURItoBlob(dataURL);
  5913 + console.log(blob);
  5914 + saveAs(blob, fileName);
  5915 + $("#exportlogo").remove();
  5916 + $("#filename").val("");
  5917 +
  5918 + if(result!=null && result!="ADMIN" )
  5919 + {
  5920 + var userid= $rootScope.userData.Id;
  5921 + // set already export image count
  5922 + $scope.UpdateUserExportImageData(userid,'CountExportImage',result.CountExportedImage);
  5923 +
  5924 + // set Image limit
  5925 + $scope.UpdateUserExportImageData(userid,'ExptImageLimit',result.ExptImageLimit);
  5926 +
  5927 + // set is enable for export image
  5928 + $scope.UpdateUserExportImageData(userid,'isExportImage',result.isExportImage);
  5929 +
  5930 + // disable export image option when export Image limit over
  5931 + if(result.isExportImage==false)
  5932 + {
  5933 + $rootScope.exportImage = "disableSubMenu";
  5934 + }
  5935 + }
  5936 +
  5937 + }),
  5938 + function (error) {
  5939 + console.log(' Error in export Image to databse = ' + error.statusText);
  5940 + $rootScope.errorMessage = error;
  5941 + $("#messageModal").modal('show');
  5942 + }
  5943 +
  5944 + }
  5945 +
  5946 + }
  5947 + });
  5948 + $(".export-image").css("display", "none");
  5949 +
  5950 + };
  5951 +
5774 5952 }]
5775 5953 );
5776 5954  
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... ... @@ -187,6 +187,11 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
187 187 localStorage.setItem("AAGridViewHighlightThumbnail", $(event.target).parent().parent().parent().attr('id'));
188 188 }
189 189  
  190 + // store image for export
  191 + var tittle = $rootScope.getLocalStorageValue("currentViewTitle");
  192 + $rootScope.StoreTitleName(tittle);
  193 + $rootScope.StoreOrgImageName($rootScope.imageName);
  194 +
190 195 //3. Navigate to the Module-item-view
191 196 var u = $location.url();
192 197 $location.url('/module-item-view');
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
... ... @@ -22,6 +22,27 @@
22 22 return deferred.promise;
23 23 },
24 24  
  25 + UserLicenseExportImage: function (imageDetails) {
  26 + var deferred = $q.defer();
  27 +
  28 + $http.post('/API/api/ExportImage', JSON.stringify(imageDetails), {
  29 + headers: {
  30 + 'Content-Type': 'application/json'
  31 + }
  32 + })
  33 + .success(function (data, status, headers, config) {
  34 + console.log('success')
  35 + deferred.resolve(data);
  36 + }).error(function (data, status, headers, config) {
  37 + console.log('error')
  38 + deferred.reject(data);
  39 + $rootScope.errorMessage = data;
  40 + $("#messageModal").modal('show');
  41 +
  42 + });
  43 + return deferred.promise;
  44 + },
  45 +
25 46 validateClientSite: function (clientInfo) {
26 47 var deferred = $q.defer();
27 48  
... ...
400-SOURCECODE/AIAHTML5.Web/app/widget/MainMenu.html
... ... @@ -26,9 +26,7 @@
26 26 <div class="sidebar pull-left mCustomScrollbar _mCS_1 mCS-autoHide ">
27 27 <!--{{name}}-->
28 28 <ul class="nav nav-sidebar" ng-init="hideScrollbar()">
29   - <!-- <li ng-repeat="module in userModules" ng-hide="module.id==8 || module.id==13"><a id="{{module.slug}}" href="{{module.slug}}" ng-click="IsVisible();getModuleScrollPosition()" data-ng-bind="module.name" ng-class="HightLightModuleSelection('{{module.slug}}')" ng-hide="module.id==8 || module.id==13"></a></li>-->
30   - <li ng-repeat="module in userModules" ng-hide="module.id==13"><a id="{{module.slug}}" href="{{module.slug}}" ng-click="IsVisible();getModuleScrollPosition()" data-ng-bind="module.name" ng-class="HightLightModuleSelection('{{module.slug}}')" ng-hide="module.id==13"></a></li>
31   -
  29 + <li ng-repeat="module in userModules" ng-hide="module.id==13"><a id="{{module.slug}}" href="{{module.slug}}" ng-click="StoreModuleName(module.name);getModuleScrollPosition()" data-ng-bind="module.name" ng-class="HightLightModuleSelection('{{module.slug}}')" ng-hide="module.id==13"></a></li>
32 30 </ul>
33 31 </div>
34 32  
... ...
400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html
... ... @@ -15,7 +15,7 @@
15 15 <li ng-class="disableSubMenu"><a href="#">Open Existing Curriculum</a></li>
16 16 <li ng-class="disableSubMenu"><a href="#">Save Curriculum As</a></li>
17 17 <li role="separator" class="divider"></li>
18   - <li><a href="" id="exportImageAnchor" data-toggle="modal" ng-click="ShowExportImageWindow()">Export Image</a></li>
  18 + <li ng-class="exportImage"><a href="" id="exportImageAnchor" data-toggle="modal" ng-click="ShowExportImageWindow()">Export Image</a></li>
19 19 <li role="separator" class="divider"></li>
20 20 <li><a href="" id="printAVAnchor" data-toggle="modal" ng-click="ShowPrintWindow()">Print Active Viewer</a></li>
21 21 <li ng-class="disableSubMenu"><a href="#">Print All Open Viewers</a></li>
... ...
400-SOURCECODE/AIAHTML5.Web/index.aspx
... ... @@ -1083,7 +1083,7 @@
1083 1083 <div class="row">
1084 1084 <input type="file" id="file1" style="display:none">
1085 1085 <!--<a href="data:application/xml;charset=utf-8,your code here" download="filename.html">Save</a-->
1086   - <div class="col-sm-12"><button id="btnSaveEI" class="btn btn-primary" data-dismiss="modal" type="button">Ok</button></div> <!--onclick="makeScreenshot();"--><!--ng-click="dialogs.saveAs()"--><!--ng-click="ShowAlert()"-->
  1086 + <div class="col-sm-12"><button id="btnSaveEI" ng-click="SaveImagefile()" class="btn btn-primary" data-dismiss="modal" type="button">Ok</button></div>
1087 1087 </div>
1088 1088 </div>
1089 1089  
... ... @@ -1912,27 +1912,9 @@
1912 1912 });
1913 1913  
1914 1914 });
1915   - $("#btnSaveEI").click(function () {
1916   - $("#canvasDiv").append("<img id='exportlogo' class='img-responsive' src='content/images/adam-logo-small.png'/>");
1917   - html2canvas($("#canvasDiv"), {
1918   - onrendered: function (canvas) {
1919   - theCanvas = canvas;
1920   - var fileName = document.getElementById("filename").value + '.jpg';
1921   - if (typeof (fileName) == "undefined" || fileName == ".jpg")
1922   - fileName = "Untitled.jpg"
1923   - var dataURL = canvas.toDataURL("image/jpeg");
1924   - var blob = dataURItoBlob(dataURL);
1925   - console.log(blob);
1926   - saveAs(blob, fileName);
1927   - $("#exportlogo").remove();
1928   - $("#filename").val("");
1929   - }
1930   - });
1931   - $(".export-image").css("display", "none");
1932   -
1933   - });
1934   - });
1935   - function dataURItoBlob(dataURI) {
  1915 + });
  1916 +
  1917 + function dataURItoBlob(dataURI) {
1936 1918 var byteString = atob(dataURI.split(',')[1]);
1937 1919 var ab = new ArrayBuffer(byteString.length);
1938 1920 var ia = new Uint8Array(ab);
... ...