subscriptionPriceIds)
+ public static bool DeleteSubscriptionPrice(AIADatabaseV5Entities dbContext, int subscriptionPriceId)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
- foreach (var item in subscriptionPriceIds)
- {
- dbContext.usp_DeleteSubscriptionPlan((byte?)item, spStatus);
- if (!(bool)spStatus.Value) break;
- }
+ dbContext.usp_DeleteSubscriptionPlan((byte?)subscriptionPriceId, spStatus);
+ return (bool)spStatus.Value;
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+ }
+
+ public static bool CheckSubscriptionPlanForLicense(AIADatabaseV5Entities dbContext, int subscriptionPriceId)
+ {
+ var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
+ try
+ {
+ dbContext.usp_CheckSubscriptionForLicense((byte?)subscriptionPriceId, spStatus);
return (bool)spStatus.Value;
}
catch (Exception ex)
@@ -95,5 +105,6 @@ namespace AIAHTML5.ADMIN.API.Models
return false;
}
}
+
}
}
\ No newline at end of file
diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs
index bf6f2c7..c71e81f 100644
--- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs
+++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs
@@ -113,6 +113,19 @@ namespace AIAHTML5.ADMIN.API.Models
}
}
+ public static bool CheckDuplicateLicenseUserGroup(AIADatabaseV5Entities dbContext, int LicenseId, string Title)
+ {
+ var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
+ try
+ {
+ dbContext.usp_CheckDuplicateLicenseUserGroup(LicenseId, Title, spStatus);
+ return (bool)spStatus.Value;
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.component.ts b/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.component.ts
index 32468c8..6462602 100644
--- a/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.component.ts
+++ b/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.component.ts
@@ -14,10 +14,14 @@ import { Router } from '@angular/router';
})
export class AppComponent implements OnInit {
-
+ DisplayName: string = "";
constructor(private userservice: UserService, private global: GlobalService, private router: Router) { }
- ngOnInit(): void { }
+ ngOnInit(): void {
+
+ this.DisplayName = this.global.DisplayName;
+ this.router.navigate(['/updateuserprofile']);
+ }
logout() {
localStorage.removeItem('loggedInUserDetails');
window.location.href = this.global.LiveURL;
diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.module.ts b/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.module.ts
index ad95886..b610cc8 100644
--- a/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.module.ts
+++ b/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.module.ts
@@ -44,6 +44,7 @@ import { ConfirmService } from './Shared/Confirm/confirm.service';
import { ConfirmComponent } from "./Shared/Confirm/confirm.component"
import { BsDatepickerModule, ModalModule } from 'ngx-bootstrap';
import { BsModalService } from 'ngx-bootstrap/modal';
+import { ScrollEventModule } from 'ngx-scroll-event';
import { ContenteditableModelDirective } from './shared/contenteditabledirective';
import { LoadingService } from './shared/loading.service';
import { PagerComponent } from './shared/Pager/pager.component';
@@ -76,7 +77,7 @@ import { NumberOnlyDirective } from './shared/numberonlydirective';
],
imports: [
BrowserModule, AppRoutingModule, HttpClientModule, FormsModule, ReactiveFormsModule, HttpModule, Ng2Bs3ModalModule,
- BsDatepickerModule.forRoot(), ModalModule.forRoot()//ModalModule.forRoot()
+ BsDatepickerModule.forRoot(), ModalModule.forRoot(), ScrollEventModule//ModalModule.forRoot()
// , AngularFireModule.initializeApp(firebaseConfig),
],
providers: [GlobalService, ConfirmService, BsModalService, LoadingService, CsvService,
@@ -89,8 +90,8 @@ import { NumberOnlyDirective } from './shared/numberonlydirective';
// useClass: MyInterceptor,
// multi: true
//}
- //{ provide: APP_BASE_HREF, useValue: '/Admin-UI' }
- { provide: APP_BASE_HREF, useValue: '/' }
+ { provide: APP_BASE_HREF, useValue: '/Admin' }
+ //{ provide: APP_BASE_HREF, useValue: '/' }
],
bootstrap: [AppComponent]
diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.component.ts b/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.component.ts
index 8e2b7ab..f67e2a8 100644
--- a/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.component.ts
+++ b/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.component.ts
@@ -40,6 +40,7 @@ NoRecord: string;
recordCount: number;
pageNo: number;
pageLength: number;
+RecordDeleted: number[];
constructor(private subscriptionPriceService: SubscriptionPriceService, private router: Router,
private fb: FormBuilder, private modalService: BsModalService, private global: GlobalService,
@@ -62,11 +63,11 @@ pageLength: number;
});
$('#fixed_hdr2').fxdHdrCol({
fixedCols: 0,
- width: "80%",
+ width: "100%",
height: 300,
colModal: [
{ width: 150, align: 'center' },
- { width: 400, align: 'center' },
+ { width: 490, align: 'center' },
{ width: 200, align: 'Center' },
{ width: 200, align: 'Center' },
{ width: 200, align: 'Center' },
@@ -145,7 +146,7 @@ pageLength: number;
// this.alerts = "Subscription price save unsuccessfull";
this._confirmService.activate("Subscription prices insert unsuccessfull", "alertMsg");
} else {
- this.modalAlerts = "Subscription price saved successfully
";
+ this.modalAlerts = "Subscriptions saved successfully
";
this.CancelAdd();
this.modalRef = this.modalService.show(template);
}
@@ -156,7 +157,7 @@ pageLength: number;
//this.alerts = "Subscription prices update unsuccessfull\n";
this._confirmService.activate("Subscription prices update unsuccessfull", "alertMsg");
} else {
- this.modalAlerts = "Subscription prices updated successfully
";
+ this.modalAlerts = "Subscriptions updated successfully
";
this.modalRef = this.modalService.show(template);
}
}
@@ -209,15 +210,64 @@ pageLength: number;
this.modalRef.hide();
console.log(this.checkedRecords);
this.alerts = '';
+ var deletedSubscriptions = '';
+ var unDeletedSubscriptions = '';
+ let cnt = 0;
if(this.alerts == ''){
- var obj = this.checkedRecords.filter(C => C > 0);
- return this.subscriptionPriceService.DeleteSubscriptionPrices(obj)
+ this.RecordDeleted = [];
+ this.checkedRecords.filter(C => C > 0).forEach(element => {
+ this.subscriptionPriceService.CheckSubscriptionPlanForLicense(element)
.subscribe(
- data => (this.AfterDeleteData(data, template)),
+ data => {
+ if (data == "True") {
+ cnt++;
+ unDeletedSubscriptions += this.subscriptionPrices.find(C => C.Id == element).Title + ", ";
+ if(cnt == this.checkedRecords.filter(C => C > 0).length)
+ {
+ this.modalAlerts = '';
+ if(deletedSubscriptions != ''){
+ this.modalAlerts = "Subscription prices " + deletedSubscriptions.substr(0, deletedSubscriptions.length - 2) + " deleted successfully
";
+ }
+ if(unDeletedSubscriptions != ''){
+ this.modalAlerts += "Subscription prices " + unDeletedSubscriptions.substr(0, unDeletedSubscriptions.length - 2) + " are already mapped to licenses and cannot be deleted.
";
+ }
+ this.modalRef = this.modalService.show(template);
+ this.SearchRecords(this.selectedEditionId);
+ }
+ }
+ else{
+ this.subscriptionPriceService.DeleteSubscriptionPrice(element)
+ .subscribe(
+ data => {
+ if (data == "True") {
+ cnt++;
+ deletedSubscriptions += this.subscriptionPrices.find(C => C.Id == element).Title + ", ";
+ }
+ if(cnt == this.checkedRecords.filter(C => C > 0).length)
+ {
+ this.modalAlerts = '';
+ if(deletedSubscriptions != ''){
+ this.modalAlerts = "Subscription prices " + deletedSubscriptions.substr(0, deletedSubscriptions.length - 2) + " deleted successfully
";
+ }
+ if(unDeletedSubscriptions != ''){
+ this.modalAlerts += "Subscription prices " + unDeletedSubscriptions.substr(0, unDeletedSubscriptions.length - 2) + " are already mapped to licenses and cannot be deleted.
";
+ }
+ this.modalRef = this.modalService.show(template);
+ this.SearchRecords(this.selectedEditionId);
+ }
+ },
+ error => {
+ this.error = error;
+ this.alerts = "" + this.error + "";
+ })
+ }
+ },
error => {
this.error = error;
this.alerts = "" + this.error + "";
});
+ });
+
}
}
diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.service.ts b/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.service.ts
index 06573dd..9f8f0ee 100644
--- a/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.service.ts
+++ b/400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.service.ts
@@ -1,6 +1,6 @@
import { Injectable, Inject } from '@angular/core';
//import { HttpClient, HttpParams, HttpRequest} from "@angular/common/http";
-import { Http, Response, Headers, RequestOptions, HttpModule } from '@angular/http';
+import { Http, Response, Headers, RequestOptions, RequestOptionsArgs, RequestMethod, HttpModule } from '@angular/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/throw';
@@ -15,7 +15,7 @@ export class SubscriptionPriceService {
GetSubscriptionPrices(obj: any) {
- return this.http.get(this.commonService.resourceBaseUrl + "SubscriptionPrice/GetSubscriptionPrices?editionId="
+ return this.http.get(this.commonService.resourceBaseUrl + "SubscriptionPrice/GetSubscriptionPrices?editionId="
+ obj.editionId + "&pageNo=" + obj.pageNo + "&pageLength=" + obj.pageLength)
.map(this.extractData)
.catch((res: Response) => this.handleError(res));
@@ -47,15 +47,22 @@ export class SubscriptionPriceService {
.catch((res: Response) => this.handleError(res));
}
- DeleteSubscriptionPrices(obj: any) {
+ DeleteSubscriptionPrice(obj: any) {
//let options = new RequestOptions({ headers: this.headers });
- var subscriptionPriceIds = obj;
- console.log(subscriptionPriceIds);
- var headers = new Headers({
+ console.log(obj);
+ let subscriptionPriceId = obj;
+ let headers = new Headers({
'Content-Type': 'application/json'
});
- return this.http.post(this.commonService.resourceBaseUrl + "SubscriptionPrice/DeleteSubscriptionPrices",
- subscriptionPriceIds, {headers: headers})
+ return this.http.get(this.commonService.resourceBaseUrl + "SubscriptionPrice/DeleteSubscriptionPrice?subscriptionPriceId=" + subscriptionPriceId)
+ .map(this.extractData)
+ .catch((res: Response) => this.handleError(res));
+ }
+
+ CheckSubscriptionPlanForLicense(obj: any) {
+ //let options = new RequestOptions({ headers: this.headers });
+ console.log(obj);
+ return this.http.get(this.commonService.resourceBaseUrl + "SubscriptionPrice/CheckSubscriptionPlanForLicense?subscriptionPriceId=" + obj)
.map(this.extractData)
.catch((res: Response) => this.handleError(res));
}
diff --git a/500-DBDump/AIA-StoredProcedures/dbo.GetDiscountReport.StoredProcedure.sql b/500-DBDump/AIA-StoredProcedures/dbo.GetDiscountReport.StoredProcedure.sql
index ea21cdb..a649d86 100644
--- a/500-DBDump/AIA-StoredProcedures/dbo.GetDiscountReport.StoredProcedure.sql
+++ b/500-DBDump/AIA-StoredProcedures/dbo.GetDiscountReport.StoredProcedure.sql
diff --git a/500-DBDump/AIA-StoredProcedures/dbo.GetExportedImageDetails.StoredProcedure.sql b/500-DBDump/AIA-StoredProcedures/dbo.GetExportedImageDetails.StoredProcedure.sql
index 19bbd19..615d3f1 100644
--- a/500-DBDump/AIA-StoredProcedures/dbo.GetExportedImageDetails.StoredProcedure.sql
+++ b/500-DBDump/AIA-StoredProcedures/dbo.GetExportedImageDetails.StoredProcedure.sql
diff --git a/500-DBDump/AIA-StoredProcedures/dbo.GetNetAdSummaryReport.StoredProcedure.sql b/500-DBDump/AIA-StoredProcedures/dbo.GetNetAdSummaryReport.StoredProcedure.sql
index be224c0..546fbd6 100644
--- a/500-DBDump/AIA-StoredProcedures/dbo.GetNetAdSummaryReport.StoredProcedure.sql
+++ b/500-DBDump/AIA-StoredProcedures/dbo.GetNetAdSummaryReport.StoredProcedure.sql
diff --git a/500-DBDump/AIA-StoredProcedures/dbo.GetSiteLicenseUsageReport.StoredProcedure.sql b/500-DBDump/AIA-StoredProcedures/dbo.GetSiteLicenseUsageReport.StoredProcedure.sql
index d41e156..ad339b2 100644
--- a/500-DBDump/AIA-StoredProcedures/dbo.GetSiteLicenseUsageReport.StoredProcedure.sql
+++ b/500-DBDump/AIA-StoredProcedures/dbo.GetSiteLicenseUsageReport.StoredProcedure.sql
diff --git a/500-DBDump/AIA-StoredProcedures/usp_CheckSubscriptionForLicense.sql b/500-DBDump/AIA-StoredProcedures/usp_CheckSubscriptionForLicense.sql
new file mode 100644
index 0000000..d554afd
--- /dev/null
+++ b/500-DBDump/AIA-StoredProcedures/usp_CheckSubscriptionForLicense.sql
@@ -0,0 +1,38 @@
+USE [AIADatabaseV5]
+GO
+/****** Object: StoredProcedure [dbo].[usp_CheckSubscriptionForLicense] Script Date: 2/1/2018 12:15:55 PM ******/
+SET ANSI_NULLS ON
+GO
+SET QUOTED_IDENTIFIER ON
+GO
+
+-- ====================================================
+-- Author: Magic Software
+-- Create date: 22-May-2018
+-- Description: To check the licenses exist for a subscription plan
+-- ====================================================
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_CheckSubscriptionForLicense]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
+drop procedure [dbo].[usp_CheckSubscriptionForLicense]
+GO
+
+create PROCEDURE [dbo].[usp_CheckSubscriptionForLicense]
+ -- Add the parameters for the stored procedure here
+ @Id tinyint,
+ @Status bit out
+AS
+BEGIN
+ -- SET NOCOUNT ON added to prevent extra result sets from
+ -- interfering with SELECT statements.
+ SET NOCOUNT ON;
+
+ set @Status = 0;
+ if(exists(select * from [LicenseSubscriptionDetail] where SubscriptionPlanId = @Id))
+ begin
+ set @Status = 1;
+ end
+
+END
+
+
+GO