Commit e9bb87209a16082afc42c005274e14d972816507

Authored by Utkarsh Singh
1 parent c8efa44c

Committing updated files

400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... ... @@ -57,6 +57,8 @@ namespace AIAHTML5.API.Controllers
57 57 // PUT api/authenticate/5
58 58 public void Put(int id, [FromBody]string value)
59 59 {
  60 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  61 + logger.Debug("inside POST");
60 62 }
61 63  
62 64 // DELETE api/authenticate/5
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs
... ... @@ -42,7 +42,7 @@ namespace AIAHTML5.API.Controllers
42 42 int result = 0;
43 43 if (!String.IsNullOrEmpty(userInfo["newPassword"].ToString()))
44 44 {
45   - result = AIAHTML5.API.Models.Users.UpdatePassword(userInfo, userData.LoginId, userData.EmailId);
  45 + result = AIAHTML5.API.Models.Users.UpdatePassword(userInfo);
46 46 if (result > 0)
47 47 response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.PASSWORD_UPDATE_SUCCESS) };
48 48 else
... ...
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -431,7 +431,7 @@ namespace AIAHTML5.API.Models
431 431 return objUser;
432 432 }
433 433  
434   - public static int UpdateUserPassword(dynamic userInfo, string loginId, string emailId)
  434 + public static int UpdateUserPassword(dynamic userInfo)
435 435 {
436 436 int result = 0;
437 437 conn = new SqlConnection(dbConnectionString);
... ... @@ -440,8 +440,8 @@ namespace AIAHTML5.API.Models
440 440 conn.Open();
441 441 cmd.CommandText = "UpdateUserPassword";
442 442 cmd.CommandType = CommandType.StoredProcedure;
443   - cmd.Parameters.AddWithValue("@sLoginId", loginId);
444   - cmd.Parameters.AddWithValue("@sEmailId", emailId);
  443 + cmd.Parameters.AddWithValue("@sLoginId", userInfo["loginId"].ToString());
  444 + cmd.Parameters.AddWithValue("@sEmailId", userInfo["emailId"].ToString());
445 445 cmd.Parameters.AddWithValue("@sNewPassword", userInfo["newPassword"].ToString());
446 446 result = cmd.ExecuteNonQuery();
447 447 conn.Close();
... ... @@ -628,5 +628,30 @@ namespace AIAHTML5.API.Models
628 628  
629 629 return lic;
630 630 }
  631 +
  632 + public static int UpdateLicenseTermStatus(string accountNumber)
  633 + {
  634 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  635 + logger.Debug(" inside UpdateTermAcceptedStatus for AccountNumber = " + accountNumber);
  636 + int result = 0;
  637 + try
  638 + {
  639 + conn = new SqlConnection(dbConnectionString);
  640 + cmd = new SqlCommand();
  641 + cmd.Connection = conn;
  642 + conn.Open();
  643 + cmd.CommandText = "UpdateLicenseTermAcceptedStatus";
  644 + cmd.CommandType = CommandType.StoredProcedure;
  645 + cmd.Parameters.AddWithValue("@sAccountNumber", accountNumber);
  646 + result = cmd.ExecuteNonQuery();
  647 + conn.Close();
  648 + }
  649 + catch (SqlException ex)
  650 + {
  651 + conn.Close();
  652 + logger.Fatal("Exception in UpdateTermAcceptedStatus for AccountNumber =" + accountNumber + ", Exception= " + ex.Message);
  653 + }
  654 + return result;
  655 + }
631 656 }
632 657 }
633 658 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... ... @@ -130,7 +130,7 @@ namespace AIAHTML5.API.Models
130 130  
131 131 }
132 132  
133   - internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo, string sLoginId, string sEmailId)
  133 + internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo)
134 134 {
135 135 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
136 136 //var client = new MongoClient();
... ... @@ -143,7 +143,7 @@ namespace AIAHTML5.API.Models
143 143  
144 144 //var result = collection.UpdateOne(filter, update);
145 145  
146   - int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId);
  146 + int result = DBModel.UpdateUserPassword(userInfo);
147 147  
148 148 if (result != null)
149 149 return result;
... ... @@ -156,5 +156,15 @@ namespace AIAHTML5.API.Models
156 156 return AIAConstants.ERROR_IN_FECTHING_DETAILS;
157 157 }
158 158 }
  159 +
  160 + internal static dynamic UpdateLicenseTerm(Newtonsoft.Json.Linq.JObject accNumber)
  161 + {
  162 + int result = DBModel.UpdateUserPassword(userInfo);
  163 +
  164 + if (result != null)
  165 + return result;
  166 + else
  167 + return AIAConstants.USER_NOT_FOUND;
  168 + }
159 169 }
160 170 }
161 171 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -159,15 +159,32 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
159 159 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
160 160 $('#dvUserModulesInfo').modal('show');
161 161 }
162   - //else if ()
163   - else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) {
  162 + //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) {}
164 163  
165   - $rootScope.userData = result;
166   - $rootScope.userModules = result.Modules;
167   - $rootScope.isVisibleLogin = false;
168   - $rootScope.haveRoleAdmin = true;
169   - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
170   - $('#dvUserModulesInfo').modal('show');
  164 + else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) {
  165 + if (result.UserType == UserTypeConstants.CLIENT_ADMIN || result.UserType == UserTypeConstants.DISTRICT_ADMIN || result.UserType == UserTypeConstants.SINGLE_USER || result.UserType == UserTypeConstants.RESELLER) {
  166 + if (result.License.IsTermAccepted) {
  167 + $rootScope.userData = result;
  168 + $rootScope.userModules = result.Modules;
  169 + $rootScope.isVisibleLogin = false;
  170 + $rootScope.haveRoleAdmin = true;
  171 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  172 + $('#dvUserModulesInfo').modal('show');
  173 + }
  174 + else {
  175 + $rootScope.isVisibleLogin = true;
  176 + $('#dvTermCondition').modal('show');
  177 + UpdateUserTermAndCondition(result.License.AccountNumber)
  178 + }
  179 + }
  180 + else {
  181 + $rootScope.userData = result;
  182 + $rootScope.userModules = result.Modules;
  183 + $rootScope.isVisibleLogin = false;
  184 + $rootScope.haveRoleAdmin = true;
  185 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  186 + $('#dvUserModulesInfo').modal('show');
  187 + }
171 188 }
172 189 else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && !result.IsActive) {
173 190 $rootScope.isVisibleLogin = true;
... ... @@ -203,8 +220,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
203 220 $("#messageModal").modal('show');
204 221 }
205 222 }
206   - }
207   -
  223 + }
208 224 }
209 225 }
210 226 },
... ... @@ -218,6 +234,15 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
218 234 }
219 235  
220 236 }
  237 + function UpdateUserTermAndCondition(accountNumber) {
  238 + AuthenticationService.UpdateTermAndConditionAcceptanceStatus(accountNumber)
  239 + .then(function (result) {
  240 + console.log(' Term and Condition acceptance status updated successfully.');
  241 + },
  242 + function (error) {
  243 + console.log(' Error in Term and Condition acceptance status update = ' + error.statusText);
  244 + });
  245 + };
221 246 function VerifyUrlForQuerystring() {
222 247 var url = $location.url();
223 248  
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
... ... @@ -54,5 +54,23 @@
54 54 return deferred.promise;
55 55 },
56 56  
  57 + UpdateTermAndConditionAcceptanceStatus: function (accountNumber) {
  58 + var deferred = $q.defer();
  59 +
  60 + $http.put('/API/api/Authenticate', JSON.stringify(accountNumber), {
  61 + headers: {
  62 + 'Content-Type': 'application/json'
  63 + }
  64 + })
  65 + .success(function (data, status, headers, config) {
  66 + console.log('success')
  67 + deferred.resolve(data);
  68 + }).error(function (data, status, headers, config) {
  69 + console.log('error')
  70 + deferred.reject(status);
  71 + });
  72 + return deferred.promise;
  73 + }
  74 +
57 75 }
58 76 });
59 77 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -1298,6 +1298,29 @@
1298 1298 </div>
1299 1299 </div>
1300 1300  
  1301 + <!-- Terms & Condition Modal -->
  1302 + <div class=" fade ui-draggable in" id="dvTermCondition" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="padding-left: 17px; display: none; left: 0px !important; z-index: 111111; position: fixed; top: 0; overflow-x: hidden; overflow-y: auto; right: 0px; bottom: 0px; ">
  1303 + <div class="modal-dialog" role="document">
  1304 + <div class="modal-content">
  1305 + <div class="modal-header ui-draggable-handle " style="color: #ffffff; background-color: #0095da; border-color: #007ab3;cursor:default;"><!--color: #e5e5e5;-->
  1306 + <h6 class="text-left lhgt19 padd5" style="color:#fff; text-align:left;">Terms of Service</h6>
  1307 + </div>
  1308 +
  1309 + <div class="modal-body">
  1310 + <div class="panel-body">
  1311 + <!-- form -->
  1312 + <form class="form-horizontal">
  1313 + <div class="form-group">
  1314 + <input type="checkbox" id="chkAccept" />I accept
  1315 + <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mymodal" data-dismiss="modal"><i class="fa fa-check"></i> Next</button>
  1316 + </div>
  1317 + </form>
  1318 + </div>
  1319 + </div>
  1320 +
  1321 + </div>
  1322 + </div>
  1323 +</div>
1301 1324 <script>
1302 1325  
1303 1326 function enableDisableFillOption() {
... ...