diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/App_Start/WebApiConfig.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/App_Start/WebApiConfig.cs index caaa6f6..14e1066 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/App_Start/WebApiConfig.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/App_Start/WebApiConfig.cs @@ -21,7 +21,7 @@ namespace AIAHTML5.ADMIN.API string Enablecors = ConfigurationManager.AppSettings["Enablecors"]; if (Enablecors == "false") { - EnableCorsAttribute cors = new EnableCorsAttribute("http://localhost:4200, http://192.168.86.13:91", "*", "GET,POST"); + EnableCorsAttribute cors = new EnableCorsAttribute("http://localhost:4200, http://192.168.86.13:92", "*", "GET,POST"); config.EnableCors(cors); } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs index 600ef6a..1bb3241 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs @@ -71,12 +71,13 @@ namespace AIAHTML5.ADMIN.API.Controllers [Route("GetNetAdSummaryReport")] [HttpGet] - public IHttpActionResult GetNetAdSummaryReport(string sFromDate, string sToDate, decimal iStartPrice, decimal iEndPrice, int iLicenseTypeId) + public IHttpActionResult GetNetAdSummaryReport(string sFromDate, string sToDate, decimal iStartPrice, decimal iEndPrice, int iLicenseTypeId, int pageNo, int pageLength) { try { - var lstNetAdSummaryReport = dbContext.GetNetAdSummaryReport(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId).ToList(); - return Ok(lstNetAdSummaryReport); + var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); + var lstNetAdSummaryReport = dbContext.GetNetAdSummaryReport(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId, pageNo, pageLength, spRecordCount).ToList(); + return Ok(new { NetAdSubscriptionList = lstNetAdSummaryReport, RecordCount = spRecordCount.Value }); } catch (Exception ex) { @@ -86,12 +87,13 @@ namespace AIAHTML5.ADMIN.API.Controllers [Route("GetSiteLicenseUsageReport")] [HttpGet] - public IHttpActionResult GetSiteLicenseUsageReport(string sFromDate, string sToDate, string sAccountNumber, int iEdition) + public IHttpActionResult GetSiteLicenseUsageReport(string sFromDate, string sToDate, string sAccountNumber, int iEdition, int pageNo, int pageLength) { try { - var lstSiteLicenseUsageReport = dbContext.GetSiteLicenseUsageReport(sFromDate, sToDate, sAccountNumber, (byte)iEdition).ToList(); - return Ok(lstSiteLicenseUsageReport); + var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); + var lstSiteLicenseUsageReport = dbContext.GetSiteLicenseUsageReport(sFromDate, sToDate, sAccountNumber, (byte)iEdition, pageNo, pageLength, spRecordCount).ToList(); + return Ok(new { SiteLicenseUsageList = lstSiteLicenseUsageReport, RecordCount = spRecordCount.Value }); } catch (Exception ex) { @@ -101,12 +103,13 @@ namespace AIAHTML5.ADMIN.API.Controllers [Route("GetDiscountReport")] [HttpGet] - public IHttpActionResult GetDiscountReport(string sFromDate, string sToDate, int iDiscountCode, string sAccountNumber) + public IHttpActionResult GetDiscountReport(string sFromDate, string sToDate, int iDiscountCode, string sAccountNumber, int pageNo, int pageLength) { try { - var lstDiscountReport = dbContext.GetDiscountReport(sFromDate, sToDate, iDiscountCode, sAccountNumber).ToList(); - return Ok(lstDiscountReport); + var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); + var lstDiscountReport = dbContext.GetDiscountReport(sFromDate, sToDate, iDiscountCode, sAccountNumber, pageNo, pageLength, spRecordCount).ToList(); + return Ok(new { DiscountReportList = lstDiscountReport, RecordCount = spRecordCount.Value }); } catch (Exception ex) { @@ -116,14 +119,14 @@ namespace AIAHTML5.ADMIN.API.Controllers [Route("GetImageExportReport")] [HttpGet] - public IHttpActionResult GetImageExportReport(string sFromDate, string sToDate, string sAccountNumber) + public IHttpActionResult GetImageExportReport(string sFromDate, string sToDate, string sAccountNumber, int pageNo, int pageLength) { try { - if (sAccountNumber == null) - sAccountNumber = string.Empty; - var lstImageExportReport = dbContext.GetExportedImageDetails(sFromDate, sToDate, sAccountNumber).ToList(); - return Ok(lstImageExportReport); + if (sAccountNumber == null) sAccountNumber = string.Empty; + var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); + var lstImageExportReport = dbContext.GetExportedImageDetails(sFromDate, sToDate, sAccountNumber, pageNo, pageLength, spRecordCount).ToList(); + return Ok(new { ImageExportList = lstImageExportReport, RecordCount = spRecordCount.Value }); } catch (Exception ex) { diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/SubscriptionPriceController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/SubscriptionPriceController.cs index 6ea30dc..52d0759 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/SubscriptionPriceController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/SubscriptionPriceController.cs @@ -109,14 +109,14 @@ namespace AIAHTML5.ADMIN.API.Controllers } } - [Route("DeleteSubscriptionPrices")] - [HttpPost] - public HttpResponseMessage DeleteSubscriptionPrices(List subscriptionPriceIds) + [Route("DeleteSubscriptionPrice")] + [HttpGet] + public HttpResponseMessage DeleteSubscriptionPrice(int subscriptionPriceId) { bool Status = false; try { - Status = SubscriptionPriceModel.DeleteSubscriptionPrices(dbContext, subscriptionPriceIds); + Status = SubscriptionPriceModel.DeleteSubscriptionPrice(dbContext, subscriptionPriceId); if (Status) { return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); @@ -133,6 +133,23 @@ namespace AIAHTML5.ADMIN.API.Controllers } } + [Route("CheckSubscriptionPlanForLicense")] + [HttpGet] + public HttpResponseMessage CheckSubscriptionPlanForLicense(int subscriptionPriceId) + { + bool Status = false; + try + { + Status = SubscriptionPriceModel.CheckSubscriptionPlanForLicense(dbContext, subscriptionPriceId); + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); + } + catch (Exception ex) + { + // Log exception code goes here + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } + protected HttpResponseMessage ToJson(dynamic obj) { var response = Request.CreateResponse(HttpStatusCode.OK); diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs index 32dba42..f125193 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs @@ -138,5 +138,22 @@ namespace AIAHTML5.ADMIN.API.Controllers return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } + + [Route("CheckDuplicateLicenseUserGroup")] + [HttpGet] + public HttpResponseMessage CheckDuplicateLicenseUserGroup(int LicenseId, string Title) + { + bool Status = false; + try + { + Status = UserGroupModel.CheckDuplicateLicenseUserGroup(dbContext, LicenseId, Title); + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); + } + catch (Exception ex) + { + // Log exception code goes here + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs index 107b46f..eb7ff36 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs @@ -1075,7 +1075,7 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetDiscountedPrice", inDiscountCodeParameter, outReturnCode, outDiscountPercentage, outDiscountCodeId); } - public virtual ObjectResult GetDiscountReport(string sStartDate, string sEndDate, Nullable intDiscountID, string sAccoutNumber) + public virtual ObjectResult GetDiscountReport(string sStartDate, string sEndDate, Nullable intDiscountID, string sAccoutNumber, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) { var sStartDateParameter = sStartDate != null ? new ObjectParameter("sStartDate", sStartDate) : @@ -1093,7 +1093,15 @@ namespace AIAHTML5.ADMIN.API.Entity new ObjectParameter("sAccoutNumber", sAccoutNumber) : new ObjectParameter("sAccoutNumber", typeof(string)); - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetDiscountReport", sStartDateParameter, sEndDateParameter, intDiscountIDParameter, sAccoutNumberParameter); + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetDiscountReport", sStartDateParameter, sEndDateParameter, intDiscountIDParameter, sAccoutNumberParameter, pageNoParameter, pageLengthParameter, recordCount); } public virtual ObjectResult getEditionData() @@ -1176,7 +1184,7 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetExpiringLicenses", sFromDateParameter, sToDateParameter, iStartPriceParameter, iEndPriceParameter, iLicenseTypeIdParameter, iAccountTypeIdParameter, sZipParameter, iStateIdParameter, iCountryIdParameter, pageNoParameter, pageLengthParameter, recordCount); } - public virtual ObjectResult GetExportedImageDetails(string sStartDate, string sEndDate, string sAccoutNumber) + public virtual ObjectResult GetExportedImageDetails(string sStartDate, string sEndDate, string sAccoutNumber, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) { var sStartDateParameter = sStartDate != null ? new ObjectParameter("sStartDate", sStartDate) : @@ -1190,7 +1198,15 @@ namespace AIAHTML5.ADMIN.API.Entity new ObjectParameter("sAccoutNumber", sAccoutNumber) : new ObjectParameter("sAccoutNumber", typeof(string)); - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetExportedImageDetails", sStartDateParameter, sEndDateParameter, sAccoutNumberParameter); + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetExportedImageDetails", sStartDateParameter, sEndDateParameter, sAccoutNumberParameter, pageNoParameter, pageLengthParameter, recordCount); } public virtual int GetImagePinData() @@ -1394,7 +1410,7 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetNetAdDetailReport", sFromDateParameter, sToDateParameter, sLicenseTypeParameter, sAccountTypeParameter, iStartPriceParameter, iEndPriceParameter); } - public virtual ObjectResult GetNetAdSummaryReport(string sFromDate, string sToDate, Nullable iStartPrice, Nullable iEndPrice, Nullable iLicenseTypeId) + public virtual ObjectResult GetNetAdSummaryReport(string sFromDate, string sToDate, Nullable iStartPrice, Nullable iEndPrice, Nullable iLicenseTypeId, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) { var sFromDateParameter = sFromDate != null ? new ObjectParameter("sFromDate", sFromDate) : @@ -1416,7 +1432,15 @@ namespace AIAHTML5.ADMIN.API.Entity new ObjectParameter("iLicenseTypeId", iLicenseTypeId) : new ObjectParameter("iLicenseTypeId", typeof(byte)); - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetNetAdSummaryReport", sFromDateParameter, sToDateParameter, iStartPriceParameter, iEndPriceParameter, iLicenseTypeIdParameter); + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetNetAdSummaryReport", sFromDateParameter, sToDateParameter, iStartPriceParameter, iEndPriceParameter, iLicenseTypeIdParameter, pageNoParameter, pageLengthParameter, recordCount); } public virtual ObjectResult GetProductFeatures(Nullable editionId) @@ -1551,7 +1575,7 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetSiteIpByAccountNumber", accountNumnerParameter); } - public virtual ObjectResult GetSiteLicenseUsageReport(string sFromDate, string sToDate, string sAccoutNumber, Nullable iEditionId) + public virtual ObjectResult GetSiteLicenseUsageReport(string sFromDate, string sToDate, string sAccoutNumber, Nullable iEditionId, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) { var sFromDateParameter = sFromDate != null ? new ObjectParameter("sFromDate", sFromDate) : @@ -1569,7 +1593,15 @@ namespace AIAHTML5.ADMIN.API.Entity new ObjectParameter("iEditionId", iEditionId) : new ObjectParameter("iEditionId", typeof(byte)); - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetSiteLicenseUsageReport", sFromDateParameter, sToDateParameter, sAccoutNumberParameter, iEditionIdParameter); + var pageNoParameter = pageNo.HasValue ? + new ObjectParameter("pageNo", pageNo) : + new ObjectParameter("pageNo", typeof(int)); + + var pageLengthParameter = pageLength.HasValue ? + new ObjectParameter("pageLength", pageLength) : + new ObjectParameter("pageLength", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetSiteLicenseUsageReport", sFromDateParameter, sToDateParameter, sAccoutNumberParameter, iEditionIdParameter, pageNoParameter, pageLengthParameter, recordCount); } public virtual ObjectResult GetSubscribedLicenses(string sFromDate, string sToDate, Nullable iStartPrice, Nullable iEndPrice, Nullable iLicenseTypeId, Nullable iAccountTypeId, string sZip, Nullable iStateId, Nullable iCountryId, Nullable pageNo, Nullable pageLength, ObjectParameter recordCount) @@ -3748,5 +3780,27 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertResellerLicenseAccount", sLicenseeFnameParameter, sLicenseeLnameParameter, iLicenseTypeIdParameter, iAccountTypeIdParameter, sInstitutionNameParameter, sAddress1Parameter, sAddress2Parameter, sCityParameter, sZipParameter, iStateIdParameter, iCountryIdParameter, sPhoneParameter, sEmailIdParameter, iTotalLoginsParameter, sStartDateParameter, sEndDateParameter, sEditionListParameter, iTotalPriceParameter, iCreatorIdParameter, sProductKeyParameter, iNoofImagesParameter); } + + public virtual int usp_CheckSubscriptionForLicense(Nullable id, ObjectParameter status) + { + var idParameter = id.HasValue ? + new ObjectParameter("Id", id) : + new ObjectParameter("Id", typeof(byte)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_CheckSubscriptionForLicense", idParameter, status); + } + + public virtual int usp_CheckDuplicateLicenseUserGroup(Nullable licenseId, string title, ObjectParameter status) + { + var licenseIdParameter = licenseId.HasValue ? + new ObjectParameter("LicenseId", licenseId) : + new ObjectParameter("LicenseId", typeof(int)); + + var titleParameter = title != null ? + new ObjectParameter("Title", title) : + new ObjectParameter("Title", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_CheckDuplicateLicenseUserGroup", licenseIdParameter, titleParameter, status); + } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx index 3e7523c..944cc33 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx @@ -377,6 +377,9 @@ + + + @@ -405,6 +408,9 @@ + + + @@ -474,6 +480,9 @@ + + + @@ -522,6 +531,9 @@ + + + @@ -910,6 +922,15 @@ + + + + + + + + + @@ -1489,6 +1510,9 @@ + + + @@ -1517,6 +1541,9 @@ + + + @@ -1586,6 +1613,9 @@ + + + @@ -1634,6 +1664,9 @@ + + + @@ -2095,7 +2128,7 @@ - + @@ -2272,6 +2305,15 @@ + + + + + + + + + @@ -2802,6 +2844,7 @@ + @@ -2865,6 +2908,7 @@ + @@ -4144,6 +4188,7 @@ + @@ -4237,6 +4282,7 @@ + @@ -4891,6 +4937,8 @@ + + diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetNetAdSummaryReport_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetNetAdSummaryReport_Result.cs index 518d435..90a9ba3 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetNetAdSummaryReport_Result.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetNetAdSummaryReport_Result.cs @@ -21,5 +21,6 @@ namespace AIAHTML5.ADMIN.API.Entity public Nullable RenewSubscription { get; set; } public Nullable InActiveSubscription { get; set; } public Nullable NetAdSubscription { get; set; } + public Nullable RowNum { get; set; } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetSiteLicenseUsageReport_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetSiteLicenseUsageReport_Result.cs index b0b1db3..beed0aa 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetSiteLicenseUsageReport_Result.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetSiteLicenseUsageReport_Result.cs @@ -20,5 +20,6 @@ namespace AIAHTML5.ADMIN.API.Entity public string LicenseCreationDate { get; set; } public Nullable TotalLogins { get; set; } public string LastLogin { get; set; } + public Nullable RowNum { get; set; } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs index 93418c6..d4f361d 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs @@ -113,15 +113,12 @@ namespace AIAHTML5.ADMIN.API.Models try { var result = dbContext.usp_GetAccountNumber(LicenseType).ToList(); - int i = 0; if (result.Count > 0) { foreach (var item in result) { LicenseAccountObj = new Tuple(item.Id, item.AccountNumber); LicenseAccountList.Add(LicenseAccountObj); - i++; - if (i > 100) break; } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SubscriptionPriceModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SubscriptionPriceModel.cs index 459589d..33d13be 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SubscriptionPriceModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SubscriptionPriceModel.cs @@ -78,16 +78,26 @@ namespace AIAHTML5.ADMIN.API.Models } } - public static bool DeleteSubscriptionPrices(AIADatabaseV5Entities dbContext, List 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