From cb5759e25f88b239aa866878925e7298a6b9cdca Mon Sep 17 00:00:00 2001 From: Utkarsh Singh Date: Tue, 25 Jul 2017 18:30:09 +0530 Subject: [PATCH] Committing updated files --- 400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj | 1 + 400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs | 3 +++ 400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs | 8 ++++---- 400-SOURCECODE/AIAHTML5.API/Models/Users.cs | 9 +++------ 400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll | Bin 51712 -> 0 bytes 400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb | Bin 62976 -> 0 bytes 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 17 ++++++++++++----- 400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js | 4 ++-- 400-SOURCECODE/AIAHTML5.Web/index.html | 11 ++++++----- 10 files changed, 86 insertions(+), 22 deletions(-) create mode 100644 400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs diff --git a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj index 123ad82..d17cd54 100644 --- a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj +++ b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj @@ -109,6 +109,7 @@ + Global.asax diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs index b04f4bb..d23a28a 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs @@ -21,5 +21,8 @@ namespace AIAHTML5.API.Constants public const string PASSWORD_UPDATE_FAILED = "Password update failed"; public const string INVALID_USER = "Invalid UserID"; + + public const string LICENSE_TERM_CONDITION_UPDATE_SUCCESS = "License Term Accepted field updated successfully."; + public const string LICENSE_TERM_CONDITION_UPDATE_FAILED = "License Term Accepted field update failed."; } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs new file mode 100644 index 0000000..88e9042 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using log4net; +using AIAHTML5.API.Constants; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace AIAHTML5.API.Controllers +{ + public class LicenseTermConditionController : ApiController + { + // GET api/licensetermcondition + public IEnumerable Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api/licensetermcondition/5 + public string Get(int id) + { + return "value"; + } + + // POST api/licensetermcondition + public HttpResponseMessage Post([FromBody]string licenseeAccountNumber) + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("inside POST"); + HttpResponseMessage response = null; + + int result = AIAHTML5.API.Models.Users.UpdateLicenseTerm(licenseeAccountNumber); + if (result > 0) + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.LICENSE_TERM_CONDITION_UPDATE_SUCCESS) }; + else + response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.LICENSE_TERM_CONDITION_UPDATE_FAILED) }; + + return response; + } + + + // PUT api/licensetermcondition/5 + public void Put(int id, [FromBody]string value) + { + } + + // DELETE api/licensetermcondition/5 + public void Delete(int id) + { + } + } +} diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index 07a19dc..7f1dc1a 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -576,9 +576,9 @@ namespace AIAHTML5.API.Models lic.LicenseTypeId = Convert.ToInt32(dr[dc]); if (dc.ColumnName == "InstitutionName") lic.InstitutionName = dr[dc].ToString(); - if (dc.ColumnName == "Adress1") + if (dc.ColumnName == "Address1") lic.Address1 = dr[dc].ToString(); - if (dc.ColumnName == "Adress2") + if (dc.ColumnName == "Address2") lic.Address2 = dr[dc].ToString(); if (dc.ColumnName == "CountryId") lic.CountryId = Convert.ToInt32(dr[dc]); @@ -592,7 +592,7 @@ namespace AIAHTML5.API.Models lic.Phone = dr[dc].ToString(); if (dc.ColumnName == "EmailId") lic.EmailId = dr[dc].ToString(); - if (dc.ColumnName == "TotalLogin") + if (dc.ColumnName == "TotalLogins") lic.TotalLogins = Convert.ToInt32(dr[dc]); if (dc.ColumnName == "AccountTypeId") lic.AccountTypeId = Convert.ToInt32(dr[dc]); @@ -614,7 +614,7 @@ namespace AIAHTML5.API.Models } if (dc.ColumnName == "NoOfRenewals") lic.NoOfRenewals = Convert.ToInt32(dr[dc]); - if (dc.ColumnName == "IsTermAccepted") + if (dc.ColumnName == "IsTermsAccepted") lic.IsTermAccepted = Convert.ToBoolean(dr[dc]); if (dc.ColumnName == "ProductId") lic.ProductId = dr[dc].ToString(); diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 46aaa7a..fc5d6dd 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -157,14 +157,11 @@ namespace AIAHTML5.API.Models } } - internal static dynamic UpdateLicenseTerm(Newtonsoft.Json.Linq.JObject accNumber) + internal static dynamic UpdateLicenseTerm(string accNumber) { - int result = DBModel.UpdateUserPassword(userInfo); + int result = DBModel.UpdateLicenseTermStatus(accNumber); - if (result != null) - return result; - else - return AIAConstants.USER_NOT_FOUND; + return result; } } } \ 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 2b49c8d..3c0de6e 100644 Binary files a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll and b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll differ diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb index 76e7bdb..19504d6 100644 Binary files a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb and b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb differ diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index d88c2a4..16ce809 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -86,6 +86,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.isVisibleLogin; $rootScope.haveRoleAdmin; $rootScope.checked = false; + $rootScope.licenseeAccountNumber = null; var isfilloptionChecked = ""; var isOutlineOptionChecked = ""; $rootScope.forgotPwdModalShow = function () @@ -169,6 +170,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.userModules = result.Modules; $rootScope.isVisibleLogin = false; $rootScope.haveRoleAdmin = true; + $rootScope.licenseeAccountNumber = result.License.AccountNumber; localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); $('#dvUserModulesInfo').modal('show'); //} @@ -193,8 +195,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic //} - if (!result.License.IsTermAccepted) { - $('#dvTermCondition').modal('show'); + if (!result.License.IsTermAccepted) { + $('#dvTermCondition').fadeIn(); + //$('#dvTermCondition').modal('show'); } } else { @@ -254,15 +257,19 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } } - function UpdateUserTermAndCondition(accountNumber) { + $rootScope.UpdateLicenseTermStatus = function () { + $('#dvTermCondition').fadeOut(); + if($rootScope.licenseeAccountNumber !=null) { - AuthenticationService.UpdateTermAndConditionAcceptanceStatus(accountNumber) + AuthenticationService.UpdateLicenseTerm($rootScope.licenseeAccountNumber) .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); + 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 1bc9a3d..5b8918f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -54,10 +54,10 @@ return deferred.promise; }, - UpdateTermAndConditionAcceptanceStatus: function (accountNumber) { + UpdateLicenseTerm: function (licenseeAccountNumber) { var deferred = $q.defer(); - $http.put('/API/api/Authenticate', JSON.stringify(accountNumber), { + $http.post('/API/api/LicenseTermCondition', JSON.stringify(licenseeAccountNumber), { headers: { 'Content-Type': 'application/json' } diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index d8dfad4..8fd39d7 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -1302,7 +1302,8 @@ -