Commit fa970934932777c4744f45060f0ef9e84f190683
1 parent
cbc7e3fa
meregd AIAAdminApi
Showing
6 changed files
with
291 additions
and
0 deletions
150-DOCUMENTATION/002-DBScripts/Admin/Store Procedure/usp_GetSubscriptionPlans.sql
0 → 100644
150-DOCUMENTATION/002-DBScripts/Admin/Store Procedure/usp_InsertSubscriptionPlan.sql
0 → 100644
150-DOCUMENTATION/002-DBScripts/Admin/Store Procedure/usp_UpdateSubscriptionPlan.sql
0 → 100644
400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.html
0 → 100644
1 | +<div class="row"> | |
2 | + <!-- main-heading --> | |
3 | + <div class="col-sm-12 pageHeading"> | |
4 | + <h4>Add User</h4> | |
5 | + </div> | |
6 | + <div class="col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3"> | |
7 | + <div class="container-fluid main-full"> | |
8 | + <div class="row"> | |
9 | + <div class="well"> | |
10 | + <div class="row"> | |
11 | + <div class="col-sm-12"> | |
12 | + <div class="panel-body"> | |
13 | + <!-- form --> | |
14 | + <form class="form-horizontal" novalidate [formGroup]="adduserFrm"> | |
15 | + <div class="form-group" *ngIf="alerts !== ''"> | |
16 | + <div class="col-xs-12"> | |
17 | + <div class="alert alert-danger" [innerHTML]="alerts"> | |
18 | + </div> | |
19 | + </div> | |
20 | + </div> | |
21 | + <div class="form-group"> | |
22 | + <label for="inputEmail3" class="col-sm-4 control-label">User Name <span class="red">*</span> :</label> | |
23 | + <div class="col-sm-7"> | |
24 | + <input type="text" class="form-control input-sm" id="name" placeholder="UserName" formControlName="UserName"> | |
25 | + </div> | |
26 | + </div> | |
27 | + <div class="form-group"> | |
28 | + <label for="inputPassword3" class="col-sm-4 control-label">Password <span class="red">*</span> :</label> | |
29 | + <div class="col-sm-7"> | |
30 | + <input type="password" class="form-control input-sm" id="password" placeholder="" formControlName="Password"> | |
31 | + <span class="help-block">(Minimum 8 characters)</span> | |
32 | + </div> | |
33 | + </div> | |
34 | + <div class="form-group"> | |
35 | + <label for="inputPassword3" class="col-sm-4 control-label">Confirm Password <span class="red">*</span> :</label> | |
36 | + <div class="col-sm-7"> | |
37 | + <input type="password" class="form-control input-sm" id="password" placeholder="" formControlName="ConfirmPassword"> | |
38 | + </div> | |
39 | + </div> | |
40 | + <div class="form-group"> | |
41 | + <label for="inputPassword3" class="col-sm-4 control-label">Email Id <span class="red">*</span> :</label> | |
42 | + <div class="col-sm-7"> | |
43 | + <input type="password" class="form-control" id="inputPassword3" placeholder="Email Id" formControlName="EmailId"> | |
44 | + </div> | |
45 | + </div> | |
46 | + <div class="form-group"> | |
47 | + <label for="inputEmail3" class="col-sm-4 control-label">First Name <span class="red">*</span> :</label> | |
48 | + <div class="col-sm-7"> | |
49 | + <input class="form-control input-sm" id="FirstName" placeholder="FirstName" type="text" formControlName="FirstName"> | |
50 | + </div> | |
51 | + </div> | |
52 | + <div class="form-group"> | |
53 | + <label for="inputEmail3" class="col-sm-4 control-label">Last Name <span class="red">*</span> :</label> | |
54 | + <div class="col-sm-7"> | |
55 | + <input class="form-control input-sm" id="LastName" placeholder="" type="text" formControlName="LastName"> | |
56 | + </div> | |
57 | + </div> | |
58 | + <div class="form-group"> | |
59 | + <label for="inputEmail3" class="col-sm-4 control-label">Account Number <span class="red">*</span> :</label> | |
60 | + <div class="col-sm-7"> | |
61 | + <select class="form-control input-sm" id="AccountNumber" [formControl]="adduserFrm.controls['AccountNumberId']"> | |
62 | + <option value="0" selected>All</option> | |
63 | + <option *ngFor="let AccountNumberEntity of AccountNumberList" value="{{AccountNumberEntity.Id}}">{{ AccountNumberEntity.AccountNumber }}</option> | |
64 | + </select> | |
65 | + </div> | |
66 | + </div> | |
67 | + <div class="form-group"> | |
68 | + <label for="inputEmail3" class="col-sm-4 control-label">User Type <span class="red">*</span> :</label> | |
69 | + <div class="col-sm-7"> | |
70 | + <select class="form-control input-sm" id="UserType"> | |
71 | + <option *ngFor="let UserTypeEntity of UserTypeList" value="{{UserTypeEntity.Id}}">{{ UserTypeEntity.Title }}</option> | |
72 | + </select> | |
73 | + </div> | |
74 | + </div> | |
75 | + <div class="form-group"> | |
76 | + <label for="inputEmail3" class="col-sm-4 control-label">Product Edition <span class="red">*</span> :</label> | |
77 | + <div class="col-sm-7"> | |
78 | + <select class="form-control input-sm" id="ProductEdition"> | |
79 | + <option>Higher Education Instructor </option> | |
80 | + <option>Higher Education Student</option> | |
81 | + </select> | |
82 | + </div> | |
83 | + </div> | |
84 | + <div class="row"> | |
85 | + <div class="col-sm-12 marginTop20 text-center"> | |
86 | + <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mymodal"><i class="fa fa-plus-circle"></i> Add</button> | |
87 | + <!--modal--> | |
88 | + <div class="modal fade bs-example-modal-sm text-left" tabindex="-1" role="dialog" id="mymodal"> | |
89 | + <div class="modal-dialog modal-sm" role="document"> | |
90 | + <div class="modal-content"> | |
91 | + <div class="modal-header annotation-modal-header ui-draggable-handle"> | |
92 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
93 | + <h4 class="modal-title" id="">Alert</h4> | |
94 | + </div> | |
95 | + <div class="modal-body"> | |
96 | + <h5>Please enter a username</h5> | |
97 | + </div> | |
98 | + <div class="modal-footer"> | |
99 | + <div class="row"> | |
100 | + <div class="col-sm-12"><button class="btn btn-primary btn-sm">Ok</button></div> | |
101 | + </div> | |
102 | + </div> | |
103 | + | |
104 | + </div><!-- /.modal-content --> | |
105 | + </div><!-- /.modal-dialog --> | |
106 | + </div> | |
107 | + | |
108 | + <button class="btn btn-primary btn-sm"><i class="fa fa-refresh"></i> Reset</button> | |
109 | + <button class="btn btn-primary btn-sm"><i class="fa fa-close"></i> Cancel</button> | |
110 | + </div> | |
111 | + | |
112 | + </div> | |
113 | + </form> | |
114 | + <!-- form --> | |
115 | + </div> | |
116 | + </div> | |
117 | + </div> | |
118 | + </div> | |
119 | + </div> | |
120 | + </div> | |
121 | + </div> | |
122 | +</div> | ... | ... |
400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts
0 → 100644
1 | +import { Component, OnInit, AfterViewInit,ViewChild } from '@angular/core'; | |
2 | +import { UserService } from '../UserEntity/user.service'; | |
3 | +import { Router } from '@angular/router'; | |
4 | +import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; | |
5 | +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | |
6 | +import { User } from '../UserEntity/datamodel'; | |
7 | +import { Http, Response } from '@angular/http'; | |
8 | +import { GlobalService } from '../../Shared/global'; | |
9 | +//import { DBOperation } from 'S'; | |
10 | +import { Observable } from 'rxjs/Observable'; | |
11 | +import { ConfirmService } from '../../Shared/Confirm/confirm.service'; | |
12 | +import 'rxjs/Rx'; | |
13 | +import 'rxjs/add/operator/map'; | |
14 | +import 'rxjs/add/operator/filter'; | |
15 | + | |
16 | + | |
17 | +@Component({ | |
18 | + templateUrl:'./adduser.component.html' // '../../../../../wwwroot/html/UpdateProfile/updateuserprofile.component.html' | |
19 | +}) | |
20 | + | |
21 | +export class AddUser implements OnInit { | |
22 | + user: User; | |
23 | + baseUrl: string = "User"; | |
24 | + adduserFrm: FormGroup; | |
25 | + useFname: string; | |
26 | + error; | |
27 | + status: boolean; | |
28 | + alerts: string; | |
29 | + emailPattern = "^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"; | |
30 | + public UserTypeList: any; | |
31 | + public AccountNumberList: any; | |
32 | + public ProductEditionList: any; | |
33 | + modalTitle: string; | |
34 | + //@ViewChild("profileModal") | |
35 | + //profileModal: ModalComponent; | |
36 | + //errorMessage: any; | |
37 | + constructor(private userservice: UserService, private router: Router, private fb: FormBuilder, private http: Http, | |
38 | + private _confirmService: ConfirmService, private commonService: GlobalService | |
39 | + ) { } | |
40 | + | |
41 | + ngOnInit(): void { | |
42 | + this.user = new User(); | |
43 | + this.alerts = ''; | |
44 | + //this.userservice.GetUserById(this.UserId); | |
45 | + this.adduserFrm = this.fb.group({ | |
46 | + id: [''], | |
47 | + UserName: ['', Validators.required], | |
48 | + Password: ['', Validators.required], | |
49 | + ConfirmPassword: ['', Validators.required], | |
50 | + FirstName: ['', Validators.required], | |
51 | + LastName: ['', Validators.required], | |
52 | + EmailId: ['', Validators.required], | |
53 | + AccountNumberId: ['', Validators.required], | |
54 | + UserTypeId: ['', Validators.required], | |
55 | + ProductEditionId: ['', Validators.required] | |
56 | + }); | |
57 | + //this.GetAccountNumber(); | |
58 | + this.GetUserTypeByLicenseId(); | |
59 | + } | |
60 | + GetUserTypeByLicenseId() { | |
61 | + debugger; | |
62 | + var Accountnumber = this.adduserFrm.controls['AccountNumberId'].value; | |
63 | + if (Accountnumber == "") { Accountnumber=0} | |
64 | + this.userservice.GetUserTypeByLicenseType({ | |
65 | + AccountNumberId: Accountnumber | |
66 | + }).subscribe(x => { this.UserTypeList = x; }, error => this.error = <any>error); | |
67 | + } | |
68 | + GetAccountNumber() { | |
69 | + | |
70 | + this.userservice.GetAccountNumber() | |
71 | + .subscribe(x => { console.log(x); this.AccountNumberList=x }, error => this.error = <any>error); | |
72 | + } | |
73 | + GetProductEdition() { | |
74 | + this.userservice.GetProductEdition({ | |
75 | + AccountNumberId: this.adduserFrm.controls['AccountNumberId'].value}) | |
76 | + .subscribe(x => { console.log(x); this.ProductEditionList=x }, error => this.error = <any>error); | |
77 | + } | |
78 | + UpdateUserProfile(this) { | |
79 | + // debugger; | |
80 | + this.user = this.adduserFrm.value; | |
81 | + //if(this.user.) | |
82 | + //console.log(this.user); | |
83 | + var obj = this.user | |
84 | + if (this.adduserFrm.valid) { | |
85 | + return this.userservice.UpdateUserProfileById(obj) | |
86 | + .subscribe( | |
87 | + n => (this.AfterInsertData(n)), | |
88 | + error => this.error = <any>error); | |
89 | + } | |
90 | + } | |
91 | + AfterInsertData(data) { | |
92 | + //debugger; | |
93 | + if (data.Status == "False") { | |
94 | + return false; | |
95 | + } else { | |
96 | + this.status = true; | |
97 | + this._confirmService.activate("User Profile Updated Successfully.", "alertMsg"); | |
98 | + } | |
99 | + | |
100 | + } | |
101 | + bindUsers(data) { | |
102 | + | |
103 | + //console.log(data); | |
104 | + //alert(JSON.stringify(data)); | |
105 | + //this.user = data[0]; | |
106 | + | |
107 | + | |
108 | + this.adduserFrm.controls['id'].setValue(this.user.Id) | |
109 | + this.adduserFrm.controls['FirstName'].setValue(this.user.FirstName) | |
110 | + this.adduserFrm.controls['LastName'].setValue(this.user.LastName) | |
111 | + this.adduserFrm.controls['EmailId'].setValue(this.user.EmailId) | |
112 | + this.adduserFrm.controls['UserName'].setValue(this.user.LoginId) | |
113 | + this.adduserFrm.controls['Password'].setValue(this.user.Password) | |
114 | + this.adduserFrm.controls['ConfirmPassword'].setValue(this.user.ConfirmPassword) | |
115 | + this.adduserFrm.controls['AccountNumberId'].setValue(this.user.AccountNumberId) | |
116 | + this.adduserFrm.controls['UserTypeId'].setValue(this.user.UserTypeId) | |
117 | + this.adduserFrm.controls['ProductEditionId'].setValue(this.user.ProductEditionId) | |
118 | + | |
119 | + } | |
120 | +} | ... | ... |
400-SOURCECODE/Admin/src/app/shared/contenteditabledirective.ts
0 → 100644
1 | +import { Directive, ElementRef, Input, Output, OnChanges, EventEmitter, HostListener, SimpleChanges | |
2 | +} from '@angular/core'; | |
3 | + | |
4 | +@Directive({ | |
5 | + selector: '[contenteditableModel]' | |
6 | +}) | |
7 | +export class ContenteditableModelDirective implements OnChanges { | |
8 | + | |
9 | + @Input('contenteditableModel') | |
10 | + public model: any; | |
11 | + | |
12 | + @Output('contenteditableModelChange') | |
13 | + public update = new EventEmitter(); | |
14 | + | |
15 | + private _lastViewModel: any; | |
16 | + | |
17 | + constructor(private elRef: ElementRef) {} | |
18 | + | |
19 | + public ngOnChanges(changes: SimpleChanges): void { | |
20 | + if(this._lastViewModel !== changes['model'].currentValue){ | |
21 | + this._lastViewModel = this.model; | |
22 | + this._refreshView(); | |
23 | + } | |
24 | + } | |
25 | + | |
26 | + @HostListener('blur') | |
27 | + public onBlur() { | |
28 | + if(this.elRef.nativeElement.type == 'checkbox' || this.elRef.nativeElement.type == 'radio'){ | |
29 | + var value = this.elRef.nativeElement.checked; | |
30 | + this._lastViewModel = value; | |
31 | + this.update.emit(value); | |
32 | + } | |
33 | + else{ | |
34 | + var value = this.elRef.nativeElement.innerText; | |
35 | + this._lastViewModel = value; | |
36 | + this.update.emit(value); | |
37 | + } | |
38 | + } | |
39 | + | |
40 | + private _refreshView() { | |
41 | + if(this.elRef.nativeElement.type == 'checkbox' || this.elRef.nativeElement.type == 'radio'){ | |
42 | + this.elRef.nativeElement.value = this.model; | |
43 | + this.elRef.nativeElement.checked = this.model; | |
44 | + } | |
45 | + else{ | |
46 | + this.elRef.nativeElement.innerText = this.model; | |
47 | + } | |
48 | + } | |
49 | +} | |
0 | 50 | \ No newline at end of file | ... | ... |