Commit 3110b119f79d38cfcdb555914ec5da771e72a42a
1 parent
fe633357
Add dist folder
Showing
12 changed files
with
786 additions
and
3 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/AIAHTML5.ADMIN.API/Controllers/DiscountCodeController.cs
@@ -17,7 +17,7 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -17,7 +17,7 @@ using AIAHTML5.ADMIN.API.Entity; | ||
17 | namespace AIAHTML5.ADMIN.API.Controllers | 17 | namespace AIAHTML5.ADMIN.API.Controllers |
18 | { | 18 | { |
19 | 19 | ||
20 | - [EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")] | 20 | + //[EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")] |
21 | [RoutePrefix("DiscountCode")] | 21 | [RoutePrefix("DiscountCode")] |
22 | public class DiscountCodeController : ApiController | 22 | public class DiscountCodeController : ApiController |
23 | { | 23 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/SubscriptionPriceController.cs
@@ -17,7 +17,7 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -17,7 +17,7 @@ using AIAHTML5.ADMIN.API.Entity; | ||
17 | namespace AIAHTML5.ADMIN.API.Controllers | 17 | namespace AIAHTML5.ADMIN.API.Controllers |
18 | { | 18 | { |
19 | 19 | ||
20 | - [EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")] | 20 | + //[EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")] |
21 | [RoutePrefix("SubscriptionPrice")] | 21 | [RoutePrefix("SubscriptionPrice")] |
22 | public class SubscriptionPriceController : ApiController | 22 | public class SubscriptionPriceController : ApiController |
23 | { | 23 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
@@ -16,7 +16,7 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -16,7 +16,7 @@ using AIAHTML5.ADMIN.API.Entity; | ||
16 | 16 | ||
17 | namespace AIAHTML5.ADMIN.API.Controllers | 17 | namespace AIAHTML5.ADMIN.API.Controllers |
18 | { | 18 | { |
19 | - [EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")] | 19 | + //[EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")] |
20 | [RoutePrefix("User")] | 20 | [RoutePrefix("User")] |
21 | public class UserController : ApiController | 21 | public class UserController : ApiController |
22 | { | 22 | { |
400-SOURCECODE/Admin/src/app/components/SubscriptionPrice/subscriptionprice.component.html
0 → 100644
1 | +<div class="row"> | ||
2 | + <!-- main-heading --> | ||
3 | + <div class="col-sm-12 pageHeading"> | ||
4 | + <h4>Subscription Price</h4> | ||
5 | + </div> | ||
6 | + <!-- main-heading --> | ||
7 | + | ||
8 | + <ng-template #template> | ||
9 | + <div class="modal-header"> | ||
10 | + <h4 class="modal-title pull-left">Delete</h4> | ||
11 | + <button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()"> | ||
12 | + <span aria-hidden="true">×</span> | ||
13 | + </button> | ||
14 | + </div> | ||
15 | + <div class="modal-body"> | ||
16 | + <p>Do you want to delete the selected subscription prices?</p> | ||
17 | + </div> | ||
18 | + <div class="modal-footer"> | ||
19 | + <button type="button" class="btn btn-primary btn-sm" (click)="DeleteSubscriptionPrices()" >Yes</button> | ||
20 | + <button type="button" class="btn btn-primary btn-sm" (click)="modalRef.hide()" >No</button> | ||
21 | + </div> | ||
22 | + </ng-template> | ||
23 | + | ||
24 | + <ng-template #templatesuccess> | ||
25 | + <div class="modal-header"> | ||
26 | + <h4 class="modal-title pull-left">Confirmation</h4> | ||
27 | + <button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()"> | ||
28 | + <span aria-hidden="true">×</span> | ||
29 | + </button> | ||
30 | + </div> | ||
31 | + <div class="modal-body" [innerHTML]="modalAlerts"> | ||
32 | + </div> | ||
33 | + <div class="modal-footer"> | ||
34 | + </div> | ||
35 | + </ng-template> | ||
36 | + | ||
37 | + <!-- container --> | ||
38 | + <div [className]="divClass"> | ||
39 | + | ||
40 | + <div class="container-fluid main-full"> | ||
41 | + <!-- form --> | ||
42 | + <form class="form-horizontal" [formGroup]="subscriptionPriceFrm" (submit)="UpdateSubscriptionPrices(templatesuccess)"> | ||
43 | + <div [style.visibility]="(Mode == 'Search') ? 'visible' : 'hidden'" class="row"> | ||
44 | + | ||
45 | + <div class="well marginBtm12"> | ||
46 | + <div class="form-group" *ngIf="alerts != ''"> | ||
47 | + <div class="marginBtm12 text-center"> | ||
48 | + <div class="alert alert-danger" [innerHTML]="alerts"> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + </div> | ||
52 | + <!--tab-content--> | ||
53 | + <div> | ||
54 | + <!-- Nav tabs --> | ||
55 | + <ul class="nav nav-tabs" role="tablist"> | ||
56 | + <li role="presentation" class="active"><a aria-controls="higher-edu" href="#" (click)="SearchSubscriptionPrices(1)" role="tab" data-toggle="tab">Higher Education Instructor</a></li> | ||
57 | + <li role="presentation"><a aria-controls="higher-school" href="#" (click)="SearchSubscriptionPrices(2)" role="tab" data-toggle="tab">Higher School Instructor</a></li> | ||
58 | + <li role="presentation"><a aria-controls="higher-student" href="#" (click)="SearchSubscriptionPrices(3)" role="tab" data-toggle="tab">Higher Education Student</a></li> | ||
59 | + <li role="presentation"><a aria-controls="higher-school-student" href="#" (click)="SearchSubscriptionPrices(4)" role="tab" data-toggle="tab">Higher School Student</a></li> | ||
60 | + <li role="presentation"><a aria-controls="public-library" href="#" (click)="SearchSubscriptionPrices(5)" role="tab" data-toggle="tab">Public Library</a></li> | ||
61 | + <li role="presentation"><a aria-controls="academic-library" href="#" (click)="SearchSubscriptionPrices(6)" role="tab" data-toggle="tab">Academic Library</a></li> | ||
62 | + </ul> | ||
63 | + | ||
64 | + <!-- Tab panes --> | ||
65 | + <div class="tab-content"> | ||
66 | + <!--first-table--> | ||
67 | + <div role="tabpanel" class="tab-pane active" id="higher-edu"> | ||
68 | + <div class="table-responsive blue"> | ||
69 | + <table class="table table-condensed table-bordered margin-btm0 table-striped table-hover"> | ||
70 | + <thead> | ||
71 | + <tr> | ||
72 | + <th>Select</th> | ||
73 | + <th>Subscription Type</th> | ||
74 | + <th>Duration(in Month)</th> | ||
75 | + <th>Price</th> | ||
76 | + <th>Active</th> | ||
77 | + </tr> | ||
78 | + </thead> | ||
79 | + <tbody> | ||
80 | + <tr *ngFor="let item of this.subscriptionPriceFrm.controls['subscriptionPrices'].value; let i = index"> | ||
81 | + <td> | ||
82 | + <input type="hidden" [(contenteditableModel)]="item.Id"> | ||
83 | + <input type="hidden" [(contenteditableModel)]="item.EditionId"> | ||
84 | + <input type="checkbox" (change)="onChange(i, item.Id, $event.target.checked)"> | ||
85 | + </td> | ||
86 | + <td contenteditable="true" [(contenteditableModel)]="item.Title">{{item.Title}}</td> | ||
87 | + <td contenteditable="true" [(contenteditableModel)]="item.Duration">{{item.Duration}}</td> | ||
88 | + <td contenteditable="true" [(contenteditableModel)]="item.Price">{{item.Price | number : '1.2'}}</td> | ||
89 | + <td> | ||
90 | + <input type="checkbox" [(checked)]="item.IsActive" [(contenteditableModel)]="item.IsActive"> | ||
91 | + </td> | ||
92 | + </tr> | ||
93 | + </tbody> | ||
94 | + </table> | ||
95 | + </div> | ||
96 | + </div> | ||
97 | + <!--first-table--> | ||
98 | + | ||
99 | + <div class="row"> | ||
100 | + <div class="col-sm-12 marginTop20 text-center"> | ||
101 | + <button class="btn btn-primary btn-sm" type="button" (click)="AddSubscriptionPrice(templatesuccess)"><i class="fa fa-plus-circle"></i> Add</button> | ||
102 | + <button class="btn btn-primary btn-sm" type="button" (click)="openModal(template)"><i class="fa fa-trash"></i> Delete</button> | ||
103 | + <button class="btn btn-primary btn-sm" type="submit"><i class="fa fa-check"></i> Apply</button> | ||
104 | + </div> | ||
105 | + </div> | ||
106 | + | ||
107 | + </div> | ||
108 | + </div> | ||
109 | + <!--tab-content--> | ||
110 | + </div> | ||
111 | + </div> | ||
112 | + </form> | ||
113 | + <div style="position: absolute; z-index: 100; width: 80%" [style.top]="topPos" [style.visibility]="(Mode=='Add') ? 'visible' : 'hidden'" class="well"> | ||
114 | + <div class="row"> | ||
115 | + <div class="col-sm-12"> | ||
116 | + <div class="panel-body"> | ||
117 | + <!-- form --> | ||
118 | + <form class="form-horizontal" [formGroup]="insertSubscriptionPriceFrm" (submit)="InsertSubscriptionPrice(templatesuccess)"> | ||
119 | + <div class="form-group" *ngIf="alerts != ''"> | ||
120 | + <div class="col-xs-12"> | ||
121 | + <div class="alert alert-danger" [innerHTML]="alerts"> | ||
122 | + </div> | ||
123 | + </div> | ||
124 | + </div> | ||
125 | + | ||
126 | + <div class="form-group"> | ||
127 | + <label for="title" class="col-sm-4 control-label">Title <span class="red">*</span> :</label> | ||
128 | + <div class="col-sm-7"> | ||
129 | + <input type="hidden" formControlName="editionId"> | ||
130 | + <input type="hidden" formControlName="subscriptionPriceId"> | ||
131 | + <input type="text" class="form-control" id="title" formControlName="title" maxlength="50"> | ||
132 | + <div *ngIf="insertSubscriptionPriceFrm.controls.title.hasError('required') && insertSubscriptionPriceFrm.controls.title.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Subscription title is required</div> | ||
133 | + </div> | ||
134 | + </div> | ||
135 | + | ||
136 | + <div class="form-group"> | ||
137 | + <label for="price" class="col-sm-4 control-label">Price <span class="red">*</span> :</label> | ||
138 | + <div class="col-sm-7"> | ||
139 | + <input type="text" class="form-control" id="price" formControlName="price" maxlength="10"> | ||
140 | + <div *ngIf="insertSubscriptionPriceFrm.controls.price.hasError('required') && insertSubscriptionPriceFrm.controls.price.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Subscription price is required</div> | ||
141 | + <div *ngIf="insertSubscriptionPriceFrm.controls.price.hasError('pattern') && insertSubscriptionPriceFrm.controls.price.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Subscription price must be numeric</div> | ||
142 | + </div> | ||
143 | + </div> | ||
144 | + | ||
145 | + <div class="form-group"> | ||
146 | + <label for="duration" class="col-sm-4 control-label">Duration <span class="red">*</span> :</label> | ||
147 | + <div class="col-sm-7"> | ||
148 | + <input type="text" class="form-control" id="duration" formControlName="duration" maxlength="2"> | ||
149 | + <div *ngIf="insertSubscriptionPriceFrm.controls.duration.hasError('required') && insertSubscriptionPriceFrm.controls.duration.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Subscription duration is required</div> | ||
150 | + <div *ngIf="insertSubscriptionPriceFrm.controls.duration.hasError('pattern') && insertSubscriptionPriceFrm.controls.duration.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Subscription duration must be numeric</div> | ||
151 | + </div> | ||
152 | + </div> | ||
153 | + | ||
154 | + <div class="form-group"> | ||
155 | + <label for="status" class="col-sm-4 control-label">Status :</label> | ||
156 | + <div class="col-sm-7"> | ||
157 | + <label class="radio-inline"> | ||
158 | + <input name="isActive" value="true" type="radio" formControlName="isActive"> | ||
159 | + Active | ||
160 | + </label> | ||
161 | + <label class="radio-inline"> | ||
162 | + <input name="isActive" value="false" type="radio" formControlName="isActive"> | ||
163 | + Inactive | ||
164 | + </label> | ||
165 | + </div> | ||
166 | + </div> | ||
167 | + | ||
168 | + <div class="form-group"> | ||
169 | + <div class="col-sm-offset-4 col-sm-7 mar-top17"> | ||
170 | + <button type="submit" [disabled]="!insertSubscriptionPriceFrm.valid" class="btn btn-primary btn-sm"><i class="fa fa-plus-circle"></i> Save</button> | ||
171 | + <button type="button" (click)="CancelAdd()" class="btn btn-primary btn-sm"><i class="fa fa-times-circle"></i> Cancel</button> | ||
172 | + </div> | ||
173 | + </div> | ||
174 | + | ||
175 | + </form> | ||
176 | + <!-- form --> | ||
177 | + | ||
178 | + <!--modal--> | ||
179 | + <div class="modal fade bs-example-modal-sm text-left" tabindex="-1" role="dialog" id="mymodal"> | ||
180 | + <div class="modal-dialog modal-sm" role="document"> | ||
181 | + <div class="modal-content"> | ||
182 | + <div class="modal-header annotation-modal-header ui-draggable-handle"> | ||
183 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
184 | + <h4 class="modal-title" id="">Alert</h4> | ||
185 | + </div> | ||
186 | + <div class="modal-body"> | ||
187 | + <h5>Please select subscription to delete.</h5> | ||
188 | + </div> | ||
189 | + <div class="modal-footer"> | ||
190 | + <div class="row"> | ||
191 | + <div class="col-sm-12"><button class="btn btn-primary btn-sm">Ok</button></div> | ||
192 | + </div> | ||
193 | + </div> | ||
194 | + </div> | ||
195 | + <!-- /.modal-content --> | ||
196 | + </div> | ||
197 | + <!-- /.modal-dialog --> | ||
198 | + </div> | ||
199 | + <!-- /.modal --> | ||
200 | + <!--modal--> | ||
201 | + <!--modal--> | ||
202 | + <div class="modal fade bs-example-modal-sm text-left" tabindex="-1" role="dialog" id="mymodal1"> | ||
203 | + <div class="modal-dialog modal-sm" role="document"> | ||
204 | + <div class="modal-content"> | ||
205 | + <div class="modal-header annotation-modal-header ui-draggable-handle"> | ||
206 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
207 | + <h4 class="modal-title" id="">Alert</h4> | ||
208 | + </div> | ||
209 | + <div class="modal-body"> | ||
210 | + <h5>Subscription type is required.</h5> | ||
211 | + </div> | ||
212 | + <div class="modal-footer"> | ||
213 | + <div class="row"> | ||
214 | + <div class="col-sm-12"><button class="btn btn-primary btn-sm">Ok</button></div> | ||
215 | + </div> | ||
216 | + </div> | ||
217 | + </div> | ||
218 | + <!-- /.modal-content --> | ||
219 | + </div> | ||
220 | + <!-- /.modal-dialog --> | ||
221 | + </div> | ||
222 | + <!-- /.modal --> | ||
223 | + <!--modal--> | ||
224 | + </div> | ||
225 | + </div> | ||
226 | + </div> | ||
227 | + </div> | ||
228 | + </div> | ||
229 | +</div> | ||
230 | +<!-- container --> | ||
231 | +</div> | ||
0 | \ No newline at end of file | 232 | \ No newline at end of file |
400-SOURCECODE/Admin/src/app/components/SubscriptionPrice/subscriptionprice.component.ts
0 → 100644
1 | +import { Component, OnInit, AfterViewInit, Input, Output, EventEmitter, OnChanges, | ||
2 | + SimpleChanges, TemplateRef, Pipe, PipeTransform } from '@angular/core'; | ||
3 | +import { SubscriptionPriceService } from './subscriptionprice.service'; | ||
4 | +import { Router } from '@angular/router'; | ||
5 | +import { FormControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; | ||
6 | +import { SubscriptionPriceModel } from '../UserEntity/datamodel'; | ||
7 | +import { BsDatepickerModule } from 'ngx-bootstrap'; | ||
8 | +import { Http, Response } from '@angular/http'; | ||
9 | +import { DatePipe } from '@angular/common'; | ||
10 | +import { ContenteditableModelDirective } from '../../shared/contenteditabledirective' | ||
11 | +import { BsModalService } from 'ngx-bootstrap/modal'; | ||
12 | +import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service'; | ||
13 | +//import { Global } from '../../Shared/global'; | ||
14 | +//import { DBOperation } from 'S'; | ||
15 | +//import { Observable } from 'rxjs/Observable'; | ||
16 | + | ||
17 | +@Component({ | ||
18 | + templateUrl: './subscriptionprice.component.html' | ||
19 | +}) | ||
20 | + | ||
21 | +export class SubscriptionPrice implements OnInit { | ||
22 | + | ||
23 | +Mode: string = 'Search'; | ||
24 | +subscriptionPrice: SubscriptionPriceModel; | ||
25 | +subscriptionPrices: Array<SubscriptionPriceModel>; | ||
26 | +subscriptionPriceFrm: FormGroup; | ||
27 | +insertSubscriptionPriceFrm: FormGroup; | ||
28 | +checkedRecords: Array<number>; | ||
29 | +error: any; | ||
30 | +alerts: string; | ||
31 | +modalAlerts: string; | ||
32 | +topPos: string = '2000px'; | ||
33 | +datePipe: DatePipe = new DatePipe('en-US'); | ||
34 | +selectedEditionId: number = 1; | ||
35 | +divClass: string = ''; | ||
36 | +modalRef: BsModalRef; | ||
37 | + | ||
38 | +constructor(private subscriptionPriceService: SubscriptionPriceService, private router: Router, private fb: FormBuilder, private modalService: BsModalService) { } | ||
39 | + | ||
40 | + ngOnInit(): void { | ||
41 | + this.divClass = 'col-sm-12'; | ||
42 | + this.subscriptionPrice = new SubscriptionPriceModel(); | ||
43 | + this.alerts = ''; | ||
44 | + this.subscriptionPriceFrm = this.fb.group({ | ||
45 | + subscriptionPrices: this.fb.array([]) | ||
46 | + }); | ||
47 | + this.insertSubscriptionPriceFrm = this.fb.group({ | ||
48 | + subscriptionPriceId: [''], | ||
49 | + title: ['', Validators.required], | ||
50 | + price: ['', [Validators.required, Validators.pattern('[0-9.]*')]], | ||
51 | + duration: ['', [Validators.required, Validators.pattern('[0-9]*')]], | ||
52 | + editionId: [''], | ||
53 | + isActive: [false] | ||
54 | + }); | ||
55 | + this.SearchSubscriptionPrices(this.selectedEditionId); | ||
56 | + } | ||
57 | + | ||
58 | + public SearchSubscriptionPrices(searchEditionId: number) { | ||
59 | + this.selectedEditionId = searchEditionId; | ||
60 | + this.subscriptionPriceService.GetSubscriptionPrices( | ||
61 | + { | ||
62 | + editionId: this.selectedEditionId, | ||
63 | + }) | ||
64 | + .subscribe(x => { this.BindFormFields(x) }, error => this.error = error); | ||
65 | + } | ||
66 | + | ||
67 | + openModal(template: TemplateRef<any>) { | ||
68 | + if(this.checkedRecords.filter(C => C > 0).length == 0) return; | ||
69 | + this.modalRef = this.modalService.show(template); | ||
70 | + } | ||
71 | + | ||
72 | + onChange(Idx: number, Id: number, isChecked: boolean){ | ||
73 | + if(isChecked){ | ||
74 | + this.checkedRecords[Idx] = Id; | ||
75 | + } | ||
76 | + else{ | ||
77 | + this.checkedRecords[Idx] = 0; | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + AfterDeleteData(data, template) { | ||
82 | + if (data.Status == "false") { | ||
83 | + this.alerts = "<span>Subscription prices delete unsuccessfull</span>"; | ||
84 | + } else { | ||
85 | + this.modalAlerts = "<p>Subscription prices deleted successfully</p>"; | ||
86 | + this.modalRef = this.modalService.show(template); | ||
87 | + this.SearchSubscriptionPrices(this.selectedEditionId); | ||
88 | + } | ||
89 | + } | ||
90 | + | ||
91 | + AfterInsertData(data, template) { | ||
92 | + if (data.Status == "false") { | ||
93 | + this.alerts = "<span>Subscription price save unsuccessfull</span>"; | ||
94 | + } else { | ||
95 | + this.modalAlerts = "<p>Subscription price saved successfully</p>"; | ||
96 | + this.modalRef = this.modalService.show(template); | ||
97 | + } | ||
98 | + } | ||
99 | + | ||
100 | + AfterUpdateData(data, template) { | ||
101 | + if (data.Status == "false") { | ||
102 | + this.alerts = "<span>Subscription prices update unsuccessfull</span>\n"; | ||
103 | + } else { | ||
104 | + this.modalAlerts = "<p>Subscription prices updated successfully</p>"; | ||
105 | + this.modalRef = this.modalService.show(template); | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + BindFormFields(data){ | ||
110 | + this.subscriptionPrices = data; | ||
111 | + this.checkedRecords = new Array<number>(this.subscriptionPrices.length); | ||
112 | + this.subscriptionPriceFrm.setControl('subscriptionPrices', this.fb.array(this.subscriptionPrices)); | ||
113 | + } | ||
114 | + | ||
115 | + UpdateSubscriptionPrices(template: TemplateRef<any>){ | ||
116 | + console.log(this.subscriptionPriceFrm.value); | ||
117 | + this.alerts = ''; | ||
118 | + if(this.alerts == ''){ | ||
119 | + var obj = this.subscriptionPriceFrm.controls['subscriptionPrices'].value; | ||
120 | + this.subscriptionPriceService.UpdateSubscriptionPrices(obj).subscribe( | ||
121 | + data => (this.AfterUpdateData(data, template)), | ||
122 | + error => { | ||
123 | + this.error = <any>error; | ||
124 | + this.alerts = "<span>" + this.error + "</span>"; | ||
125 | + }); | ||
126 | + } | ||
127 | + } | ||
128 | + | ||
129 | + InsertSubscriptionPrice(template: TemplateRef<any>){ | ||
130 | + console.log(this.insertSubscriptionPriceFrm.value); | ||
131 | + this.alerts = ''; | ||
132 | + if(this.alerts == ''){ | ||
133 | + var obj = this.insertSubscriptionPriceFrm.value; | ||
134 | + return this.subscriptionPriceService.InsertSubscriptionPrice(obj) | ||
135 | + .subscribe( | ||
136 | + data => (this.AfterInsertData(data, template)), | ||
137 | + error => { | ||
138 | + this.error = <any>error; | ||
139 | + this.alerts = "<span>" + this.error + "</span>"; | ||
140 | + }); | ||
141 | + } | ||
142 | + } | ||
143 | + | ||
144 | + DeleteSubscriptionPrices(template: TemplateRef<any>){ | ||
145 | + console.log(this.checkedRecords); | ||
146 | + this.alerts = ''; | ||
147 | + if(this.alerts == ''){ | ||
148 | + var obj = this.checkedRecords.filter(C => C > 0); | ||
149 | + return this.subscriptionPriceService.DeleteSubscriptionPrices(obj) | ||
150 | + .subscribe( | ||
151 | + data => (this.AfterDeleteData(data, template)), | ||
152 | + error => { | ||
153 | + this.error = <any>error; | ||
154 | + this.alerts = "<span>" + this.error + "</span>"; | ||
155 | + }); | ||
156 | + } | ||
157 | + } | ||
158 | + | ||
159 | + AddSubscriptionPrice(){ | ||
160 | + this.Mode = 'Add'; | ||
161 | + this.topPos = '100px'; | ||
162 | + this.divClass = 'col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3'; | ||
163 | + this.insertSubscriptionPriceFrm.reset(); | ||
164 | + this.alerts = ''; | ||
165 | + this.insertSubscriptionPriceFrm.controls['subscriptionPriceId'].setValue(0); | ||
166 | + this.insertSubscriptionPriceFrm.controls['title'].setValue(''); | ||
167 | + this.insertSubscriptionPriceFrm.controls['price'].setValue(''); | ||
168 | + this.insertSubscriptionPriceFrm.controls['duration'].setValue(''); | ||
169 | + this.insertSubscriptionPriceFrm.controls['editionId'].setValue(this.selectedEditionId); | ||
170 | + this.insertSubscriptionPriceFrm.controls['isActive'].setValue(false); | ||
171 | + } | ||
172 | + | ||
173 | + CancelAdd(){ | ||
174 | + this.Mode = 'Search'; | ||
175 | + this.topPos = '2000px'; | ||
176 | + this.divClass = 'col-sm-12'; | ||
177 | + this.insertSubscriptionPriceFrm.reset(); | ||
178 | + this.alerts = ''; | ||
179 | + this.SearchSubscriptionPrices(this.selectedEditionId); | ||
180 | + } | ||
181 | + | ||
182 | +} |
400-SOURCECODE/Admin/src/app/components/SubscriptionPrice/subscriptionprice.service.ts
0 → 100644
1 | +import { Injectable, Inject } from '@angular/core'; | ||
2 | +//import { HttpClient, HttpParams, HttpRequest} from "@angular/common/http"; | ||
3 | +import { Http, Response, Headers, RequestOptions, HttpModule } from '@angular/http'; | ||
4 | +import 'rxjs/add/operator/map'; | ||
5 | +import 'rxjs/add/operator/catch'; | ||
6 | +import 'rxjs/add/observable/throw'; | ||
7 | +import 'rxjs/add/operator/do'; | ||
8 | +import { Observable } from 'rxjs/Observable'; | ||
9 | +import { GlobalService } from '../../Shared/global'; | ||
10 | + | ||
11 | +@Injectable() | ||
12 | +export class SubscriptionPriceService { | ||
13 | + | ||
14 | + constructor(private http: Http, private commonService: GlobalService ) { } | ||
15 | + | ||
16 | + | ||
17 | + GetSubscriptionPrices(obj: any) { | ||
18 | + return this.http.get(this.commonService.SubscriptionBaseUrl + "/GetSubscriptionPrices?editionId=" | ||
19 | + + obj.editionId) | ||
20 | + .map(this.extractData) | ||
21 | + .catch((res: Response) => this.handleError(res)); | ||
22 | + } | ||
23 | + | ||
24 | + InsertSubscriptionPrice(obj: any) { | ||
25 | + //let options = new RequestOptions({ headers: this.headers }); | ||
26 | + var jsonData = {'id': obj.subscriptionPriceId, 'title': obj.title, 'price': obj.price, 'duration': obj.duration, 'editionId': obj.editionId, 'isActive': obj.isActive }; | ||
27 | + console.log(obj); | ||
28 | + var headers = new Headers({ | ||
29 | + 'Content-Type': 'application/json' | ||
30 | + }); | ||
31 | + return this.http.post(this.commonService.SubscriptionBaseUrl + "/InsertSubscriptionPrice", | ||
32 | + JSON.stringify(jsonData), {headers: headers}) | ||
33 | + .map(this.extractData) | ||
34 | + .catch((res: Response) => this.handleError(res)); | ||
35 | + } | ||
36 | + | ||
37 | + UpdateSubscriptionPrices(obj: any) { | ||
38 | + //let options = new RequestOptions({ headers: this.headers }); | ||
39 | + var jsonData = { obj }; | ||
40 | + console.log(obj); | ||
41 | + var headers = new Headers({ | ||
42 | + 'Content-Type': 'application/json' | ||
43 | + }); | ||
44 | + return this.http.post(this.commonService.SubscriptionBaseUrl + "/UpdateSubscriptionPrices", | ||
45 | + JSON.stringify(jsonData), {headers: headers}) | ||
46 | + .map(this.extractData) | ||
47 | + .catch((res: Response) => this.handleError(res)); | ||
48 | + } | ||
49 | + | ||
50 | + DeleteSubscriptionPrices(obj: any) { | ||
51 | + //let options = new RequestOptions({ headers: this.headers }); | ||
52 | + var subscriptionPriceIds = obj; | ||
53 | + console.log(subscriptionPriceIds); | ||
54 | + var headers = new Headers({ | ||
55 | + 'Content-Type': 'application/json' | ||
56 | + }); | ||
57 | + return this.http.post(this.commonService.SubscriptionBaseUrl + "/DeleteSubscriptionPrices", | ||
58 | + subscriptionPriceIds, {headers: headers}) | ||
59 | + .map(this.extractData) | ||
60 | + .catch((res: Response) => this.handleError(res)); | ||
61 | + } | ||
62 | + | ||
63 | + extractData(res: Response) { | ||
64 | + //debugger; | ||
65 | + let body = res.json(); | ||
66 | + return body; | ||
67 | + } | ||
68 | + | ||
69 | + handleError(error: any) { | ||
70 | + // In a real world app, we might use a remote logging infrastructure | ||
71 | + // We'd also dig deeper into the error to get a better message | ||
72 | + let errMsg = (error.message) ? error.message : | ||
73 | + error.status ? `${error.status} - ${error.statusText}` : 'Server error'; | ||
74 | + console.error(errMsg); // log to console instead | ||
75 | + return Observable.throw(errMsg); | ||
76 | + } | ||
77 | + | ||
78 | + | ||
79 | +} |
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 | \ No newline at end of file | 50 | \ No newline at end of file |