Commit ad5a3a1ff4e029c66fb3437d687f1f956e5d7caa
1 parent
03e39b87
commit
Showing
6 changed files
with
141 additions
and
57 deletions
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... | ... | @@ -261,10 +261,24 @@ namespace AIAHTML5.API.Controllers |
261 | 261 | } |
262 | 262 | |
263 | 263 | // get exported image detail |
264 | - | |
265 | 264 | userInfo.UserExportImageDetail = GetLicenseExportImageDetail(userInfo.LicenseId); |
266 | - // GetUserSelectedSettings(userInfo); | |
265 | + | |
267 | 266 | } |
267 | + //get use settings | |
268 | + string skintone; | |
269 | + string modesty; | |
270 | + User us = AIAHTML5.API.Models.Users.GetUserSelectedSettings(userInfo.Id, out skintone, out modesty); | |
271 | + if (us != null) | |
272 | + { | |
273 | + userInfo.userselectedModesty = modesty; | |
274 | + userInfo.userSelectedSkintone = skintone; | |
275 | + } | |
276 | + else | |
277 | + { | |
278 | + userInfo.userselectedModesty = null; | |
279 | + userInfo.userSelectedSkintone = null; | |
280 | + | |
281 | + } | |
268 | 282 | } |
269 | 283 | |
270 | 284 | private static void CheckLicenseStatus(User userInfo) |
... | ... | @@ -365,7 +379,7 @@ namespace AIAHTML5.API.Controllers |
365 | 379 | |
366 | 380 | |
367 | 381 | [HttpPost] |
368 | - [Route("api/Configuration/SaveUserSettings")] | |
382 | + [Route("api/SaveUserSettings")] | |
369 | 383 | public HttpResponseMessage SaveUserSettings([FromBody]JObject jsonData) |
370 | 384 | { |
371 | 385 | int Status = 0; |
... | ... | @@ -374,14 +388,13 @@ namespace AIAHTML5.API.Controllers |
374 | 388 | |
375 | 389 | try |
376 | 390 | { |
377 | - settings.userselectedModesty = jsonData["Modesty"].Value<bool>(); | |
378 | - settings.Id = jsonData["UserId"].Value<int>(); | |
379 | - | |
380 | - settings.userSelectedSkintone = jsonData["skintone"].Value<char>(); | |
391 | + settings.userselectedModesty =jsonData["modesty"].Value<string>(); | |
392 | + settings.userSelectedSkintone = jsonData["skintone"].Value<string>(); | |
381 | 393 | settings.userSelectedFont = null; |
394 | + settings.Id= jsonData["userId"].Value<int>(); | |
382 | 395 | |
383 | 396 | Status = AIAHTML5.API.Models.Users.SaveUserSelectedSettings(settings); |
384 | - if (Status == -1) | |
397 | + if (Status == 1) | |
385 | 398 | |
386 | 399 | { |
387 | 400 | responseData = "1"; |
... | ... | @@ -391,7 +404,7 @@ namespace AIAHTML5.API.Controllers |
391 | 404 | { |
392 | 405 | responseData = AIAConstants.SETTINGS_SAVE_FAILURE; |
393 | 406 | } |
394 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent(responseData) }; | |
407 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseData) }; | |
395 | 408 | |
396 | 409 | } |
397 | 410 | catch (Exception ex) | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... | ... | @@ -310,9 +310,9 @@ namespace AIAHTML5.API.Models |
310 | 310 | return objUser; |
311 | 311 | } |
312 | 312 | |
313 | - internal static User GetSelectedSettings(int userId) | |
313 | + internal User GetSelectedSettings(int userId) | |
314 | 314 | { |
315 | - logger.Debug(" Inside GetSelectedSettings for emailId = " + userId); | |
315 | + logger.Debug(" Inside GetSelectedSettings for userId = " + userId); | |
316 | 316 | |
317 | 317 | User objUser = null; |
318 | 318 | DBModel objModel = new DBModel(); |
... | ... | @@ -327,9 +327,9 @@ namespace AIAHTML5.API.Models |
327 | 327 | cmd.CommandText = DBConstants.GET_SETTINGS; |
328 | 328 | cmd.CommandType = CommandType.StoredProcedure; |
329 | 329 | |
330 | - param = new SqlParameter("@sEmailId", emailId); | |
330 | + param = new SqlParameter("@iUserId", userId); | |
331 | 331 | param.Direction = ParameterDirection.Input; |
332 | - param.DbType = DbType.String; | |
332 | + param.DbType = DbType.Int32; | |
333 | 333 | cmd.Parameters.Add(param); |
334 | 334 | |
335 | 335 | adapter = new SqlDataAdapter(cmd); |
... | ... | @@ -344,27 +344,12 @@ namespace AIAHTML5.API.Models |
344 | 344 | { |
345 | 345 | foreach (DataRow dr in dt.Rows) |
346 | 346 | { |
347 | - int tempVal; | |
348 | - DateTime date; | |
349 | 347 | objUser = new User(); |
350 | 348 | |
351 | - objUser.Id = Convert.ToInt32(dr["Id"]); | |
352 | - objUser.FirstName = dr["FirstName"].ToString(); | |
353 | - objUser.LastName = dr["LastName"].ToString(); | |
354 | - objUser.EmailId = dr["EmailId"].ToString(); | |
355 | - objUser.LoginId = dr["LoginId"].ToString(); | |
356 | - objUser.Password = dr["Password"].ToString(); | |
357 | - objUser.SecurityQuestionId = Int32.TryParse(dr["SecurityQuestionId"].ToString(), out tempVal) ? tempVal : (int?)null; | |
358 | - objUser.SecurityAnswer = dr["SecurityAnswer"].ToString(); ; | |
359 | - objUser.CreatorId = Int32.TryParse(dr["CreatorId"].ToString(), out tempVal) ? tempVal : (int?)null; | |
360 | - objUser.CreationDate = Convert.ToDateTime(dr["CreationDate"]); | |
361 | - objUser.DeactivationDate = DateTime.TryParse(dr["DeactivationDate"].ToString(), out date) ? date : (DateTime?)null; | |
362 | - objUser.ModifierId = Int32.TryParse(dr["ModifierId"].ToString(), out tempVal) ? tempVal : (int?)null; | |
363 | - objUser.ModifiedDate = DateTime.TryParse(dr["ModifiedDate"].ToString(), out date) ? date : (DateTime?)null; | |
364 | - objUser.UserTypeId = Convert.ToInt32(dr["UserTypeId"]); | |
365 | - objUser.UserType = objModel.GetUserTypeStringById(Convert.ToInt32(dr["UserTypeId"])); | |
366 | - objUser.IsActive = Convert.ToBoolean(dr["IsActive"]); | |
367 | - logger.Debug("objUser.Id= " + objUser.Id + ",objUser.FirstName= " + objUser.FirstName + ",objUser.LoginId= " + objUser.LoginId + ",objUser.Password= " + objUser.Password + ",objUser.SecurityQuestionId= " + objUser.SecurityQuestionId); | |
349 | + objUser.Id = Convert.ToInt32(dr["UserId"]); | |
350 | + objUser.userSelectedSkintone = dr["Skintone"].ToString(); | |
351 | + objUser.userselectedModesty = dr["Modesty"].ToString(); | |
352 | + logger.Debug("objUser.Id= " + objUser.Id + ",objUser.userselectedModesty= " + objUser.userselectedModesty + ",objUser.userSelectedSkintone= " + objUser.userSelectedSkintone + ",objUser.Password= " + objUser.Password + ",objUser.SecurityQuestionId= " + objUser.SecurityQuestionId); | |
368 | 353 | } |
369 | 354 | } |
370 | 355 | } |
... | ... | @@ -717,14 +702,14 @@ namespace AIAHTML5.API.Models |
717 | 702 | cmd.Parameters.AddWithValue("@iUserId", settings.Id); |
718 | 703 | cmd.Parameters.AddWithValue("@iModesty", settings.userselectedModesty); |
719 | 704 | cmd.Parameters.AddWithValue("@iSkintone",settings. userSelectedSkintone); |
720 | - // cmd.Parameters.AddWithValue("@ifont", ); | |
705 | + cmd.Parameters.AddWithValue("@ifont","" ); | |
721 | 706 | |
722 | 707 | |
723 | 708 | result = cmd.ExecuteNonQuery(); |
724 | 709 | } |
725 | 710 | catch (SqlException ex) |
726 | 711 | { |
727 | - logger.Fatal("Exception in InsertLoginDetails for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE=" + ex.StackTrace); | |
712 | + logger.Fatal("Exception in InsertLoginDetails for UserId= " + settings.Id + ", Exception= " + ex.Message + ", STACKTRACE=" + ex.StackTrace); | |
728 | 713 | throw; |
729 | 714 | } |
730 | 715 | finally | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/User.cs
... | ... | @@ -39,6 +39,10 @@ namespace AIAHTML5.API.Models |
39 | 39 | public ArrayList Modules { get; set; } |
40 | 40 | public int siteId { get; set; } |
41 | 41 | public string pwd { get; set; } |
42 | + public String userSelectedSkintone { get; set; } | |
43 | + public string userselectedModesty { get; set; } | |
44 | + public string userSelectedFont { get; set; } | |
45 | + | |
42 | 46 | |
43 | 47 | public License LicenseInfo { get; set; } |
44 | 48 | public LicenseSubscriptionDetails LicenseSubscriptions { get; set; } | ... | ... |
400-SOURCECODE/AIAHTML5.Web/Web.config
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | |
22 | 22 | </location> |
23 | 23 | <system.webServer> |
24 | - <rewrite> | |
24 | + <!--<rewrite> | |
25 | 25 | <rules> |
26 | 26 | <rule name="AngularJS Routes" stopProcessing="true"> |
27 | 27 | <match url=".*" /> |
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 | <action type="Rewrite" url="/" /> |
34 | 34 | </rule> |
35 | 35 | </rules> |
36 | - </rewrite> | |
36 | + </rewrite>--> | |
37 | 37 | <staticContent> |
38 | 38 | |
39 | 39 | <remove fileExtension=".mp3" /> |
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" /> |
45 | 45 | <mimeMap fileExtension=".mp3" mimeType="audio/mpeg" /> |
46 | 46 | <mimeMap fileExtension=".vtt" mimeType="text/vtt" /> |
47 | - <mimeMap fileExtension=".json" mimeType="application/json" /> | |
47 | + <!--<mimeMap fileExtension=".json" mimeType="application/json" />--> | |
48 | 48 | |
49 | 49 | </staticContent> |
50 | 50 | <defaultDocument enabled="true"> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -548,36 +548,65 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
548 | 548 | |
549 | 549 | //code for modesty setting |
550 | 550 | if (result.LicenseInfo != null) { |
551 | - if (result.IsModestyOn) { | |
552 | - $rootScope.isModestyOn = true; | |
553 | - $rootScope.isModestyOff = false; | |
554 | - localStorage.setItem("globalModesty", "Y"); | |
555 | - $rootScope.formsetting = { | |
556 | - ethnicity: null, | |
557 | - modesty: "Y" | |
551 | + if (result.userselectedModesty == undefined || result.userselectedModesty == null || | |
552 | + result.userSelectedSkintone == undefined || result.userSelectedSkintone == null) { | |
553 | + if (result.IsModestyOn) { | |
554 | + $rootScope.isModestyOn = true; | |
555 | + $rootScope.isModestyOff = false; | |
556 | + localStorage.setItem("globalModesty", "Y"); | |
557 | + $rootScope.formsetting = { | |
558 | + ethnicity: null, | |
559 | + modesty: "Y" | |
560 | + } | |
561 | + $rootScope.UpdateAndCloseSetting($rootScope.formsetting) | |
562 | + } | |
563 | + else { | |
564 | + $rootScope.isModestyOn = false; | |
565 | + $rootScope.isModestyOff = true; | |
566 | + localStorage.setItem("globalModesty", "N"); | |
567 | + $rootScope.formsetting = { | |
568 | + ethnicity: null, | |
569 | + modesty: "N" | |
570 | + } | |
571 | + $rootScope.UpdateAndCloseSetting($rootScope.formsetting) | |
558 | 572 | } |
559 | - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) | |
560 | 573 | } |
561 | 574 | else { |
562 | - $rootScope.isModestyOn = false; | |
563 | - $rootScope.isModestyOff = true; | |
564 | - localStorage.setItem("globalModesty", "N"); | |
575 | + localStorage.setItem("globalModesty", result.userselectedModesty); | |
576 | + localStorage.setItem("globalEthnicity", result.userSelectedSkintone); | |
577 | + | |
565 | 578 | $rootScope.formsetting = { |
566 | - ethnicity: null, | |
567 | - modesty: "N" | |
579 | + ethnicity: result.userSelectedSkintone, | |
580 | + modesty: result.userselectedModesty | |
568 | 581 | } |
569 | 582 | $rootScope.UpdateAndCloseSetting($rootScope.formsetting) |
583 | + | |
570 | 584 | } |
571 | 585 | } |
572 | 586 | else { |
573 | - $rootScope.isModestyOn = true; | |
574 | - $rootScope.isModestyOff = false; | |
575 | - localStorage.setItem("globalModesty", "Y"); | |
576 | - $rootScope.formsetting = { | |
577 | - ethnicity: null, | |
578 | - modesty: "Y" | |
587 | + if (result.userselectedModesty == undefined || result.userselectedModesty == null || | |
588 | + result.userSelectedSkintone == undefined || result.userSelectedSkintone == null) { | |
589 | + | |
590 | + $rootScope.isModestyOn = true; | |
591 | + $rootScope.isModestyOff = false; | |
592 | + localStorage.setItem("globalModesty", "Y"); | |
593 | + $rootScope.formsetting = { | |
594 | + ethnicity: null, | |
595 | + modesty: "Y" | |
596 | + } | |
597 | + $rootScope.UpdateAndCloseSetting($rootScope.formsetting); | |
598 | + } | |
599 | + else { | |
600 | + localStorage.setItem("globalModesty", result.userselectedModesty); | |
601 | + localStorage.setItem("globalEthnicity", result.userSelectedSkintone); | |
602 | + | |
603 | + $rootScope.formsetting = { | |
604 | + ethnicity: result.userSelectedSkintone, | |
605 | + modesty: result.userselectedModesty | |
606 | + } | |
607 | + $rootScope.UpdateAndCloseSetting($rootScope.formsetting) | |
608 | + | |
579 | 609 | } |
580 | - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) | |
581 | 610 | } |
582 | 611 | //code for modesty setting |
583 | 612 | $rootScope.aiaModesty = $rootScope.formsetting.modesty; |
... | ... | @@ -5974,6 +6003,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
5974 | 6003 | $rootScope.CloseSetting = function () { |
5975 | 6004 | // $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; |
5976 | 6005 | $("#saveSettingsMessageModal").modal('show'); |
6006 | + $("#saveSettingsMessageModal").css('zIndex', 80000000000); | |
5977 | 6007 | //$('#modal-settings').css("display", "none"); |
5978 | 6008 | //$("#modelsettingsbackground").css("display", "none"); |
5979 | 6009 | } |
... | ... | @@ -5981,7 +6011,36 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
5981 | 6011 | |
5982 | 6012 | var currentSkintone = $rootScope.globalSetting.ethnicity; |
5983 | 6013 | var currentModesty = $rootScope.globalSetting.modesty; |
6014 | + var setting={}; | |
6015 | + setting.modesty =currentModesty ; | |
6016 | + setting.skintone = currentSkintone; | |
6017 | + setting.userId = $rootScope.userData.Id; | |
6018 | + AuthenticationService.saveSetings(setting) | |
6019 | + .then( | |
6020 | + | |
6021 | + function (result) { | |
6022 | + var k= result; | |
6023 | + if(result==1){ | |
6024 | + $rootScope.errorMessage = AIAConstants.SETTINGS_SAVED ; | |
6025 | + $('#modal-settings').css("display", "none"); | |
6026 | + $("#modelsettingsbackground").css("display", "none"); | |
5984 | 6027 | |
6028 | + } | |
6029 | + else{ | |
6030 | + $rootScope.errorMessage =AIAConstants.SETTING_SAVE_ERROR; | |
6031 | + | |
6032 | + } | |
6033 | + $("#messageModal").css('zIndex', 80000000000); | |
6034 | + $("#messageModal").modal('show'); | |
6035 | + | |
6036 | + }), | |
6037 | + function (error) { | |
6038 | + console.log(' Error in Saving settings = ' + error.statusText); | |
6039 | + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); | |
6040 | + $rootScope.isVisibleLogin = true; | |
6041 | + $rootScope.errorMessage = error; | |
6042 | + $("#messageModal").modal('show'); | |
6043 | + } | |
5985 | 6044 | } |
5986 | 6045 | $rootScope.UpdateAndCloseSetting = function (setting) { |
5987 | 6046 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
... | ... | @@ -43,6 +43,29 @@ |
43 | 43 | return deferred.promise; |
44 | 44 | }, |
45 | 45 | |
46 | + | |
47 | + saveSetings: function (settings) { | |
48 | + var deferred = $q.defer(); | |
49 | + | |
50 | + $http.post('/API/api/SaveUserSettings', JSON.stringify(settings), { | |
51 | + headers: { | |
52 | + 'Content-Type': 'application/json' | |
53 | + } | |
54 | + }) | |
55 | + .success(function (data, status, headers, config) { | |
56 | + console.log('success') | |
57 | + deferred.resolve(data); | |
58 | + }).error(function (data, status, headers, config) { | |
59 | + console.log('error') | |
60 | + deferred.reject(data); | |
61 | + $rootScope.errorMessage = data; | |
62 | + $("#messageModal").modal('show'); | |
63 | + | |
64 | + }); | |
65 | + return deferred.promise; | |
66 | + }, | |
67 | + | |
68 | + | |
46 | 69 | validateClientSite: function (clientInfo) { |
47 | 70 | var deferred = $q.defer(); |
48 | 71 | ... | ... |