Commit a83adff43bf4a153f7d4fa9788925ed4d7bd030a
1 parent
0c054178
fixed deativation datein admin section
Showing
8 changed files
with
35 additions
and
12 deletions
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
@@ -205,6 +205,13 @@ namespace AIAHTML5.ADMIN.API.Controllers | @@ -205,6 +205,13 @@ namespace AIAHTML5.ADMIN.API.Controllers | ||
205 | UserEntity.Password = jsonUserData["Password"].Value<string>(); | 205 | UserEntity.Password = jsonUserData["Password"].Value<string>(); |
206 | UserEntity.IsActive = jsonUserData["IsActive"].Value<bool>(); | 206 | UserEntity.IsActive = jsonUserData["IsActive"].Value<bool>(); |
207 | UserEntity.CreatorId = jsonUserData["Modifiedby"].Value<int>(); | 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 | try | 215 | try |
209 | { | 216 | { |
210 | Status = UserModel.UpdateUser(dbContext, UserEntity); | 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,7 +3425,7 @@ namespace AIAHTML5.ADMIN.API.Entity | ||
3425 | return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_SaveLabExerciseAttempts", userIdParameter, labExerciseIdentifierParameter, lastQuestionParameter, totalQuestionsParameter); | 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 | var sLoginIdParameter = sLoginId != null ? | 3430 | var sLoginIdParameter = sLoginId != null ? |
3431 | new ObjectParameter("sLoginId", sLoginId) : | 3431 | new ObjectParameter("sLoginId", sLoginId) : |
@@ -3459,7 +3459,11 @@ namespace AIAHTML5.ADMIN.API.Entity | @@ -3459,7 +3459,11 @@ namespace AIAHTML5.ADMIN.API.Entity | ||
3459 | new ObjectParameter("isActive", isActive) : | 3459 | new ObjectParameter("isActive", isActive) : |
3460 | new ObjectParameter("isActive", typeof(byte)); | 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 | public virtual int usp_UpdateblockedUser(Nullable<int> id, ObjectParameter status) | 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 | // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer | 2 | // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer |
3 | // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model | 3 | // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model |
4 | // is open in the designer. | 4 | // is open in the designer. |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | <edmx:Runtime> | 4 | <edmx:Runtime> |
5 | <!-- SSDL content --> | 5 | <!-- SSDL content --> |
6 | <edmx:StorageModels> | 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 | <EntityType Name="AccountType"> | 8 | <EntityType Name="AccountType"> |
9 | <Key> | 9 | <Key> |
10 | <PropertyRef Name="Id" /> | 10 | <PropertyRef Name="Id" /> |
@@ -1421,6 +1421,7 @@ | @@ -1421,6 +1421,7 @@ | ||
1421 | <Parameter Name="id" Type="int" Mode="In" /> | 1421 | <Parameter Name="id" Type="int" Mode="In" /> |
1422 | <Parameter Name="iCreatorId" Type="int" Mode="In" /> | 1422 | <Parameter Name="iCreatorId" Type="int" Mode="In" /> |
1423 | <Parameter Name="isActive" Type="tinyint" Mode="In" /> | 1423 | <Parameter Name="isActive" Type="tinyint" Mode="In" /> |
1424 | + <Parameter Name="deactivateDate" Type="datetime" Mode="In" /> | ||
1424 | <Parameter Name="Status" Type="int" Mode="InOut" /> | 1425 | <Parameter Name="Status" Type="int" Mode="InOut" /> |
1425 | </Function> | 1426 | </Function> |
1426 | <Function Name="usp_UpdateAiaUserPassword" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> | 1427 | <Function Name="usp_UpdateAiaUserPassword" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> |
@@ -2539,6 +2540,7 @@ | @@ -2539,6 +2540,7 @@ | ||
2539 | <Parameter Name="id" Mode="In" Type="Int32" /> | 2540 | <Parameter Name="id" Mode="In" Type="Int32" /> |
2540 | <Parameter Name="iCreatorId" Mode="In" Type="Int32" /> | 2541 | <Parameter Name="iCreatorId" Mode="In" Type="Int32" /> |
2541 | <Parameter Name="isActive" Mode="In" Type="Byte" /> | 2542 | <Parameter Name="isActive" Mode="In" Type="Byte" /> |
2543 | + <Parameter Name="deactivateDate" Mode="In" Type="DateTime" /> | ||
2542 | <Parameter Name="Status" Mode="InOut" Type="Int32" /> | 2544 | <Parameter Name="Status" Mode="InOut" Type="Int32" /> |
2543 | </FunctionImport> | 2545 | </FunctionImport> |
2544 | <FunctionImport Name="usp_UpdateblockedUser"> | 2546 | <FunctionImport Name="usp_UpdateblockedUser"> |
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs
@@ -114,7 +114,7 @@ namespace AIAHTML5.ADMIN.API.Models | @@ -114,7 +114,7 @@ namespace AIAHTML5.ADMIN.API.Models | ||
114 | short EditionId = (short)UserEntity.EditionId; | 114 | short EditionId = (short)UserEntity.EditionId; |
115 | try | 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 | return spStatus.Value.ToString(); | 118 | return spStatus.Value.ToString(); |
119 | } | 119 | } |
120 | catch (Exception ex) | 120 | catch (Exception ex) |
400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts
@@ -97,7 +97,7 @@ export class UserService { | @@ -97,7 +97,7 @@ export class UserService { | ||
97 | 97 | ||
98 | UpdateUserEntity(obj: any) { | 98 | UpdateUserEntity(obj: any) { |
99 | //let options = new RequestOptions({ headers: this.headers }); | 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 | console.log(obj); | 101 | console.log(obj); |
102 | var headers = new Headers({ | 102 | var headers = new Headers({ |
103 | 'Content-Type': 'application/json' | 103 | 'Content-Type': 'application/json' |
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
@@ -301,8 +301,8 @@ | @@ -301,8 +301,8 @@ | ||
301 | <div class="form-group"> | 301 | <div class="form-group"> |
302 | <label for="inputEmail3" class="col-sm-5 control-label">Deactivation Date :</label> | 302 | <label for="inputEmail3" class="col-sm-5 control-label">Deactivation Date :</label> |
303 | <div class="col-sm-7"> | 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 | </div> | 306 | </div> |
307 | </div> | 307 | </div> |
308 | <div class="row"> | 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,6 +53,7 @@ export class UsersList implements OnInit, AfterViewChecked { | ||
53 | selectedId: number = 0; | 53 | selectedId: number = 0; |
54 | divClass: string; | 54 | divClass: string; |
55 | isActive: boolean; | 55 | isActive: boolean; |
56 | + deaDateblank:boolean; | ||
56 | NoRecord: string; | 57 | NoRecord: string; |
57 | checkedRecords: Array<number>; | 58 | checkedRecords: Array<number>; |
58 | UncheckedRecords: Array<number>; | 59 | UncheckedRecords: Array<number>; |
@@ -101,7 +102,7 @@ export class UsersList implements OnInit, AfterViewChecked { | @@ -101,7 +102,7 @@ export class UsersList implements OnInit, AfterViewChecked { | ||
101 | ModifiedDate: [''], | 102 | ModifiedDate: [''], |
102 | Createdby: [''], | 103 | Createdby: [''], |
103 | Modifiedby: [''], | 104 | Modifiedby: [''], |
104 | - DeactivationDate: [''], | 105 | + DeactivationDate: ['',this.noWhitespaceValidator], |
105 | isActive: [false], | 106 | isActive: [false], |
106 | UserStatusActive: ['false'], | 107 | UserStatusActive: ['false'], |
107 | UserStatusInActive:[''] | 108 | UserStatusInActive:[''] |
@@ -400,12 +401,21 @@ export class UsersList implements OnInit, AfterViewChecked { | @@ -400,12 +401,21 @@ export class UsersList implements OnInit, AfterViewChecked { | ||
400 | if (this.adduserFrm.value.FirstName == '') { | 401 | if (this.adduserFrm.value.FirstName == '') { |
401 | this.alerts += '</br><span>First Name is required.</span>'; | 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 | if (this.adduserFrm.valid && this.alerts == '') { | 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 | var Userobj = this.adduserFrm.value; | 420 | var Userobj = this.adduserFrm.value; |
411 | 421 |