Commit a83adff43bf4a153f7d4fa9788925ed4d7bd030a

Authored by Birendra
1 parent 0c054178

fixed deativation datein admin section

400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
... ... @@ -205,6 +205,13 @@ namespace AIAHTML5.ADMIN.API.Controllers
205 205 UserEntity.Password = jsonUserData["Password"].Value<string>();
206 206 UserEntity.IsActive = jsonUserData["IsActive"].Value<bool>();
207 207 UserEntity.CreatorId = jsonUserData["Modifiedby"].Value<int>();
  208 +
  209 + JToken typeToken= jsonUserData["DeactivationDate"];
  210 + if (typeToken.Type != JTokenType.Null)
  211 + {
  212 + UserEntity.DeactivationDate = typeToken.Value<DateTime>();
  213 + }
  214 +
208 215 try
209 216 {
210 217 Status = UserModel.UpdateUser(dbContext, UserEntity);
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs
... ... @@ -3425,7 +3425,7 @@ namespace AIAHTML5.ADMIN.API.Entity
3425 3425 return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_SaveLabExerciseAttempts", userIdParameter, labExerciseIdentifierParameter, lastQuestionParameter, totalQuestionsParameter);
3426 3426 }
3427 3427  
3428   - public virtual int usp_UpdateAIAUser(string sLoginId, string sPassword, string sFirstname, string sLastname, string sEmailId, Nullable<int> id, Nullable<int> iCreatorId, Nullable<byte> isActive, ObjectParameter status)
  3428 + public virtual int usp_UpdateAIAUser(string sLoginId, string sPassword, string sFirstname, string sLastname, string sEmailId, Nullable<int> id, Nullable<int> iCreatorId, Nullable<byte> isActive, Nullable<System.DateTime> deactivateDate, ObjectParameter status)
3429 3429 {
3430 3430 var sLoginIdParameter = sLoginId != null ?
3431 3431 new ObjectParameter("sLoginId", sLoginId) :
... ... @@ -3459,7 +3459,11 @@ namespace AIAHTML5.ADMIN.API.Entity
3459 3459 new ObjectParameter("isActive", isActive) :
3460 3460 new ObjectParameter("isActive", typeof(byte));
3461 3461  
3462   - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, sEmailIdParameter, idParameter, iCreatorIdParameter, isActiveParameter, status);
  3462 + var deactivateDateParameter = deactivateDate.HasValue ?
  3463 + new ObjectParameter("deactivateDate", deactivateDate) :
  3464 + new ObjectParameter("deactivateDate", typeof(System.DateTime));
  3465 +
  3466 + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, sEmailIdParameter, idParameter, iCreatorIdParameter, isActiveParameter, deactivateDateParameter, status);
3463 3467 }
3464 3468  
3465 3469 public virtual int usp_UpdateblockedUser(Nullable<int> id, ObjectParameter status)
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs
1   -// T4 code generation is enabled for model 'F:\CB_Develop00-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'.
  1 +// T4 code generation is enabled for model 'E:\AIAProject00-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'.
2 2 // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
3 3 // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
4 4 // is open in the designer.
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx
... ... @@ -4,7 +4,7 @@
4 4 <edmx:Runtime>
5 5 <!-- SSDL content -->
6 6 <edmx:StorageModels>
7   - <Schema Namespace="AIADatabaseV5Model.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2008" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
  7 + <Schema Namespace="AIADatabaseV5Model.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2008" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
8 8 <EntityType Name="AccountType">
9 9 <Key>
10 10 <PropertyRef Name="Id" />
... ... @@ -1421,6 +1421,7 @@
1421 1421 <Parameter Name="id" Type="int" Mode="In" />
1422 1422 <Parameter Name="iCreatorId" Type="int" Mode="In" />
1423 1423 <Parameter Name="isActive" Type="tinyint" Mode="In" />
  1424 + <Parameter Name="deactivateDate" Type="datetime" Mode="In" />
1424 1425 <Parameter Name="Status" Type="int" Mode="InOut" />
1425 1426 </Function>
1426 1427 <Function Name="usp_UpdateAiaUserPassword" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
... ... @@ -2539,6 +2540,7 @@
2539 2540 <Parameter Name="id" Mode="In" Type="Int32" />
2540 2541 <Parameter Name="iCreatorId" Mode="In" Type="Int32" />
2541 2542 <Parameter Name="isActive" Mode="In" Type="Byte" />
  2543 + <Parameter Name="deactivateDate" Mode="In" Type="DateTime" />
2542 2544 <Parameter Name="Status" Mode="InOut" Type="Int32" />
2543 2545 </FunctionImport>
2544 2546 <FunctionImport Name="usp_UpdateblockedUser">
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs
... ... @@ -114,7 +114,7 @@ namespace AIAHTML5.ADMIN.API.Models
114 114 short EditionId = (short)UserEntity.EditionId;
115 115 try
116 116 {
117   - dbContext.usp_UpdateAIAUser(UserEntity.LoginId, UserEntity.Password, UserEntity.FirstName, UserEntity.LastName,UserEntity.EmailId,UserEntity.Id,UserEntity.CreatorId,(UserEntity.IsActive ? (byte)1 :(byte)0),spStatus);
  117 + dbContext.usp_UpdateAIAUser(UserEntity.LoginId, UserEntity.Password, UserEntity.FirstName, UserEntity.LastName,UserEntity.EmailId,UserEntity.Id,UserEntity.CreatorId,(UserEntity.IsActive ? (byte)1 :(byte)0),UserEntity.DeactivationDate,spStatus);
118 118 return spStatus.Value.ToString();
119 119 }
120 120 catch (Exception ex)
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts
... ... @@ -97,7 +97,7 @@ export class UserService {
97 97  
98 98 UpdateUserEntity(obj: any) {
99 99 //let options = new RequestOptions({ headers: this.headers });
100   - var jsonData = { 'id': obj.id, 'FirstName': obj.FirstName, 'LastName': obj.LastName, 'EmailId': obj.EmailId, 'UserName': obj.UserName, 'Password': obj.Password, 'Modifiedby': this.commonService.UserId, 'IsActive': obj.isActive};
  100 + var jsonData = { 'id': obj.id, 'FirstName': obj.FirstName, 'LastName': obj.LastName, 'EmailId': obj.EmailId, 'UserName': obj.UserName, 'Password': obj.Password, 'Modifiedby': this.commonService.UserId, 'IsActive': obj.isActive,'DeactivationDate': obj.DeactivationDate};
101 101 console.log(obj);
102 102 var headers = new Headers({
103 103 'Content-Type': 'application/json'
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
... ... @@ -301,8 +301,8 @@
301 301 <div class="form-group">
302 302 <label for="inputEmail3" class="col-sm-5 control-label">Deactivation Date :</label>
303 303 <div class="col-sm-7">
304   - <input class="form-control input-sm" id="DeactivationDate" placeholder="" type="text" formControlName="DeactivationDate" [attr.disabled]="true">
305   -
  304 + <input class="form-control input-sm" id="DeactivationDate" placeholder="" type="text" formControlName="DeactivationDate">
  305 + <!-- <div *ngIf="!adduserFrm.controls.DeactivationDate.valid && adduserFrm.controls.DeactivationDate.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;"></div> -->
306 306 </div>
307 307 </div>
308 308 <div class="row">
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
... ... @@ -53,6 +53,7 @@ export class UsersList implements OnInit, AfterViewChecked {
53 53 selectedId: number = 0;
54 54 divClass: string;
55 55 isActive: boolean;
  56 + deaDateblank:boolean;
56 57 NoRecord: string;
57 58 checkedRecords: Array<number>;
58 59 UncheckedRecords: Array<number>;
... ... @@ -101,7 +102,7 @@ export class UsersList implements OnInit, AfterViewChecked {
101 102 ModifiedDate: [''],
102 103 Createdby: [''],
103 104 Modifiedby: [''],
104   - DeactivationDate: [''],
  105 + DeactivationDate: ['',this.noWhitespaceValidator],
105 106 isActive: [false],
106 107 UserStatusActive: ['false'],
107 108 UserStatusInActive:['']
... ... @@ -400,12 +401,21 @@ export class UsersList implements OnInit, AfterViewChecked {
400 401 if (this.adduserFrm.value.FirstName == '') {
401 402 this.alerts += '</br><span>First Name is required.</span>';
402 403 }
403   - if (this.adduserFrm.value.LastName == '') {
404   - this.alerts += '</br><span>Last Name is required.</span>';
  404 + this.deaDateblank=false;
  405 + if (this.adduserFrm.value.DeactivationDate == '' ||this.adduserFrm.value.DeactivationDate == null) {
  406 + this.deaDateblank=true;
  407 + //set date to pass from validation and later remove
  408 + this.adduserFrm.controls['DeactivationDate'].setValue('01/01/2020');
405 409 }
  410 +
406 411  
407 412 if (this.adduserFrm.valid && this.alerts == '') {
408   - this.adduserFrm.controls['isActive'].setValue(this.adduserFrm.value.UserStatusActive)
  413 + this.adduserFrm.controls['isActive'].setValue(this.adduserFrm.value.UserStatusActive) ;
  414 +
  415 + if(this.deaDateblank)
  416 + {
  417 + this.adduserFrm.controls['DeactivationDate'].setValue(null);
  418 + }
409 419  
410 420 var Userobj = this.adduserFrm.value;
411 421  
... ...