Commit 5582ba90d71e35331d17bf181d3ed8278f8e3d7d
1 parent
1ee8a72b
added procedures, baclend code for save and gt settings, need to modify get code and ui code
Showing
5 changed files
with
152 additions
and
5 deletions
400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | <RootNamespace>AIAHTML5.API</RootNamespace> |
15 | 15 | <AssemblyName>AIAHTML5.API</AssemblyName> |
16 | 16 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
17 | - <UseIISExpress>true</UseIISExpress> | |
17 | + <UseIISExpress>false</UseIISExpress> | |
18 | 18 | <IISExpressSSLPort /> |
19 | 19 | <IISExpressAnonymousAuthentication /> |
20 | 20 | <IISExpressWindowsAuthentication /> |
... | ... | @@ -181,7 +181,7 @@ |
181 | 181 | <AutoAssignPort>True</AutoAssignPort> |
182 | 182 | <DevelopmentServerPort>63874</DevelopmentServerPort> |
183 | 183 | <DevelopmentServerVPath>/</DevelopmentServerVPath> |
184 | - <IISUrl>http://localhost:63874/</IISUrl> | |
184 | + <IISUrl>http://localhost/AIAHTML5.API</IISUrl> | |
185 | 185 | <NTLMAuthentication>False</NTLMAuthentication> |
186 | 186 | <UseCustomServer>False</UseCustomServer> |
187 | 187 | <CustomServerUrl>http://182.19.10.91/AIAHTML5</CustomServerUrl> | ... | ... |
400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs
... | ... | @@ -19,6 +19,10 @@ namespace AIAHTML5.API.Constants |
19 | 19 | public const string UPDATE_LICENSE_TERM_STATUS = "UpdateLicenseTermAcceptedStatus"; |
20 | 20 | public const string GET_TERMS_AND_CONDITIONS = "GetTermsAndConditions"; |
21 | 21 | public const string INSERT_LOGIN_DETAIL = "InsertLoginDetail"; |
22 | + public const string SAVE_SETTINGS = "usp_SaveUserSettings"; | |
23 | + public const string GET_SETTINGS = "usp_GetUserSettings"; | |
24 | + | |
25 | + | |
22 | 26 | public const string INSERT_INCORRECT_LOGIN_ATTEMPTS = "InsertIncorrectLoginAttempt"; |
23 | 27 | public const string GET_INCORRECT_LOGIN_ATTEMPTS = "GetIncorrectLoginAttempt"; |
24 | 28 | public const string UPDATE_INCORRECT_LOGIN_ATTEMPTS = "UpdateIncorrectLoginAttempts"; | ... | ... |
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... | ... | @@ -263,6 +263,7 @@ namespace AIAHTML5.API.Controllers |
263 | 263 | // get exported image detail |
264 | 264 | |
265 | 265 | userInfo.UserExportImageDetail = GetLicenseExportImageDetail(userInfo.LicenseId); |
266 | + // GetUserSelectedSettings(userInfo); | |
266 | 267 | } |
267 | 268 | } |
268 | 269 | |
... | ... | @@ -361,6 +362,44 @@ namespace AIAHTML5.API.Controllers |
361 | 362 | return insertImageResult; |
362 | 363 | } |
363 | 364 | |
365 | + | |
366 | + | |
367 | + [HttpPost] | |
368 | + [Route("api/Configuration/SaveUserSettings")] | |
369 | + public HttpResponseMessage SaveUserSettings([FromBody]JObject jsonData) | |
370 | + { | |
371 | + int Status = 0; | |
372 | + dynamic responseData; | |
373 | + User settings = new User(); | |
374 | + | |
375 | + try | |
376 | + { | |
377 | + settings.userselectedModesty = jsonData["Modesty"].Value<bool>(); | |
378 | + settings.Id = jsonData["UserId"].Value<int>(); | |
379 | + | |
380 | + settings.userSelectedSkintone = jsonData["skintone"].Value<char>(); | |
381 | + settings.userSelectedFont = null; | |
382 | + | |
383 | + Status = AIAHTML5.API.Models.Users.SaveUserSelectedSettings(settings); | |
384 | + if (Status == -1) | |
385 | + | |
386 | + { | |
387 | + responseData = "1"; | |
388 | + | |
389 | + } | |
390 | + else | |
391 | + { | |
392 | + responseData = AIAConstants.SETTINGS_SAVE_FAILURE; | |
393 | + } | |
394 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent(responseData) }; | |
395 | + | |
396 | + } | |
397 | + catch (Exception ex) | |
398 | + { | |
399 | + // Log exception code goes here | |
400 | + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); | |
401 | + } | |
402 | + } | |
364 | 403 | // PUT api/authenticate/5 |
365 | 404 | public void Put(int id, [FromBody]string value) |
366 | 405 | { | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... | ... | @@ -310,6 +310,68 @@ namespace AIAHTML5.API.Models |
310 | 310 | return objUser; |
311 | 311 | } |
312 | 312 | |
313 | + internal static User GetSelectedSettings(int userId) | |
314 | + { | |
315 | + logger.Debug(" Inside GetSelectedSettings for emailId = " + userId); | |
316 | + | |
317 | + User objUser = null; | |
318 | + DBModel objModel = new DBModel(); | |
319 | + | |
320 | + SqlConnection conn = new SqlConnection(dbConnectionString); | |
321 | + SqlCommand cmd = new SqlCommand(); | |
322 | + SqlDataAdapter adapter; | |
323 | + SqlParameter param; | |
324 | + DataSet ds = new DataSet(); | |
325 | + | |
326 | + cmd.Connection = conn; | |
327 | + cmd.CommandText = DBConstants.GET_SETTINGS; | |
328 | + cmd.CommandType = CommandType.StoredProcedure; | |
329 | + | |
330 | + param = new SqlParameter("@sEmailId", emailId); | |
331 | + param.Direction = ParameterDirection.Input; | |
332 | + param.DbType = DbType.String; | |
333 | + cmd.Parameters.Add(param); | |
334 | + | |
335 | + adapter = new SqlDataAdapter(cmd); | |
336 | + adapter.Fill(ds); | |
337 | + | |
338 | + | |
339 | + if (ds != null && ds.Tables.Count > 0) | |
340 | + { | |
341 | + DataTable dt = ds.Tables[0]; | |
342 | + | |
343 | + if (dt.Rows.Count > 0) | |
344 | + { | |
345 | + foreach (DataRow dr in dt.Rows) | |
346 | + { | |
347 | + int tempVal; | |
348 | + DateTime date; | |
349 | + objUser = new User(); | |
350 | + | |
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); | |
368 | + } | |
369 | + } | |
370 | + } | |
371 | + | |
372 | + return objUser; | |
373 | + } | |
374 | + | |
313 | 375 | internal static int UpdateUserPassword(dynamic userInfo, string loginId, string emailId) |
314 | 376 | { |
315 | 377 | logger.Debug(" Inside UpdateUserPassword for LoginId: " + loginId + ", EmailId: " + emailId); |
... | ... | @@ -637,6 +699,42 @@ namespace AIAHTML5.API.Models |
637 | 699 | return result; |
638 | 700 | } |
639 | 701 | |
702 | + | |
703 | + internal int SaveSettings(User settings) | |
704 | + { | |
705 | + logger.Debug(" inside InsertSettings for UserId= " + settings.Id); | |
706 | + | |
707 | + int result = 0; | |
708 | + SqlConnection conn = null; | |
709 | + try | |
710 | + { | |
711 | + conn = new SqlConnection(dbConnectionString); | |
712 | + SqlCommand cmd = new SqlCommand(); | |
713 | + conn.Open(); | |
714 | + cmd.Connection = conn; | |
715 | + cmd.CommandText = DBConstants.SAVE_SETTINGS; | |
716 | + cmd.CommandType = CommandType.StoredProcedure; | |
717 | + cmd.Parameters.AddWithValue("@iUserId", settings.Id); | |
718 | + cmd.Parameters.AddWithValue("@iModesty", settings.userselectedModesty); | |
719 | + cmd.Parameters.AddWithValue("@iSkintone",settings. userSelectedSkintone); | |
720 | + // cmd.Parameters.AddWithValue("@ifont", ); | |
721 | + | |
722 | + | |
723 | + result = cmd.ExecuteNonQuery(); | |
724 | + } | |
725 | + catch (SqlException ex) | |
726 | + { | |
727 | + logger.Fatal("Exception in InsertLoginDetails for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE=" + ex.StackTrace); | |
728 | + throw; | |
729 | + } | |
730 | + finally | |
731 | + { | |
732 | + conn.Dispose(); | |
733 | + } | |
734 | + | |
735 | + return result; | |
736 | + } | |
737 | + | |
640 | 738 | internal int InsertIncorrectLoginAttempts(int userId) |
641 | 739 | { |
642 | 740 | logger.Debug(" inside InsertIncorrectLoginAttempts for UserId= " + userId); | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -5972,11 +5972,17 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
5972 | 5972 | $("#modelsettingsbackground").css("display", "none"); |
5973 | 5973 | } |
5974 | 5974 | $rootScope.CloseSetting = function () { |
5975 | - | |
5976 | - $('#modal-settings').css("display", "none"); | |
5977 | - $("#modelsettingsbackground").css("display", "none"); | |
5975 | + // $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; | |
5976 | + $("#saveSettingsMessageModal").modal('show'); | |
5977 | + //$('#modal-settings').css("display", "none"); | |
5978 | + //$("#modelsettingsbackground").css("display", "none"); | |
5978 | 5979 | } |
5980 | + $rootScope.saveSettings = function () { | |
5979 | 5981 | |
5982 | + var currentSkintone = $rootScope.globalSetting.ethnicity; | |
5983 | + var currentModesty = $rootScope.globalSetting.modesty; | |
5984 | + | |
5985 | + } | |
5980 | 5986 | $rootScope.UpdateAndCloseSetting = function (setting) { |
5981 | 5987 | |
5982 | 5988 | $rootScope.UpdateSetting(setting); | ... | ... |