Commit ec08e3258e165c45f8aadfa9feac8e2a482697a0

Authored by Birendra Kumar
1 parent 498d6965

user validation fixed

400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
... ... @@ -49,9 +49,9 @@ namespace AIAHTML5.ADMIN.API.Controllers
49 49 {
50 50 dbContext.Configuration.ProxyCreationEnabled = false;
51 51 try
52   - {
  52 + {
53 53 return Ok(dbContext.AIAUsers.Where(u => u.Id == userId).Select(s => new UserModel {
54   - DeactivationDate=s.DeactivationDate.Value,
  54 + DeactivationDate=s.DeactivationDate,
55 55 Createdby = dbContext.AIAUsers.Where(sub1 => sub1.Id == s.CreatorId).Select(sub1 => sub1.FirstName ).FirstOrDefault()+ " "+ dbContext.AIAUsers.Where(sub1 => sub1.Id == s.CreatorId).Select(sub1 => sub1.LastName).FirstOrDefault(),
56 56 Modifiedby = dbContext.AIAUsers.Where(sub1 => sub1.Id == s.ModifierId).Select(sub1 => sub1.FirstName ).FirstOrDefault() + " " + dbContext.AIAUsers.Where(sub1 => sub1.Id == s.ModifierId).Select(sub1 => sub1.LastName).FirstOrDefault()
57 57 }).ToList());
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs
... ... @@ -24,7 +24,7 @@ namespace AIAHTML5.ADMIN.API.Controllers
24 24  
25 25 [Route("LicenseUserGroups")]
26 26 [HttpGet]
27   - public HttpResponseMessage GetLicenseUserGroups(int LicenseId, int pageNo, int pageLength)
  27 + public HttpResponseMessage GetLicenseUserGroups(int? LicenseId, int pageNo, int pageLength)
28 28 {
29 29 List<UserGroupModel> UserGroupList = new List<UserGroupModel>();
30 30 int recordCount = 0;
... ... @@ -42,7 +42,7 @@ namespace AIAHTML5.ADMIN.API.Controllers
42 42  
43 43 [Route("LicenseUserGroupUsers")]
44 44 [HttpGet]
45   - public HttpResponseMessage GetLicenseUserGroupUsers(int LicenseId, int UserGroupId, bool AllUsers, int pageNo, int pageLength)
  45 + public HttpResponseMessage GetLicenseUserGroupUsers(int? LicenseId, int UserGroupId, bool AllUsers, int pageNo, int pageLength)
46 46 {
47 47 List<UserModel> UserList = new List<UserModel>();
48 48 int recordCount = 0;
... ... @@ -142,7 +142,7 @@ namespace AIAHTML5.ADMIN.API.Controllers
142 142  
143 143 [Route("CheckDuplicateLicenseUserGroup")]
144 144 [HttpGet]
145   - public HttpResponseMessage CheckDuplicateLicenseUserGroup(int LicenseId, string Title)
  145 + public HttpResponseMessage CheckDuplicateLicenseUserGroup(int? LicenseId, string Title)
146 146 {
147 147 bool Status = false;
148 148 try
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs
... ... @@ -16,7 +16,7 @@ namespace AIAHTML5.ADMIN.API.Models
16 16 public bool? IsActive { get; set; }
17 17 public int? TotalUsers { get; set; }
18 18  
19   - public static List<UserGroupModel> GetLicenseUserGroups(AIADatabaseV5Entities dbContext, int LicenseId, int pageNo, int pageLength, out int recordCount)
  19 + public static List<UserGroupModel> GetLicenseUserGroups(AIADatabaseV5Entities dbContext, int? LicenseId, int pageNo, int pageLength, out int recordCount)
20 20 {
21 21 List<UserGroupModel> UserGroupList = new List<UserGroupModel>();
22 22 UserGroupModel UserGroupObj = new UserGroupModel();
... ... @@ -43,7 +43,7 @@ namespace AIAHTML5.ADMIN.API.Models
43 43 return UserGroupList;
44 44 }
45 45  
46   - public static List<UserModel> GetLicenseUserGroupUsers(AIADatabaseV5Entities dbContext, int LicenseId, int UserGroupId, bool AllUsers, int pageNo, int pageLength, out int recordCount)
  46 + public static List<UserModel> GetLicenseUserGroupUsers(AIADatabaseV5Entities dbContext, int? LicenseId, int UserGroupId, bool AllUsers, int pageNo, int pageLength, out int recordCount)
47 47 {
48 48 List<UserModel> UserList = new List<UserModel>();
49 49 UserModel UserModelObj = new UserModel();
... ... @@ -113,7 +113,7 @@ namespace AIAHTML5.ADMIN.API.Models
113 113 }
114 114 }
115 115  
116   - public static bool CheckDuplicateLicenseUserGroup(AIADatabaseV5Entities dbContext, int LicenseId, string Title)
  116 + public static bool CheckDuplicateLicenseUserGroup(AIADatabaseV5Entities dbContext, int? LicenseId, string Title)
117 117 {
118 118 var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
119 119 try
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs
... ... @@ -19,7 +19,7 @@ namespace AIAHTML5.ADMIN.API.Models
19 19 public string SecurityAnswer { get; set; }
20 20 public int CreatorId { get; set; }
21 21 public DateTime CreationDate { get; set; }
22   - public DateTime DeactivationDate { get; set; }
  22 + public DateTime ? DeactivationDate { get; set; }
23 23 public int ModifierId { get; set; }
24 24 public DateTime ModifiedDate { get; set; }
25 25 public int UserTypeId { get; set; }
... ... @@ -99,6 +99,7 @@ namespace AIAHTML5.ADMIN.API.Models
99 99 try
100 100 {
101 101 dbContext.usp_InsertAIAUser(UserEntity.LoginId, UserEntity.Password, UserEntity.FirstName, UserEntity.LastName, (byte)UserEntity.iUserTypeId, UserEntity.EmailId, (byte)questionId, null, UserEntity.Id, UserEntity.LicenseId, (byte)EditionId, spStatus);
  102 +
102 103 return spStatus.Value.ToString();
103 104 }
104 105 catch(Exception ex)
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -5741,7 +5741,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
5741 5741 }
5742 5742  
5743 5743 $rootScope.reDirectURLToAdmin = function () {
5744   - window.location.href = "Admin-UI";
  5744 + window.location.href = "Admin";
5745 5745 };
5746 5746  
5747 5747 $rootScope.SendAdminAccessRequestMail = function (userInfo) {
... ...
400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts
... ... @@ -35,9 +35,9 @@ export class AddLicense implements OnInit {
35 35 divClass: string = '';
36 36 topPos: string = '2000px';
37 37 datePipe: DatePipe = new DatePipe('en-US');
38   - bsValue1: Date = new Date();
39   - bsValue2: Date = new Date();
40   - bsValue3: Date = new Date();
  38 + bsValue1: Date = null;//new Date();
  39 + bsValue2: Date = null;//new Date();
  40 + bsValue3: Date = null;//new Date();
41 41 modalRef: BsModalRef;
42 42 editionLoginsText: string;
43 43 rowIndex: number = 0;
... ...
400-SOURCECODE/Admin/src/app/components/LicenseEntity/searchlicense.component.ts
... ... @@ -36,8 +36,8 @@ export class SearchLicense implements OnInit, AfterViewChecked {
36 36 topPos: string = '2000px';
37 37 selectedRow: number = 0;
38 38 datePipe: DatePipe = new DatePipe('en-US');
39   - bsValue1: Date = new Date();
40   - bsValue2: Date = new Date();
  39 + bsValue1: Date = null;//new Date();
  40 + bsValue2: Date = null;//new Date();
41 41 selectedId: number = 0;
42 42 modalRef: BsModalRef;
43 43 checkedRecords: Array<number>;
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.html
... ... @@ -39,7 +39,11 @@
39 39 <label for="inputPassword3" class="col-sm-4 control-label">Confirm Password <span class="red">*</span> :</label>
40 40 <div class="col-sm-7">
41 41 <input type="password" class="form-control input-sm" id="cpassword" placeholder="" formControlName="ConfirmPassword">
42   - <div *ngIf="!adduserFrm.controls.ConfirmPassword.valid && adduserFrm.controls.ConfirmPassword.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Confirm Password is required</div>
  42 + <div *ngIf="!adduserFrm.controls.ConfirmPassword.valid && !adduserFrm.controls.ConfirmPassword.value && adduserFrm.controls.ConfirmPassword.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Confirm Password is required</div>
  43 +
  44 + <div *ngIf="adduserFrm.controls.ConfirmPassword.value!=adduserFrm.controls.Password.value && adduserFrm.controls.ConfirmPassword.valid" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">
  45 + Password not match.
  46 + </div>
43 47 </div>
44 48 </div>
45 49 <div class="form-group">
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts
... ... @@ -196,31 +196,33 @@ export class AddUser implements OnInit, AfterViewInit {
196 196  
197 197 this.alerts = '';
198 198  
199   - if (this.adduserFrm.value.UserName == '') {
  199 + if (this.adduserFrm.value.UserName == '' ||(!this.adduserFrm.controls.UserName.valid))
  200 + {
200 201 this.alerts += '<span>User Name of minimum 8 characters is required.</span>';
201 202 }
202   - if (this.adduserFrm.value.Password == '') {
  203 + if (this.adduserFrm.value.Password == '' ||(!this.adduserFrm.controls.Password.valid )) {
203 204 this.alerts += '</br><span>Password of minimum 8 characters is required.</span>';
204 205 }
205 206  
206 207 if (this.adduserFrm.value.ConfirmPassword == '') {
207 208 this.alerts += '</br><span>Confirm Password is required.</span>';
208 209 }
209   - if (this.adduserFrm.value.EmailId == '') {
  210 + if (this.adduserFrm.value.Password != this.adduserFrm.value.ConfirmPassword) {
  211 + this.alerts += '</br><span>Password and confirm password must be same</span>';
  212 + }
  213 +
  214 + if (this.adduserFrm.value.EmailId == '' ||(!this.adduserFrm.controls.EmailId.valid)) {
210 215 this.alerts += '</br><span>Email Id is required.</span>';
211 216 }
212   - //if(this.LicenseTypeId!=1)
213   - //{
  217 +
214 218 if (this.adduserFrm.value.FirstName == '') {
215 219 this.alerts += '</br><span>First Name is required.</span>';
216 220 }
217 221 if (this.adduserFrm.value.LastName == '') {
218 222 this.alerts += '</br><span>Last Name is required.</span>';
219 223 }
220   - // }
221   - if (this.adduserFrm.value.Password != this.adduserFrm.value.ConfirmPassword) {
222   - this.alerts += '</br><span>Password and confirm password must be same</span>';
223   - }
  224 +
  225 +
224 226 if (this.adduserFrm.value.AccountNumberId == '0') {
225 227 this.alerts += '</br><span>Please select account number</span>';
226 228 }
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
... ... @@ -204,7 +204,10 @@
204 204 <label for="inputPassword3" class="col-sm-5 control-label">Confirm Password <span class="red">*</span> :</label>
205 205 <div class="col-sm-7">
206 206 <input type="password" class="form-control input-sm" id="cpassword" placeholder="" formControlName="ConfirmPassword">
207   - <div *ngIf="!adduserFrm.controls.ConfirmPassword.valid && adduserFrm.controls.ConfirmPassword.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Confirm Password is required</div>
  207 + <div *ngIf="!adduserFrm.controls.ConfirmPassword.valid && !adduserFrm.controls.ConfirmPassword.value && adduserFrm.controls.ConfirmPassword.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Confirm Password is required</div>
  208 + <div *ngIf="adduserFrm.controls.ConfirmPassword.value!=adduserFrm.controls.Password.value && adduserFrm.controls.ConfirmPassword.valid" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">
  209 + Password not match.
  210 + </div>
208 211 </div>
209 212 </div>
210 213 <div class="form-group">
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
... ... @@ -153,16 +153,16 @@ export class UsersList implements OnInit, AfterViewChecked {
153 153 ],
154 154 sort: true
155 155 });
156   -
157   - if(document.getElementById("fixed_table_rc") != null){
  156 +
  157 + if(document.getElementById("fixed_table_rc") != null){
158 158 document.getElementById("fixed_table_rc").remove();
159 159 var testScript = document.createElement("script");
160 160 testScript.setAttribute("id", "fixed_table_rc");
161 161 testScript.setAttribute("src", "../assets/scripts/fixed_table_rc.js");
162 162 testScript.setAttribute("type", "text/javascript");
163 163 document.body.appendChild(testScript);
164   - }
165   -
  164 + }
  165 +
166 166 this._loadingService.HideLoading("global-loading");
167 167  
168 168 //this.GetUserList();
... ... @@ -347,29 +347,31 @@ export class UsersList implements OnInit, AfterViewChecked {
347 347 }
348 348  
349 349 public UpdateUser() {
350   - this.alerts = '';
351   - if (this.adduserFrm.value.UserName == '') {
352   - this.alerts += '<span>User Name minimum 8 characters is required.</span>';
  350 + this.alerts = '';
  351 + if (this.adduserFrm.value.UserName == '' ||(!this.adduserFrm.controls.UserName.valid))
  352 + {
  353 + this.alerts += '<span>User Name of minimum 8 characters is required.</span>';
353 354 }
354   - if (this.adduserFrm.value.Password == '') {
  355 + if (this.adduserFrm.value.Password == '' ||(!this.adduserFrm.controls.Password.valid )) {
355 356 this.alerts += '</br><span>Password of minimum 8 characters is required.</span>';
356 357 }
357 358 if (this.adduserFrm.value.ConfirmPassword == '') {
358 359 this.alerts += '</br><span>Confirm Password is required.</span>';
359 360 }
360   - if (this.adduserFrm.value.EmailId == '') {
  361 + if (this.adduserFrm.value.Password != this.adduserFrm.value.ConfirmPassword) {
  362 + this.alerts += '</br><span>Password and confirm password must be same</span>';
  363 + }
  364 + if (this.adduserFrm.value.EmailId == '' ||(!this.adduserFrm.controls.EmailId.valid)) {
361 365 this.alerts += '</br><span>Email Id is required.</span>';
362 366 }
  367 +
363 368 if (this.adduserFrm.value.FirstName == '') {
364 369 this.alerts += '</br><span>First Name is required.</span>';
365 370 }
366 371 if (this.adduserFrm.value.LastName == '') {
367 372 this.alerts += '</br><span>Last Name is required.</span>';
368 373 }
369   - if (this.adduserFrm.value.Password != this.adduserFrm.value.ConfirmPassword) {
370   - this.alerts += '</br><span>Password and confirm password must be same</span>';
371   - }
372   -
  374 +
373 375 if (this.adduserFrm.valid && this.alerts == '') {
374 376 this.adduserFrm.controls['isActive'].setValue(this.adduserFrm.value.UserStatusActive)
375 377  
... ... @@ -445,7 +447,6 @@ export class UsersList implements OnInit, AfterViewChecked {
445 447 this._confirmService.activate("User Manage Rights Successfully updated.", "alertMsg");
446 448 this.checkedRecords = new Array<number>(this.UserManageRightsList.length);
447 449 this.UncheckedRecords = new Array<number>(this.UserManageRightsList.length);
448   -
449 450 }
450 451 //if (this.closeflag) {
451 452 // this.close.emit(null);
... ...