diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index 980a25d..c3c7310 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -57,6 +57,8 @@ namespace AIAHTML5.API.Controllers // PUT api/authenticate/5 public void Put(int id, [FromBody]string value) { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("inside POST"); } // DELETE api/authenticate/5 diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs index c3b537a..24ede3d 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs @@ -42,7 +42,7 @@ namespace AIAHTML5.API.Controllers int result = 0; if (!String.IsNullOrEmpty(userInfo["newPassword"].ToString())) { - result = AIAHTML5.API.Models.Users.UpdatePassword(userInfo, userData.LoginId, userData.EmailId); + result = AIAHTML5.API.Models.Users.UpdatePassword(userInfo); if (result > 0) response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.PASSWORD_UPDATE_SUCCESS) }; else diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index a663e70..07a19dc 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -431,7 +431,7 @@ namespace AIAHTML5.API.Models return objUser; } - public static int UpdateUserPassword(dynamic userInfo, string loginId, string emailId) + public static int UpdateUserPassword(dynamic userInfo) { int result = 0; conn = new SqlConnection(dbConnectionString); @@ -440,8 +440,8 @@ namespace AIAHTML5.API.Models conn.Open(); cmd.CommandText = "UpdateUserPassword"; cmd.CommandType = CommandType.StoredProcedure; - cmd.Parameters.AddWithValue("@sLoginId", loginId); - cmd.Parameters.AddWithValue("@sEmailId", emailId); + cmd.Parameters.AddWithValue("@sLoginId", userInfo["loginId"].ToString()); + cmd.Parameters.AddWithValue("@sEmailId", userInfo["emailId"].ToString()); cmd.Parameters.AddWithValue("@sNewPassword", userInfo["newPassword"].ToString()); result = cmd.ExecuteNonQuery(); conn.Close(); @@ -628,5 +628,30 @@ namespace AIAHTML5.API.Models return lic; } + + public static int UpdateLicenseTermStatus(string accountNumber) + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug(" inside UpdateTermAcceptedStatus for AccountNumber = " + accountNumber); + int result = 0; + try + { + conn = new SqlConnection(dbConnectionString); + cmd = new SqlCommand(); + cmd.Connection = conn; + conn.Open(); + cmd.CommandText = "UpdateLicenseTermAcceptedStatus"; + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@sAccountNumber", accountNumber); + result = cmd.ExecuteNonQuery(); + conn.Close(); + } + catch (SqlException ex) + { + conn.Close(); + logger.Fatal("Exception in UpdateTermAcceptedStatus for AccountNumber =" + accountNumber + ", Exception= " + ex.Message); + } + return result; + } } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 3117df5..46aaa7a 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -130,7 +130,7 @@ namespace AIAHTML5.API.Models } - internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo, string sLoginId, string sEmailId) + internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo) { ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); //var client = new MongoClient(); @@ -143,7 +143,7 @@ namespace AIAHTML5.API.Models //var result = collection.UpdateOne(filter, update); - int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId); + int result = DBModel.UpdateUserPassword(userInfo); if (result != null) return result; @@ -156,5 +156,15 @@ namespace AIAHTML5.API.Models return AIAConstants.ERROR_IN_FECTHING_DETAILS; } } + + internal static dynamic UpdateLicenseTerm(Newtonsoft.Json.Linq.JObject accNumber) + { + int result = DBModel.UpdateUserPassword(userInfo); + + if (result != null) + return result; + else + return AIAConstants.USER_NOT_FOUND; + } } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll index e5bae69..2b49c8d 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb index e462f03..76e7bdb 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 837991a..f52e80e 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -159,15 +159,32 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); $('#dvUserModulesInfo').modal('show'); } - //else if () - else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) { + //else if ((!result.IsSubscriptionExpired) && (result.UserType== UserTypeConstants.CLIENT_ADMIN || result.UserType== UserTypeConstants.DISTRICT_ADMIN || result.UserType== UserTypeConstants.SINGLE_USER ||result.UserType== UserTypeConstants.RESELLER) && result.License.IsTermAccepted) {} - $rootScope.userData = result; - $rootScope.userModules = result.Modules; - $rootScope.isVisibleLogin = false; - $rootScope.haveRoleAdmin = true; - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); - $('#dvUserModulesInfo').modal('show'); + else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) { + if (result.UserType == UserTypeConstants.CLIENT_ADMIN || result.UserType == UserTypeConstants.DISTRICT_ADMIN || result.UserType == UserTypeConstants.SINGLE_USER || result.UserType == UserTypeConstants.RESELLER) { + if (result.License.IsTermAccepted) { + $rootScope.userData = result; + $rootScope.userModules = result.Modules; + $rootScope.isVisibleLogin = false; + $rootScope.haveRoleAdmin = true; + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); + $('#dvUserModulesInfo').modal('show'); + } + else { + $rootScope.isVisibleLogin = true; + $('#dvTermCondition').modal('show'); + UpdateUserTermAndCondition(result.License.AccountNumber) + } + } + else { + $rootScope.userData = result; + $rootScope.userModules = result.Modules; + $rootScope.isVisibleLogin = false; + $rootScope.haveRoleAdmin = true; + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); + $('#dvUserModulesInfo').modal('show'); + } } else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && !result.IsActive) { $rootScope.isVisibleLogin = true; @@ -203,8 +220,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("#messageModal").modal('show'); } } - } - + } } } }, @@ -218,6 +234,15 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } } + function UpdateUserTermAndCondition(accountNumber) { + AuthenticationService.UpdateTermAndConditionAcceptanceStatus(accountNumber) + .then(function (result) { + console.log(' Term and Condition acceptance status updated successfully.'); + }, + function (error) { + console.log(' Error in Term and Condition acceptance status update = ' + error.statusText); + }); + }; function VerifyUrlForQuerystring() { var url = $location.url(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index 05e1c3b..1bc9a3d 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -54,5 +54,23 @@ return deferred.promise; }, + UpdateTermAndConditionAcceptanceStatus: function (accountNumber) { + var deferred = $q.defer(); + + $http.put('/API/api/Authenticate', JSON.stringify(accountNumber), { + headers: { + 'Content-Type': 'application/json' + } + }) + .success(function (data, status, headers, config) { + console.log('success') + deferred.resolve(data); + }).error(function (data, status, headers, config) { + console.log('error') + deferred.reject(status); + }); + return deferred.promise; + } + } }); \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index 93f444a..ec9ca5e 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -1298,6 +1298,29 @@ + +