Commit 8d79375e8e344b8ef57c88edbe13d43afbf0af6c
1 parent
094ccf15
aia admin bug work
Showing
17 changed files
with
326 additions
and
25 deletions
400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj
@@ -156,6 +156,7 @@ | @@ -156,6 +156,7 @@ | ||
156 | <Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" /> | 156 | <Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" /> |
157 | <Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" /> | 157 | <Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" /> |
158 | <Compile Include="Constants\AdminConstant.cs" /> | 158 | <Compile Include="Constants\AdminConstant.cs" /> |
159 | + <Compile Include="Controllers\ReportController.cs" /> | ||
159 | <Compile Include="Controllers\UserGroupController.cs" /> | 160 | <Compile Include="Controllers\UserGroupController.cs" /> |
160 | <Compile Include="Controllers\SiteController.cs" /> | 161 | <Compile Include="Controllers\SiteController.cs" /> |
161 | <Compile Include="Controllers\EditionController.cs" /> | 162 | <Compile Include="Controllers\EditionController.cs" /> |
400-SOURCECODE/AIAHTML5.ADMIN.API/App_Start/WebApiConfig.cs
@@ -17,7 +17,8 @@ namespace AIAHTML5.ADMIN.API | @@ -17,7 +17,8 @@ namespace AIAHTML5.ADMIN.API | ||
17 | .Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter); | 17 | .Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter); |
18 | 18 | ||
19 | // Configure cross domain access | 19 | // Configure cross domain access |
20 | - config.EnableCors(); | 20 | + var cors = new EnableCorsAttribute("http://localhost:4200, http://localhost:91", "*", "*"); |
21 | + config.EnableCors(cors); | ||
21 | 22 | ||
22 | // Web API routes | 23 | // Web API routes |
23 | config.MapHttpAttributeRoutes(); | 24 | config.MapHttpAttributeRoutes(); |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/AccountController.cs
@@ -16,7 +16,6 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -16,7 +16,6 @@ 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: "*")] | ||
20 | [RoutePrefix("Account")] | 19 | [RoutePrefix("Account")] |
21 | public class AccountController : ApiController | 20 | public class AccountController : ApiController |
22 | { | 21 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/CommonController.cs
@@ -17,7 +17,6 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -17,7 +17,6 @@ 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: "*")] | ||
21 | [RoutePrefix("Common")] | 20 | [RoutePrefix("Common")] |
22 | public class CommonController : ApiController | 21 | public class CommonController : ApiController |
23 | { | 22 | { |
@@ -74,6 +73,46 @@ namespace AIAHTML5.ADMIN.API.Controllers | @@ -74,6 +73,46 @@ namespace AIAHTML5.ADMIN.API.Controllers | ||
74 | } | 73 | } |
75 | } | 74 | } |
76 | 75 | ||
76 | + [Route("GetEdition")] | ||
77 | + [HttpGet] | ||
78 | + public IHttpActionResult GetEdition() | ||
79 | + { | ||
80 | + dbContext.Configuration.ProxyCreationEnabled = false; | ||
81 | + List<Edition> lstEdition1 = new List<Edition>(); | ||
82 | + var lstEdition = dbContext.Editions.Where(e => e.IsActive == true).OrderBy(e => e.Priority).ToList(); | ||
83 | + lstEdition1 = lstEdition.Select(l => new Edition { Id = l.Id, Title = l.Title }).ToList(); | ||
84 | + //lstCountry1.Insert(0, new Country { Id = 0, CountryName = "All" }); | ||
85 | + return Ok(lstEdition1); | ||
86 | + } | ||
87 | + [Route("GetDiscountCode")] | ||
88 | + [HttpGet] | ||
89 | + public IHttpActionResult GetDiscountCode() | ||
90 | + { | ||
91 | + dbContext.Configuration.ProxyCreationEnabled = false; | ||
92 | + List<DiscountCodeModel> lstDiscountCode1 = new List<DiscountCodeModel>(); | ||
93 | + string sStartDate = DateTime.MinValue.ToShortDateString(); | ||
94 | + string sEndDate = DateTime.MaxValue.ToShortDateString(); | ||
95 | + var lstDiscountCode = dbContext.GetDiscountCodes("", "", "").ToList(); | ||
96 | + lstDiscountCode1 = lstDiscountCode.Select(l => new DiscountCodeModel { Id = l.Id, DiscountCode = l.DiscountCode }).ToList(); | ||
97 | + return Ok(lstDiscountCode1); | ||
98 | + } | ||
99 | + | ||
100 | + [Route("GetAccountType")] | ||
101 | + [HttpGet] | ||
102 | + public IHttpActionResult GetAccountType() | ||
103 | + { | ||
104 | + List<AccountTypeModel> AccountTypeList = new List<AccountTypeModel>(); | ||
105 | + //try | ||
106 | + //{ | ||
107 | + AccountTypeList = AccountTypeModel.GetAccountTypes(dbContext); | ||
108 | + return Ok(AccountTypeList); | ||
109 | + //} | ||
110 | + //catch (Exception ex) | ||
111 | + //{ | ||
112 | + // // Log exception code goes here | ||
113 | + // //return ex.Message; | ||
114 | + //} | ||
115 | + } | ||
77 | protected HttpResponseMessage ToJson(dynamic obj) | 116 | protected HttpResponseMessage ToJson(dynamic obj) |
78 | { | 117 | { |
79 | var response = Request.CreateResponse(HttpStatusCode.OK); | 118 | var response = Request.CreateResponse(HttpStatusCode.OK); |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/DiscountCodeController.cs
@@ -17,7 +17,6 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -17,7 +17,6 @@ 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: "*")] | ||
21 | [RoutePrefix("DiscountCode")] | 20 | [RoutePrefix("DiscountCode")] |
22 | public class DiscountCodeController : ApiController | 21 | public class DiscountCodeController : ApiController |
23 | { | 22 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/EditionController.cs
@@ -16,7 +16,6 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -16,7 +16,6 @@ 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: "*")] | ||
20 | [RoutePrefix("Edition")] | 19 | [RoutePrefix("Edition")] |
21 | public class EditionController : ApiController | 20 | public class EditionController : ApiController |
22 | { | 21 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs
@@ -16,7 +16,6 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -16,7 +16,6 @@ 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: "*")] | ||
20 | [RoutePrefix("License")] | 19 | [RoutePrefix("License")] |
21 | public class LicenseController : ApiController | 20 | public class LicenseController : ApiController |
22 | { | 21 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/ReportController.cs
0 โ 100644
1 | +๏ปฟusing System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Linq; | ||
4 | +using System.Net; | ||
5 | +using System.Net.Http; | ||
6 | +using System.Web.Http; | ||
7 | +using Newtonsoft.Json; | ||
8 | +using Newtonsoft.Json.Linq; | ||
9 | +using AIAHTML5.ADMIN.API.Models; | ||
10 | +using System.Web.Http.Cors; | ||
11 | +using System.Web.Cors; | ||
12 | +using AIAHTML5.Server.Constants; | ||
13 | +using log4net; | ||
14 | +using System.Text; | ||
15 | +using AIAHTML5.ADMIN.API.Entity; | ||
16 | +namespace AIAHTML5.ADMIN.API.Controllers | ||
17 | +{ | ||
18 | + [RoutePrefix("Report")] | ||
19 | + public class ReportController : ApiController | ||
20 | + { | ||
21 | + AIADatabaseV5Entities dbContext = new AIADatabaseV5Entities(); | ||
22 | + [Route("GetUsageReport")] | ||
23 | + [HttpGet] | ||
24 | + public IHttpActionResult GetUsageReport(string sFromDate, string sToDate, string sAccoutNumber, string sZip, int iState, int iCountry) | ||
25 | + { | ||
26 | + var lstUsageReport = dbContext.GetUsageReport(sFromDate, sToDate, sAccoutNumber, sZip, iState, iCountry).ToList(); | ||
27 | + return Ok(lstUsageReport); | ||
28 | + } | ||
29 | + | ||
30 | + [Route("GetCustomerSummeryReport")] | ||
31 | + [HttpGet] | ||
32 | + public IHttpActionResult GetCustomerSummeryReport(string sAccoutNumber, string sLicenseeFullName, Nullable<decimal> iStartPrice, Nullable<decimal> iEndPrice, int iLicenseType, int iAccountType, string sZip, int iState, int iCountry) | ||
33 | + { | ||
34 | + var lstCustomerSummeryReport = dbContext.GetCustomerSummary(sAccoutNumber, sLicenseeFullName, iStartPrice, iEndPrice, (byte)iLicenseType, (byte)iAccountType, sZip, iState, iCountry).ToList(); | ||
35 | + return Ok(lstCustomerSummeryReport); | ||
36 | + } | ||
37 | + | ||
38 | + | ||
39 | + [Route("GetExpiringSubscriptionReport")] | ||
40 | + [HttpGet] | ||
41 | + public IHttpActionResult GetExpiringSubscriptionReport(string sFromDate, string sToDate, decimal iStartPrice, decimal iEndPrice, int iLicenseTypeId, int iAccountTypeId, string sZip, int iStateId, int iCountryId) | ||
42 | + { | ||
43 | + var lstExpiringSubscriptionReport = dbContext.GetExpiringLicenses(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId).ToList(); | ||
44 | + return Ok(lstExpiringSubscriptionReport); | ||
45 | + } | ||
46 | + | ||
47 | + [Route("GetSubscriptionReport")] | ||
48 | + [HttpGet] | ||
49 | + public IHttpActionResult GetSubscriptionReport(string sFromDate, string sToDate, decimal icStartPrice, decimal icEndPrice, int iLicenseTypeId, int iAccountTypeId, string sZip, int iStateId, int iCountryId) | ||
50 | + { | ||
51 | + | ||
52 | + var lstExpiringSubscriptionReport = dbContext.GetSubscribedLicenses(sFromDate, sToDate, icStartPrice, icEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId).ToList(); | ||
53 | + return Ok(lstExpiringSubscriptionReport); | ||
54 | + } | ||
55 | + [Route("GetSubscriptionCancellationReport")] | ||
56 | + [HttpGet] | ||
57 | + public IHttpActionResult GetSubscriptionCancellationReport(string sFromDate, string sToDate, decimal icStartPrice, decimal icEndPrice, int iLicenseTypeId, int iAccountTypeId, string sZip, int iStateId, int iCountryId) | ||
58 | + { | ||
59 | + | ||
60 | + var lstExpiringSubscriptionReport = dbContext.GetCancelledLicenses(sFromDate, sToDate, icStartPrice, icEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId).ToList(); | ||
61 | + return Ok(lstExpiringSubscriptionReport); | ||
62 | + } | ||
63 | + | ||
64 | + [Route("GetNetAdSummaryReport")] | ||
65 | + [HttpGet] | ||
66 | + public IHttpActionResult GetNetAdSummaryReport(string sFromDate, string sToDate, decimal iStartPrice, decimal iEndPrice, int iLicenseTypeId) | ||
67 | + { | ||
68 | + try | ||
69 | + { | ||
70 | + var lstNetAdSummaryReport = dbContext.GetNetAdSummaryReport(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId).ToList(); | ||
71 | + return Ok(lstNetAdSummaryReport); | ||
72 | + } | ||
73 | + catch (Exception ex) | ||
74 | + { | ||
75 | + return Ok(ex.Message.ToString()); | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | + [Route("GetSiteLicenseUsageReport")] | ||
80 | + [HttpGet] | ||
81 | + public IHttpActionResult GetSiteLicenseUsageReport(string sFromDate, string sToDate, string sAccountNumber, int iEdition) | ||
82 | + { | ||
83 | + try | ||
84 | + { | ||
85 | + var lstSiteLicenseUsageReport = dbContext.GetSiteLicenseUsageReport(sFromDate, sToDate, sAccountNumber, (byte)iEdition).ToList(); | ||
86 | + return Ok(lstSiteLicenseUsageReport); | ||
87 | + } | ||
88 | + catch (Exception ex) | ||
89 | + { | ||
90 | + return Ok(ex.Message.ToString()); | ||
91 | + } | ||
92 | + } | ||
93 | + | ||
94 | + [Route("GetDiscountReport")] | ||
95 | + [HttpGet] | ||
96 | + public IHttpActionResult GetDiscountReport(string sFromDate, string sToDate, int iDiscountCode, string sAccountNumber) | ||
97 | + { | ||
98 | + try | ||
99 | + { | ||
100 | + var lstDiscountReport = dbContext.GetDiscountReport(sFromDate, sToDate, iDiscountCode, sAccountNumber).ToList(); | ||
101 | + return Ok(lstDiscountReport); | ||
102 | + } | ||
103 | + catch (Exception ex) | ||
104 | + { | ||
105 | + return Ok(ex.Message.ToString()); | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + [Route("GetImageExportReport")] | ||
110 | + [HttpGet] | ||
111 | + public IHttpActionResult GetImageExportReport(string sFromDate, string sToDate, string sAccountNumber) | ||
112 | + { | ||
113 | + try | ||
114 | + { | ||
115 | + if (sAccountNumber == null) | ||
116 | + sAccountNumber = string.Empty; | ||
117 | + var lstImageExportReport = dbContext.GetExportedImageDetails(sFromDate, sToDate, sAccountNumber).ToList(); | ||
118 | + return Ok(lstImageExportReport); | ||
119 | + } | ||
120 | + catch (Exception ex) | ||
121 | + { | ||
122 | + return Ok(ex.Message.ToString()); | ||
123 | + } | ||
124 | + } | ||
125 | + } | ||
126 | +} | ||
0 | \ No newline at end of file | 127 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/SiteController.cs
@@ -16,7 +16,6 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -16,7 +16,6 @@ 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: "*")] | ||
20 | [RoutePrefix("Site")] | 19 | [RoutePrefix("Site")] |
21 | public class SiteController : ApiController | 20 | public class SiteController : ApiController |
22 | { | 21 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/SubscriptionPriceController.cs
@@ -17,7 +17,6 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -17,7 +17,6 @@ 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: "*")] | ||
21 | [RoutePrefix("SubscriptionPrice")] | 20 | [RoutePrefix("SubscriptionPrice")] |
22 | public class SubscriptionPriceController : ApiController | 21 | public class SubscriptionPriceController : ApiController |
23 | { | 22 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
@@ -16,7 +16,6 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -16,7 +16,6 @@ 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: "*")] | ||
20 | [RoutePrefix("User")] | 19 | [RoutePrefix("User")] |
21 | public class UserController : ApiController | 20 | public class UserController : ApiController |
22 | { | 21 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs
@@ -16,7 +16,6 @@ using AIAHTML5.ADMIN.API.Entity; | @@ -16,7 +16,6 @@ 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: "*")] | ||
20 | [RoutePrefix("UserGroup")] | 19 | [RoutePrefix("UserGroup")] |
21 | public class UserGroupController : ApiController | 20 | public class UserGroupController : ApiController |
22 | { | 21 | { |
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/DiscountCodeModel.cs
@@ -21,7 +21,7 @@ namespace AIAHTML5.ADMIN.API.Models | @@ -21,7 +21,7 @@ namespace AIAHTML5.ADMIN.API.Models | ||
21 | DiscountCodeModel DiscountCodeObj = new DiscountCodeModel(); | 21 | DiscountCodeModel DiscountCodeObj = new DiscountCodeModel(); |
22 | try | 22 | try |
23 | { | 23 | { |
24 | - var result = dbContext.GetDiscountCodes(discountCode, startDate.ToString(), endDate.ToString()).ToList(); | 24 | + var result = dbContext.GetDiscountCodes(discountCode, startDate.ToString("MM/dd/yyyy"), endDate.ToString("MM/dd/yyyy")).ToList(); |
25 | if (result.Count > 0) | 25 | if (result.Count > 0) |
26 | { | 26 | { |
27 | foreach (var item in result) | 27 | foreach (var item in result) |
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SharedModel.cs
@@ -7,6 +7,10 @@ namespace AIAHTML5.ADMIN.API.Models | @@ -7,6 +7,10 @@ namespace AIAHTML5.ADMIN.API.Models | ||
7 | { | 7 | { |
8 | public class AccountTypeModel | 8 | public class AccountTypeModel |
9 | { | 9 | { |
10 | + public int Id { get; set; } | ||
11 | + public string Title { get; set; } | ||
12 | + public bool isActive { get; set; } | ||
13 | + | ||
10 | public static List<AccountType> GetAccountTypeList(AIADatabaseV5Entities dbContext, int Id) | 14 | public static List<AccountType> GetAccountTypeList(AIADatabaseV5Entities dbContext, int Id) |
11 | { | 15 | { |
12 | var accountTypeEntity = dbContext.usp_GetAccountTypeList(Id).ToList(); | 16 | var accountTypeEntity = dbContext.usp_GetAccountTypeList(Id).ToList(); |
@@ -14,5 +18,27 @@ namespace AIAHTML5.ADMIN.API.Models | @@ -14,5 +18,27 @@ namespace AIAHTML5.ADMIN.API.Models | ||
14 | //AccountTypelist.Insert(0, new AccountType { Id = 0, Title = "All" }); | 18 | //AccountTypelist.Insert(0, new AccountType { Id = 0, Title = "All" }); |
15 | return AccountTypelist; | 19 | return AccountTypelist; |
16 | } | 20 | } |
21 | + | ||
22 | + public static List<AccountTypeModel> GetAccountTypes(AIADatabaseV5Entities dbContext) | ||
23 | + { | ||
24 | + List<AccountTypeModel> AccountTypeList = new List<AccountTypeModel>(); | ||
25 | + AccountTypeModel AccountTypeModelObj = new AccountTypeModel(); | ||
26 | + try | ||
27 | + { | ||
28 | + var result = dbContext.EC_GetAccountTypeList().ToList(); | ||
29 | + if (result.Count > 0) | ||
30 | + { | ||
31 | + foreach (var item in result) | ||
32 | + { | ||
33 | + AccountTypeModelObj = new AccountTypeModel(); | ||
34 | + AccountTypeModelObj.Id = item.Id; | ||
35 | + AccountTypeModelObj.Title = item.Title; | ||
36 | + AccountTypeList.Add(AccountTypeModelObj); | ||
37 | + } | ||
38 | + } | ||
39 | + } | ||
40 | + catch (Exception ex) { } | ||
41 | + return AccountTypeList; | ||
42 | + } | ||
17 | } | 43 | } |
18 | } | 44 | } |
19 | \ No newline at end of file | 45 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/ManageDiscountCode/managediscountcode.component.ts
1 | -import { Component, OnInit, AfterViewInit, Input, Output, EventEmitter, Pipe, PipeTransform, TemplateRef } from '@angular/core'; | 1 | +import { Component, OnInit, AfterViewInit, AfterViewChecked, Input, Output, EventEmitter, Pipe, PipeTransform, TemplateRef } from '@angular/core'; |
2 | import { ManageDiscountCodeService } from './managediscountcode.service'; | 2 | import { ManageDiscountCodeService } from './managediscountcode.service'; |
3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
4 | import { FormControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; | 4 | import { FormControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; |
5 | import { DiscountCode } from '../UserEntity/datamodel'; | 5 | import { DiscountCode } from '../UserEntity/datamodel'; |
6 | -import { BsDatepickerModule } from 'ngx-bootstrap'; | 6 | +import { BsDatepickerModule, BsDatepickerConfig } from 'ngx-bootstrap'; |
7 | import { Http, Response } from '@angular/http'; | 7 | import { Http, Response } from '@angular/http'; |
8 | import { DatePipe } from '@angular/common'; | 8 | import { DatePipe } from '@angular/common'; |
9 | import { BsModalService } from 'ngx-bootstrap/modal'; | 9 | import { BsModalService } from 'ngx-bootstrap/modal'; |
10 | import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service'; | 10 | import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service'; |
11 | import { ConfirmService } from '../../Shared/Confirm/confirm.service'; | 11 | import { ConfirmService } from '../../Shared/Confirm/confirm.service'; |
12 | +import { GlobalService } from '../../Shared/global'; | ||
13 | + | ||
14 | +declare var $:any; | ||
12 | 15 | ||
13 | @Component({ | 16 | @Component({ |
14 | templateUrl: './managediscountcode.component.html' | 17 | templateUrl: './managediscountcode.component.html' |
15 | }) | 18 | }) |
16 | 19 | ||
17 | -export class ManageDiscountCode implements OnInit { | 20 | +export class ManageDiscountCode implements OnInit, AfterViewChecked { |
18 | 21 | ||
19 | Mode: string = 'Manage'; | 22 | Mode: string = 'Manage'; |
20 | discountCode: DiscountCode; | 23 | discountCode: DiscountCode; |
@@ -23,10 +26,11 @@ manageDiscountCodeFrm: FormGroup; | @@ -23,10 +26,11 @@ manageDiscountCodeFrm: FormGroup; | ||
23 | insertUpdateDiscountCodeFrm: FormGroup; | 26 | insertUpdateDiscountCodeFrm: FormGroup; |
24 | error: any; | 27 | error: any; |
25 | alerts: string; | 28 | alerts: string; |
29 | +alertmsg: string; | ||
26 | modalAlerts: string; | 30 | modalAlerts: string; |
27 | divClass: string = ''; | 31 | divClass: string = ''; |
28 | topPos: string = '2000px'; | 32 | topPos: string = '2000px'; |
29 | -selectedRow: number = 0; | 33 | +selectedRow: number = -1; |
30 | datePipe: DatePipe = new DatePipe('en-US'); | 34 | datePipe: DatePipe = new DatePipe('en-US'); |
31 | bsValue1: Date = new Date(); | 35 | bsValue1: Date = new Date(); |
32 | bsValue2: Date = new Date(); | 36 | bsValue2: Date = new Date(); |
@@ -34,13 +38,25 @@ bsValue3: Date = new Date(); | @@ -34,13 +38,25 @@ bsValue3: Date = new Date(); | ||
34 | bsValue4: Date = new Date(); | 38 | bsValue4: Date = new Date(); |
35 | selectedId: number = 0; | 39 | selectedId: number = 0; |
36 | modalRef: BsModalRef; | 40 | modalRef: BsModalRef; |
41 | +minDate = new Date(1110, 11, 1); | ||
42 | +maxDate = new Date(9999, 11, 31); | ||
43 | +bsConfig: Partial<BsDatepickerConfig>; | ||
44 | +NoRecord: string; | ||
45 | +dateStartInvalid: boolean = false; | ||
46 | +dateEndInvalid: boolean = false; | ||
47 | +dateStartInvalid1: boolean = false; | ||
48 | +dateEndInvalid1: boolean = false; | ||
37 | 49 | ||
38 | -constructor(private manageDiscountCodeService: ManageDiscountCodeService, private router: Router, private _confirmService: ConfirmService, private fb: FormBuilder, private modalService: BsModalService) { } | 50 | +constructor(private manageDiscountCodeService: ManageDiscountCodeService, private router: Router, |
51 | + private _confirmService: ConfirmService, private fb: FormBuilder, private global: GlobalService, | ||
52 | + private modalService: BsModalService) { } | ||
39 | 53 | ||
40 | ngOnInit(): void { | 54 | ngOnInit(): void { |
55 | + this.bsConfig = Object.assign({}, { containerClass: 'theme-dark-blue' }); | ||
41 | this.divClass = 'col-sm-12'; | 56 | this.divClass = 'col-sm-12'; |
42 | this.discountCode = new DiscountCode(); | 57 | this.discountCode = new DiscountCode(); |
43 | this.alerts = ''; | 58 | this.alerts = ''; |
59 | + this.alertmsg = ''; | ||
44 | this.manageDiscountCodeFrm = this.fb.group({ | 60 | this.manageDiscountCodeFrm = this.fb.group({ |
45 | searchDiscountCode: [''], | 61 | searchDiscountCode: [''], |
46 | searchStartDate: [''], | 62 | searchStartDate: [''], |
@@ -64,12 +80,98 @@ constructor(private manageDiscountCodeService: ManageDiscountCodeService, privat | @@ -64,12 +80,98 @@ constructor(private manageDiscountCodeService: ManageDiscountCodeService, privat | ||
64 | this.discountCode = item; | 80 | this.discountCode = item; |
65 | } | 81 | } |
66 | 82 | ||
83 | + DateChange(dateValue: any){ | ||
84 | + this.alerts = ''; | ||
85 | + this.alertmsg = ''; | ||
86 | + | ||
87 | + if(this.manageDiscountCodeFrm.dirty) { | ||
88 | + if(dateValue._datepicker._elementRef.nativeElement.id == 'searchStartDate'){ | ||
89 | + if(dateValue._bsValue == null) { | ||
90 | + if(dateValue._datepicker._elementRef.nativeElement.value != ''){ | ||
91 | + this.dateStartInvalid = true; | ||
92 | + } | ||
93 | + else{ | ||
94 | + this.dateStartInvalid = false; | ||
95 | + } | ||
96 | + } | ||
97 | + else{ | ||
98 | + this.dateStartInvalid = false; | ||
99 | + this.manageDiscountCodeFrm.controls['searchStartDate'].setValue(dateValue._bsValue); | ||
100 | + } | ||
101 | + } | ||
102 | + | ||
103 | + if(dateValue._datepicker._elementRef.nativeElement.id == 'searchEndDate'){ | ||
104 | + if(dateValue._bsValue == null) { | ||
105 | + if(dateValue._datepicker._elementRef.nativeElement.value != ''){ | ||
106 | + this.dateEndInvalid = true; | ||
107 | + } | ||
108 | + else{ | ||
109 | + this.dateEndInvalid = false; | ||
110 | + } | ||
111 | + } | ||
112 | + else{ | ||
113 | + this.dateEndInvalid = false; | ||
114 | + this.manageDiscountCodeFrm.controls['searchEndDate'].setValue(dateValue._bsValue); | ||
115 | + } | ||
116 | + } | ||
117 | + | ||
118 | + if(!this.dateStartInvalid && !this.dateEndInvalid){ | ||
119 | + if(Date.parse(this.manageDiscountCodeFrm.controls['searchStartDate'].value) > | ||
120 | + Date.parse(this.manageDiscountCodeFrm.controls['searchEndDate'].value)){ | ||
121 | + this.alertmsg = '<span>Search start date must be less than the search end date</span><br/>'; | ||
122 | + } | ||
123 | + } | ||
124 | + } | ||
125 | + | ||
126 | + if(this.insertUpdateDiscountCodeFrm.dirty) { | ||
127 | + if(dateValue._datepicker._elementRef.nativeElement.id == 'startDate'){ | ||
128 | + if(dateValue._bsValue == null) { | ||
129 | + if(dateValue._datepicker._elementRef.nativeElement.value != ''){ | ||
130 | + this.insertUpdateDiscountCodeFrm.controls['startDate'].setValue(dateValue._datepicker._elementRef.nativeElement.value); | ||
131 | + this.dateStartInvalid1 = true; | ||
132 | + } | ||
133 | + else{ | ||
134 | + this.dateStartInvalid1 = false; | ||
135 | + } | ||
136 | + } | ||
137 | + else{ | ||
138 | + this.dateStartInvalid1 = false; | ||
139 | + this.insertUpdateDiscountCodeFrm.controls['startDate'].setValue(dateValue._bsValue); | ||
140 | + } | ||
141 | + } | ||
142 | + | ||
143 | + if(dateValue._datepicker._elementRef.nativeElement.id == 'endDate'){ | ||
144 | + if(dateValue._bsValue == null) { | ||
145 | + if(dateValue._datepicker._elementRef.nativeElement.value != ''){ | ||
146 | + this.insertUpdateDiscountCodeFrm.controls['endDate'].setValue(dateValue._datepicker._elementRef.nativeElement.value); | ||
147 | + this.dateEndInvalid1 = true; | ||
148 | + } | ||
149 | + else{ | ||
150 | + this.dateEndInvalid1 = false; | ||
151 | + } | ||
152 | + } | ||
153 | + else{ | ||
154 | + this.dateEndInvalid1 = false; | ||
155 | + this.insertUpdateDiscountCodeFrm.controls['endDate'].setValue(dateValue._bsValue); | ||
156 | + } | ||
157 | + } | ||
158 | + | ||
159 | + if(!this.dateStartInvalid1 && !this.dateEndInvalid1){ | ||
160 | + if(Date.parse(this.insertUpdateDiscountCodeFrm.controls['startDate'].value) > | ||
161 | + Date.parse(this.insertUpdateDiscountCodeFrm.controls['endDate'].value)){ | ||
162 | + this.alerts = '<span>Discount start date must be less than the discount end date</span><br/>'; | ||
163 | + } | ||
164 | + } | ||
165 | + } | ||
166 | + | ||
167 | + } | ||
168 | + | ||
67 | public SearchDiscountCodes() { | 169 | public SearchDiscountCodes() { |
68 | this.manageDiscountCodeService.GetDiscountCodes( | 170 | this.manageDiscountCodeService.GetDiscountCodes( |
69 | { | 171 | { |
70 | discountCode: this.manageDiscountCodeFrm.controls['searchDiscountCode'].value, | 172 | discountCode: this.manageDiscountCodeFrm.controls['searchDiscountCode'].value, |
71 | - startDate: this.manageDiscountCodeFrm.controls['searchStartDate'].value, | ||
72 | - endDate: this.manageDiscountCodeFrm.controls['searchEndDate'].value | 173 | + startDate: this.datePipe.transform(this.manageDiscountCodeFrm.controls['searchStartDate'].value, 'MM/dd/yyyy'), |
174 | + endDate: this.datePipe.transform(this.manageDiscountCodeFrm.controls['searchEndDate'].value, 'MM/dd/yyyy'), | ||
73 | }) | 175 | }) |
74 | .subscribe(x => { this.BindFormFields(x) }, error => this.error = error); | 176 | .subscribe(x => { this.BindFormFields(x) }, error => this.error = error); |
75 | } | 177 | } |
@@ -125,10 +227,16 @@ constructor(private manageDiscountCodeService: ManageDiscountCodeService, privat | @@ -125,10 +227,16 @@ constructor(private manageDiscountCodeService: ManageDiscountCodeService, privat | ||
125 | } | 227 | } |
126 | 228 | ||
127 | BindFormFields(data){ | 229 | BindFormFields(data){ |
128 | - this.selectedRow = 0; | ||
129 | this.discountCodes = data; | 230 | this.discountCodes = data; |
231 | + if(this.discountCodes.length == 0){ | ||
232 | + this.NoRecord = this.global.NoRecords; | ||
233 | + } | ||
130 | this.discountCode = this.discountCodes[0]; | 234 | this.discountCode = this.discountCodes[0]; |
131 | this.manageDiscountCodeFrm.setControl('discountCodes', this.fb.array(this.discountCodes)); | 235 | this.manageDiscountCodeFrm.setControl('discountCodes', this.fb.array(this.discountCodes)); |
236 | + if(this.selectedRow > -1){ | ||
237 | + this.selectedRow = this.discountCodes.findIndex(C => C.Id == this.selectedId); | ||
238 | + this.SetClickedRow(this.selectedRow, this.discountCodes[this.selectedRow]); | ||
239 | + } | ||
132 | } | 240 | } |
133 | 241 | ||
134 | AddDiscountCode(){ | 242 | AddDiscountCode(){ |
@@ -168,7 +276,14 @@ constructor(private manageDiscountCodeService: ManageDiscountCodeService, privat | @@ -168,7 +276,14 @@ constructor(private manageDiscountCodeService: ManageDiscountCodeService, privat | ||
168 | this.topPos = '2000px'; | 276 | this.topPos = '2000px'; |
169 | this.divClass = 'col-sm-12'; | 277 | this.divClass = 'col-sm-12'; |
170 | this.SearchDiscountCodes(); | 278 | this.SearchDiscountCodes(); |
171 | - this.selectedRow = this.discountCodes.findIndex(C => C.Id == this.selectedId); | ||
172 | - this.SetClickedRow(this.selectedRow, this.manageDiscountCodeFrm.controls['discountCodes'].value.find(C => C.Id == this.selectedId)); | 279 | + } |
280 | + | ||
281 | + SearchRecords(){ | ||
282 | + this.selectedRow = -1; | ||
283 | + this.SearchDiscountCodes(); | ||
284 | + } | ||
285 | + | ||
286 | + ngAfterViewChecked(){ | ||
287 | + $('#tblDiscountCodes thead').css('width', $('#tblDiscountCodes tbody tr:eq(0)').width()); | ||
173 | } | 288 | } |
174 | } | 289 | } |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.component.html
1 | <div class="row"> | 1 | <div class="row"> |
2 | <!-- main-heading --> | 2 | <!-- main-heading --> |
3 | - <div class="col-sm-12 pageHeading"> | ||
4 | - <h4>Subscription Price</h4> | 3 | + <div class="col-sm-12 pageHeading" style="margin-left: 15px;"> |
4 | + <h4>{{Mode}} Subscription Price</h4> | ||
5 | </div> | 5 | </div> |
6 | <!-- main-heading --> | 6 | <!-- main-heading --> |
7 | 7 | ||
@@ -99,9 +99,9 @@ | @@ -99,9 +99,9 @@ | ||
99 | 99 | ||
100 | <div class="row"> | 100 | <div class="row"> |
101 | <div class="col-sm-12 marginTop20 text-center"> | 101 | <div class="col-sm-12 marginTop20 text-center"> |
102 | - <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)="AddSubscriptionPrice()"><i class="fa fa-plus-circle"></i> Add</button> |
103 | <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="button" (click)="openModal(template)"><i class="fa fa-trash"></i> Delete</button> |
104 | - <button class="btn btn-primary btn-sm" type="submit"><i class="fa fa-check"></i> Apply</button> | 104 | + <button class="btn btn-primary btn-sm" type="submit" [disabled]="this.subscriptionPriceFrm.controls['subscriptionPrices'].value.length == 0"><i class="fa fa-check"></i> Apply</button> |
105 | </div> | 105 | </div> |
106 | </div> | 106 | </div> |
107 | 107 |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.component.ts
@@ -96,6 +96,7 @@ constructor(private subscriptionPriceService: SubscriptionPriceService, private | @@ -96,6 +96,7 @@ constructor(private subscriptionPriceService: SubscriptionPriceService, private | ||
96 | this._confirmService.activate("Subscription prices insert unsuccessfull", "alertMsg"); | 96 | this._confirmService.activate("Subscription prices insert unsuccessfull", "alertMsg"); |
97 | } else { | 97 | } else { |
98 | this.modalAlerts = "<p>Subscription price saved successfully</p>"; | 98 | this.modalAlerts = "<p>Subscription price saved successfully</p>"; |
99 | + this.CancelAdd(); | ||
99 | this.modalRef = this.modalService.show(template); | 100 | this.modalRef = this.modalService.show(template); |
100 | } | 101 | } |
101 | } | 102 | } |