diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
index e9aa11c..394381a 100644
--- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
+++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
@@ -207,13 +207,28 @@ namespace AIAHTML5.ADMIN.API.Controllers
UserEntity.CreatorId = jsonUserData["Modifiedby"].Value();
JToken typeToken= jsonUserData["DeactivationDate"];
- if (typeToken.Type != JTokenType.Null)
- {
- UserEntity.DeactivationDate = typeToken.Value();
- }
try
{
+ try
+ {
+ if (typeToken.Type != JTokenType.Null)
+ {
+ string dateString=typeToken.Value();
+ if(!string.IsNullOrWhiteSpace(dateString))
+ {
+ UserEntity.DeactivationDate = typeToken.Value();
+ }
+
+ }
+ }
+ catch (Exception ex)
+ {
+ // Log exception code goes here
+ return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message);
+ }
+
+
Status = UserModel.UpdateUser(dbContext, UserEntity);
if (Status.Equals("1"))
{
diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
index af9de32..b8d5759 100644
--- a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
+++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
@@ -301,7 +301,7 @@
diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
index 4951ad3..b067eb2 100644
--- a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
+++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
@@ -53,7 +53,6 @@ export class UsersList implements OnInit, AfterViewChecked {
selectedId: number = 0;
divClass: string;
isActive: boolean;
- deaDateblank:boolean;
NoRecord: string;
checkedRecords: Array;
UncheckedRecords: Array;
@@ -102,7 +101,8 @@ export class UsersList implements OnInit, AfterViewChecked {
ModifiedDate: [''],
Createdby: [''],
Modifiedby: [''],
- DeactivationDate: ['',this.noWhitespaceValidator],
+ DeactivationDate: [''],
+ //DeactivationDate: ['',this.noWhitespaceValidator],
isActive: [false],
UserStatusActive: ['false'],
UserStatusInActive:['']
@@ -341,7 +341,6 @@ export class UsersList implements OnInit, AfterViewChecked {
this.bindUsers(x);
}, error => this.error = error);
- //this.adduserFrm.controls['DeactivationDate'].setValue(this.datePipe.transform(this.UserEntity.DeactivationDate, 'MM/dd/yyyy'))
if (this.UserEntity.UserStatus == 'Active') {
this.adduserFrm.controls['UserStatusActive'].setValue('true')
}
@@ -355,9 +354,7 @@ export class UsersList implements OnInit, AfterViewChecked {
}
bindUsers(data) {
-
- //console.log(data);
- //alert(JSON.stringify(data));
+
this.UserDetailEntity = data[0];
this.adduserFrm.controls['DeactivationDate'].setValue(this.datePipe.transform(this.UserDetailEntity.DeactivationDate, 'MM/dd/yyyy'))
this.adduserFrm.controls['Createdby'].setValue(this.UserDetailEntity.Createdby)
@@ -378,6 +375,7 @@ export class UsersList implements OnInit, AfterViewChecked {
//this.managerightFrm.contains['UserId'].setValue(this.UserEntity.Id);
}
+
public UpdateUser() {
this.alerts = '';
@@ -401,21 +399,16 @@ export class UsersList implements OnInit, AfterViewChecked {
if (this.adduserFrm.value.FirstName == '') {
this.alerts += 'First Name is required.';
}
- this.deaDateblank=false;
- if (this.adduserFrm.value.DeactivationDate == '' ||this.adduserFrm.value.DeactivationDate == null) {
- this.deaDateblank=true;
- //set date to pass from validation and later remove
- this.adduserFrm.controls['DeactivationDate'].setValue('01/01/2020');
+ if (this.adduserFrm.value.DeactivationDate != null) {
+ if(this.adduserFrm.value.DeactivationDate.trim() == '')
+ {
+ this.adduserFrm.controls['DeactivationDate'].setValue(null);
+ }
}
if (this.adduserFrm.valid && this.alerts == '') {
this.adduserFrm.controls['isActive'].setValue(this.adduserFrm.value.UserStatusActive) ;
-
- if(this.deaDateblank)
- {
- this.adduserFrm.controls['DeactivationDate'].setValue(null);
- }
var Userobj = this.adduserFrm.value;