Commit fd98512bd97ca2431fca48cbbdfd3caacae97d84
1 parent
41ae1eb1
Discount Code work Completed.
Showing
24 changed files
with
1578 additions
and
84 deletions
400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj
... | ... | @@ -159,6 +159,7 @@ |
159 | 159 | <Compile Include="Controllers\AccountTypeController.cs" /> |
160 | 160 | <Compile Include="Controllers\AddLicenseController.cs" /> |
161 | 161 | <Compile Include="Controllers\CountryController.cs" /> |
162 | + <Compile Include="Controllers\SubscriptionPriceController.cs" /> | |
162 | 163 | <Compile Include="Controllers\EditionTypeController.cs" /> |
163 | 164 | <Compile Include="Controllers\HomeController.cs" /> |
164 | 165 | <Compile Include="Controllers\LicenseTypeController.cs" /> |
... | ... | @@ -709,6 +710,15 @@ |
709 | 710 | <Compile Include="Entity\usp_DB_TblRowCOUNT_Result.cs"> |
710 | 711 | <DependentUpon>AIADBEntity.tt</DependentUpon> |
711 | 712 | </Compile> |
713 | + <Compile Include="Entity\usp_GetAccountTypeList_Result.cs"> | |
714 | + <DependentUpon>AIADBEntity.tt</DependentUpon> | |
715 | + </Compile> | |
716 | + <Compile Include="Entity\Usp_GetSubscriptionPlans_Result.cs"> | |
717 | + <DependentUpon>AIADBEntity.tt</DependentUpon> | |
718 | + </Compile> | |
719 | + <Compile Include="Entity\usp_GetUserType_Result.cs"> | |
720 | + <DependentUpon>AIADBEntity.tt</DependentUpon> | |
721 | + </Compile> | |
712 | 722 | <Compile Include="Entity\VocabLexicon.cs"> |
713 | 723 | <DependentUpon>AIADBEntity.tt</DependentUpon> |
714 | 724 | </Compile> |
... | ... | @@ -738,6 +748,7 @@ |
738 | 748 | </Compile> |
739 | 749 | <Compile Include="Models\AppReponse.cs" /> |
740 | 750 | <Compile Include="Models\DbModel.cs" /> |
751 | + <Compile Include="Models\SubscriptionPriceModel.cs" /> | |
741 | 752 | <Compile Include="Models\StringExtensions.cs" /> |
742 | 753 | <Compile Include="Models\User.cs" /> |
743 | 754 | <Compile Include="Models\DiscountCodeModel.cs" /> | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/SubscriptionPriceController.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 | + | |
17 | +namespace AIAHTML5.ADMIN.API.Controllers | |
18 | +{ | |
19 | + | |
20 | + [EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")] | |
21 | + [RoutePrefix("SubscriptionPrice")] | |
22 | + public class SubscriptionPriceController : ApiController | |
23 | + { | |
24 | + AIADatabaseV5Entities dbContext = new AIADatabaseV5Entities(); | |
25 | + | |
26 | + [Route("Api/GetSubscriptionPrices")] | |
27 | + [HttpGet] | |
28 | + public HttpResponseMessage GetSubscriptionPrices(int editionId, int duration) | |
29 | + { | |
30 | + List<SubscriptionPriceModel> SubscriptionPriceList = new List<SubscriptionPriceModel>(); | |
31 | + try | |
32 | + { | |
33 | + SubscriptionPriceList = SubscriptionPriceModel.GetSubscriptionPrices(dbContext, editionId, duration); | |
34 | + return Request.CreateResponse(HttpStatusCode.OK, SubscriptionPriceList); | |
35 | + } | |
36 | + catch (Exception ex) | |
37 | + { | |
38 | + // Log exception code goes here | |
39 | + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); | |
40 | + } | |
41 | + } | |
42 | + | |
43 | + [Route("Api/InsertSubscriptionPrice")] | |
44 | + [HttpPost] | |
45 | + public HttpResponseMessage InsertSubscriptionPrice(JObject jsonData) | |
46 | + { | |
47 | + bool Status = false; | |
48 | + SubscriptionPriceModel subscriptionPriceModel = new SubscriptionPriceModel(); | |
49 | + subscriptionPriceModel.Id = jsonData["id"].Value<int>(); | |
50 | + subscriptionPriceModel.Title = jsonData["title"].Value<string>(); | |
51 | + subscriptionPriceModel.Price = jsonData["price"].Value<decimal>(); | |
52 | + subscriptionPriceModel.Duration = jsonData["duration"].Value<int>(); | |
53 | + subscriptionPriceModel.EditionId = jsonData["editionId"].Value<int>(); | |
54 | + subscriptionPriceModel.IsActive = jsonData["isActive"].Value<bool>(); | |
55 | + try | |
56 | + { | |
57 | + Status = SubscriptionPriceModel.InsertSubscriptionPrice(dbContext, subscriptionPriceModel); | |
58 | + if (Status) | |
59 | + { | |
60 | + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); | |
61 | + } | |
62 | + else | |
63 | + { | |
64 | + return Request.CreateErrorResponse(HttpStatusCode.BadRequest, Status.ToString()); | |
65 | + } | |
66 | + } | |
67 | + catch (Exception ex) | |
68 | + { | |
69 | + // Log exception code goes here | |
70 | + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); | |
71 | + } | |
72 | + } | |
73 | + | |
74 | + [Route("Api/UpdateSubscriptionPrice")] | |
75 | + [HttpPost] | |
76 | + public HttpResponseMessage UpdateSubscriptionPrice(JObject jsonData) | |
77 | + { | |
78 | + bool Status = false; | |
79 | + SubscriptionPriceModel subscriptionPriceModel = new SubscriptionPriceModel(); | |
80 | + subscriptionPriceModel.Id = jsonData["id"].Value<int>(); | |
81 | + subscriptionPriceModel.Title = jsonData["title"].Value<string>(); | |
82 | + subscriptionPriceModel.Price = jsonData["price"].Value<decimal>(); | |
83 | + subscriptionPriceModel.Duration = jsonData["duration"].Value<int>(); | |
84 | + subscriptionPriceModel.EditionId = jsonData["editionId"].Value<int>(); | |
85 | + subscriptionPriceModel.IsActive = jsonData["isActive"].Value<bool>(); | |
86 | + try | |
87 | + { | |
88 | + Status = SubscriptionPriceModel.UpdateSubscriptionPrice(dbContext, subscriptionPriceModel); | |
89 | + if (Status) | |
90 | + { | |
91 | + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); | |
92 | + } | |
93 | + else | |
94 | + { | |
95 | + return Request.CreateErrorResponse(HttpStatusCode.BadRequest, Status.ToString()); | |
96 | + } | |
97 | + } | |
98 | + catch (Exception ex) | |
99 | + { | |
100 | + // Log exception code goes here | |
101 | + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); | |
102 | + } | |
103 | + } | |
104 | + | |
105 | + [Route("Api/DeleteSubscriptionPrice")] | |
106 | + [HttpPost] | |
107 | + public HttpResponseMessage DeleteSubscriptionPrice(int subscriptionPriceId) | |
108 | + { | |
109 | + bool Status = false; | |
110 | + try | |
111 | + { | |
112 | + Status = SubscriptionPriceModel.DeleteSubscriptionPrice(dbContext, subscriptionPriceId); | |
113 | + if (Status) | |
114 | + { | |
115 | + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); | |
116 | + } | |
117 | + else | |
118 | + { | |
119 | + return Request.CreateErrorResponse(HttpStatusCode.BadRequest, Status.ToString()); | |
120 | + } | |
121 | + } | |
122 | + catch (Exception ex) | |
123 | + { | |
124 | + // Log exception code goes here | |
125 | + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); | |
126 | + } | |
127 | + } | |
128 | + | |
129 | + protected HttpResponseMessage ToJson(dynamic obj) | |
130 | + { | |
131 | + var response = Request.CreateResponse(HttpStatusCode.OK); | |
132 | + response.Content = new StringContent(JsonConvert.SerializeObject(obj), Encoding.UTF8, "application/jsonP"); | |
133 | + return response; | |
134 | + } | |
135 | + | |
136 | + } | |
137 | +} | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs
... | ... | @@ -2887,5 +2887,120 @@ namespace AIAHTML5.ADMIN.API.Entity |
2887 | 2887 | |
2888 | 2888 | return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetDiscountCodes_Result>("GetDiscountCodes", sDiscountCodeParameter, sStartDateParameter, sEndDateParameter); |
2889 | 2889 | } |
2890 | + | |
2891 | + public virtual int Usp_DeleteSubscriptionPlan(Nullable<byte> id, ObjectParameter status) | |
2892 | + { | |
2893 | + var idParameter = id.HasValue ? | |
2894 | + new ObjectParameter("Id", id) : | |
2895 | + new ObjectParameter("Id", typeof(byte)); | |
2896 | + | |
2897 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("Usp_DeleteSubscriptionPlan", idParameter, status); | |
2898 | + } | |
2899 | + | |
2900 | + public virtual ObjectResult<Usp_GetSubscriptionPlans_Result> Usp_GetSubscriptionPlans(Nullable<byte> iEditionId, Nullable<byte> iDuration) | |
2901 | + { | |
2902 | + var iEditionIdParameter = iEditionId.HasValue ? | |
2903 | + new ObjectParameter("iEditionId", iEditionId) : | |
2904 | + new ObjectParameter("iEditionId", typeof(byte)); | |
2905 | + | |
2906 | + var iDurationParameter = iDuration.HasValue ? | |
2907 | + new ObjectParameter("iDuration", iDuration) : | |
2908 | + new ObjectParameter("iDuration", typeof(byte)); | |
2909 | + | |
2910 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Usp_GetSubscriptionPlans_Result>("Usp_GetSubscriptionPlans", iEditionIdParameter, iDurationParameter); | |
2911 | + } | |
2912 | + | |
2913 | + public virtual int Usp_InsertSubscriptionPlan(Nullable<byte> id, string title, Nullable<decimal> price, Nullable<byte> duration, Nullable<byte> editionId, Nullable<bool> isActive, ObjectParameter status) | |
2914 | + { | |
2915 | + var idParameter = id.HasValue ? | |
2916 | + new ObjectParameter("Id", id) : | |
2917 | + new ObjectParameter("Id", typeof(byte)); | |
2918 | + | |
2919 | + var titleParameter = title != null ? | |
2920 | + new ObjectParameter("Title", title) : | |
2921 | + new ObjectParameter("Title", typeof(string)); | |
2922 | + | |
2923 | + var priceParameter = price.HasValue ? | |
2924 | + new ObjectParameter("Price", price) : | |
2925 | + new ObjectParameter("Price", typeof(decimal)); | |
2926 | + | |
2927 | + var durationParameter = duration.HasValue ? | |
2928 | + new ObjectParameter("Duration", duration) : | |
2929 | + new ObjectParameter("Duration", typeof(byte)); | |
2930 | + | |
2931 | + var editionIdParameter = editionId.HasValue ? | |
2932 | + new ObjectParameter("EditionId", editionId) : | |
2933 | + new ObjectParameter("EditionId", typeof(byte)); | |
2934 | + | |
2935 | + var isActiveParameter = isActive.HasValue ? | |
2936 | + new ObjectParameter("IsActive", isActive) : | |
2937 | + new ObjectParameter("IsActive", typeof(bool)); | |
2938 | + | |
2939 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("Usp_InsertSubscriptionPlan", idParameter, titleParameter, priceParameter, durationParameter, editionIdParameter, isActiveParameter, status); | |
2940 | + } | |
2941 | + | |
2942 | + public virtual int Usp_UpdateSubscriptionPlan(Nullable<byte> id, string title, Nullable<decimal> price, Nullable<byte> duration, Nullable<byte> editionId, Nullable<bool> isActive, ObjectParameter status) | |
2943 | + { | |
2944 | + var idParameter = id.HasValue ? | |
2945 | + new ObjectParameter("Id", id) : | |
2946 | + new ObjectParameter("Id", typeof(byte)); | |
2947 | + | |
2948 | + var titleParameter = title != null ? | |
2949 | + new ObjectParameter("Title", title) : | |
2950 | + new ObjectParameter("Title", typeof(string)); | |
2951 | + | |
2952 | + var priceParameter = price.HasValue ? | |
2953 | + new ObjectParameter("Price", price) : | |
2954 | + new ObjectParameter("Price", typeof(decimal)); | |
2955 | + | |
2956 | + var durationParameter = duration.HasValue ? | |
2957 | + new ObjectParameter("Duration", duration) : | |
2958 | + new ObjectParameter("Duration", typeof(byte)); | |
2959 | + | |
2960 | + var editionIdParameter = editionId.HasValue ? | |
2961 | + new ObjectParameter("EditionId", editionId) : | |
2962 | + new ObjectParameter("EditionId", typeof(byte)); | |
2963 | + | |
2964 | + var isActiveParameter = isActive.HasValue ? | |
2965 | + new ObjectParameter("IsActive", isActive) : | |
2966 | + new ObjectParameter("IsActive", typeof(bool)); | |
2967 | + | |
2968 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("Usp_UpdateSubscriptionPlan", idParameter, titleParameter, priceParameter, durationParameter, editionIdParameter, isActiveParameter, status); | |
2969 | + } | |
2970 | + | |
2971 | + public virtual ObjectResult<usp_GetAccountTypeList_Result> usp_GetAccountTypeList(Nullable<int> id) | |
2972 | + { | |
2973 | + var idParameter = id.HasValue ? | |
2974 | + new ObjectParameter("Id", id) : | |
2975 | + new ObjectParameter("Id", typeof(int)); | |
2976 | + | |
2977 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<usp_GetAccountTypeList_Result>("usp_GetAccountTypeList", idParameter); | |
2978 | + } | |
2979 | + | |
2980 | + public virtual ObjectResult<usp_GetUserType_Result> usp_GetUserType(Nullable<int> id) | |
2981 | + { | |
2982 | + var idParameter = id.HasValue ? | |
2983 | + new ObjectParameter("id", id) : | |
2984 | + new ObjectParameter("id", typeof(int)); | |
2985 | + | |
2986 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<usp_GetUserType_Result>("usp_GetUserType", idParameter); | |
2987 | + } | |
2988 | + | |
2989 | + public virtual int usp_UpdateUserId(Nullable<int> id, string userId, string olduserId, ObjectParameter status) | |
2990 | + { | |
2991 | + var idParameter = id.HasValue ? | |
2992 | + new ObjectParameter("Id", id) : | |
2993 | + new ObjectParameter("Id", typeof(int)); | |
2994 | + | |
2995 | + var userIdParameter = userId != null ? | |
2996 | + new ObjectParameter("UserId", userId) : | |
2997 | + new ObjectParameter("UserId", typeof(string)); | |
2998 | + | |
2999 | + var olduserIdParameter = olduserId != null ? | |
3000 | + new ObjectParameter("olduserId", olduserId) : | |
3001 | + new ObjectParameter("olduserId", typeof(string)); | |
3002 | + | |
3003 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateUserId", idParameter, userIdParameter, olduserIdParameter, status); | |
3004 | + } | |
2890 | 3005 | } |
2891 | 3006 | } | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx
... | ... | @@ -2615,6 +2615,44 @@ warning 6002: The table/view 'AIADatabaseV5.dbo.VocabTermNumberToSystemMap' does |
2615 | 2615 | <Parameter Name="Status" Type="int" Mode="InOut" /> |
2616 | 2616 | </Function> |
2617 | 2617 | <Function Name="usp_DB_TblRowCOUNT" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" /> |
2618 | + <Function Name="Usp_DeleteSubscriptionPlan" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> | |
2619 | + <Parameter Name="Id" Type="tinyint" Mode="In" /> | |
2620 | + <Parameter Name="Status" Type="bit" Mode="InOut" /> | |
2621 | + </Function> | |
2622 | + <Function Name="usp_GetAccountTypeList" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> | |
2623 | + <Parameter Name="Id" Type="int" Mode="In" /> | |
2624 | + </Function> | |
2625 | + <Function Name="Usp_GetSubscriptionPlans" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> | |
2626 | + <Parameter Name="iEditionId" Type="tinyint" Mode="In" /> | |
2627 | + <Parameter Name="iDuration" Type="tinyint" Mode="In" /> | |
2628 | + </Function> | |
2629 | + <Function Name="usp_GetUserType" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> | |
2630 | + <Parameter Name="id" Type="int" Mode="In" /> | |
2631 | + </Function> | |
2632 | + <Function Name="Usp_InsertSubscriptionPlan" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> | |
2633 | + <Parameter Name="Id" Type="tinyint" Mode="In" /> | |
2634 | + <Parameter Name="Title" Type="varchar" Mode="In" /> | |
2635 | + <Parameter Name="Price" Type="money" Mode="In" /> | |
2636 | + <Parameter Name="Duration" Type="tinyint" Mode="In" /> | |
2637 | + <Parameter Name="EditionId" Type="tinyint" Mode="In" /> | |
2638 | + <Parameter Name="IsActive" Type="bit" Mode="In" /> | |
2639 | + <Parameter Name="Status" Type="bit" Mode="InOut" /> | |
2640 | + </Function> | |
2641 | + <Function Name="Usp_UpdateSubscriptionPlan" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> | |
2642 | + <Parameter Name="Id" Type="tinyint" Mode="In" /> | |
2643 | + <Parameter Name="Title" Type="varchar" Mode="In" /> | |
2644 | + <Parameter Name="Price" Type="money" Mode="In" /> | |
2645 | + <Parameter Name="Duration" Type="tinyint" Mode="In" /> | |
2646 | + <Parameter Name="EditionId" Type="tinyint" Mode="In" /> | |
2647 | + <Parameter Name="IsActive" Type="bit" Mode="In" /> | |
2648 | + <Parameter Name="Status" Type="bit" Mode="InOut" /> | |
2649 | + </Function> | |
2650 | + <Function Name="usp_UpdateUserId" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> | |
2651 | + <Parameter Name="Id" Type="int" Mode="In" /> | |
2652 | + <Parameter Name="UserId" Type="varchar" Mode="In" /> | |
2653 | + <Parameter Name="olduserId" Type="varchar" Mode="In" /> | |
2654 | + <Parameter Name="Status" Type="int" Mode="InOut" /> | |
2655 | + </Function> | |
2618 | 2656 | <EntityContainer Name="AIADatabaseV5ModelStoreContainer"> |
2619 | 2657 | <EntitySet Name="AccountType" EntityType="Self.AccountType" Schema="dbo" store:Type="Tables" /> |
2620 | 2658 | <EntitySet Name="Activity" EntityType="Self.Activity" Schema="dbo" store:Type="Tables" /> |
... | ... | @@ -6039,6 +6077,44 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap]</Definin |
6039 | 6077 | <Parameter Name="sStartDate" Mode="In" Type="String" /> |
6040 | 6078 | <Parameter Name="sEndDate" Mode="In" Type="String" /> |
6041 | 6079 | </FunctionImport> |
6080 | + <FunctionImport Name="Usp_DeleteSubscriptionPlan"> | |
6081 | + <Parameter Name="Id" Mode="In" Type="Byte" /> | |
6082 | + <Parameter Name="Status" Mode="InOut" Type="Boolean" /> | |
6083 | + </FunctionImport> | |
6084 | + <FunctionImport Name="Usp_GetSubscriptionPlans" ReturnType="Collection(AIADatabaseV5Model.Usp_GetSubscriptionPlans_Result)"> | |
6085 | + <Parameter Name="iEditionId" Mode="In" Type="Byte" /> | |
6086 | + <Parameter Name="iDuration" Mode="In" Type="Byte" /> | |
6087 | + </FunctionImport> | |
6088 | + <FunctionImport Name="Usp_InsertSubscriptionPlan"> | |
6089 | + <Parameter Name="Id" Mode="In" Type="Byte" /> | |
6090 | + <Parameter Name="Title" Mode="In" Type="String" /> | |
6091 | + <Parameter Name="Price" Mode="In" Type="Decimal" /> | |
6092 | + <Parameter Name="Duration" Mode="In" Type="Byte" /> | |
6093 | + <Parameter Name="EditionId" Mode="In" Type="Byte" /> | |
6094 | + <Parameter Name="IsActive" Mode="In" Type="Boolean" /> | |
6095 | + <Parameter Name="Status" Mode="InOut" Type="Boolean" /> | |
6096 | + </FunctionImport> | |
6097 | + <FunctionImport Name="Usp_UpdateSubscriptionPlan"> | |
6098 | + <Parameter Name="Id" Mode="In" Type="Byte" /> | |
6099 | + <Parameter Name="Title" Mode="In" Type="String" /> | |
6100 | + <Parameter Name="Price" Mode="In" Type="Decimal" /> | |
6101 | + <Parameter Name="Duration" Mode="In" Type="Byte" /> | |
6102 | + <Parameter Name="EditionId" Mode="In" Type="Byte" /> | |
6103 | + <Parameter Name="IsActive" Mode="In" Type="Boolean" /> | |
6104 | + <Parameter Name="Status" Mode="InOut" Type="Boolean" /> | |
6105 | + </FunctionImport> | |
6106 | + <FunctionImport Name="usp_GetAccountTypeList" ReturnType="Collection(AIADatabaseV5Model.usp_GetAccountTypeList_Result)"> | |
6107 | + <Parameter Name="Id" Mode="In" Type="Int32" /> | |
6108 | + </FunctionImport> | |
6109 | + <FunctionImport Name="usp_GetUserType" ReturnType="Collection(AIADatabaseV5Model.usp_GetUserType_Result)"> | |
6110 | + <Parameter Name="id" Mode="In" Type="Int32" /> | |
6111 | + </FunctionImport> | |
6112 | + <FunctionImport Name="usp_UpdateUserId"> | |
6113 | + <Parameter Name="Id" Mode="In" Type="Int32" /> | |
6114 | + <Parameter Name="UserId" Mode="In" Type="String" /> | |
6115 | + <Parameter Name="olduserId" Mode="In" Type="String" /> | |
6116 | + <Parameter Name="Status" Mode="InOut" Type="Int32" /> | |
6117 | + </FunctionImport> | |
6042 | 6118 | </EntityContainer> |
6043 | 6119 | <ComplexType Name="DA_GetBaseLayer_Result"> |
6044 | 6120 | <Property Type="Int32" Name="Id" Nullable="false" /> |
... | ... | @@ -6838,6 +6914,20 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap]</Definin |
6838 | 6914 | <Property Type="String" Name="EndDate" Nullable="true" MaxLength="10" /> |
6839 | 6915 | <Property Type="String" Name="Status" Nullable="false" MaxLength="8" /> |
6840 | 6916 | </ComplexType> |
6917 | + <ComplexType Name="Usp_GetSubscriptionPlans_Result"> | |
6918 | + <Property Type="Decimal" Name="price" Nullable="true" Precision="14" Scale="2" /> | |
6919 | + <Property Type="String" Name="title" Nullable="false" MaxLength="50" /> | |
6920 | + <Property Type="Int16" Name="Id" Nullable="false" /> | |
6921 | + <Property Type="Byte" Name="Duration" Nullable="false" /> | |
6922 | + </ComplexType> | |
6923 | + <ComplexType Name="usp_GetAccountTypeList_Result"> | |
6924 | + <Property Type="Byte" Name="Id" Nullable="false" /> | |
6925 | + <Property Type="String" Name="Title" Nullable="false" MaxLength="50" /> | |
6926 | + </ComplexType> | |
6927 | + <ComplexType Name="usp_GetUserType_Result"> | |
6928 | + <Property Type="Byte" Name="Id" Nullable="false" /> | |
6929 | + <Property Type="String" Name="Title" Nullable="false" MaxLength="50" /> | |
6930 | + </ComplexType> | |
6841 | 6931 | </Schema> |
6842 | 6932 | </edmx:ConceptualModels> |
6843 | 6933 | <!-- C-S mapping content --> |
... | ... | @@ -9127,6 +9217,36 @@ FROM [dbo].[VocabTermNumberToSystemMap] AS [VocabTermNumberToSystemMap]</Definin |
9127 | 9217 | </ComplexTypeMapping> |
9128 | 9218 | </ResultMapping> |
9129 | 9219 | </FunctionImportMapping> |
9220 | + <FunctionImportMapping FunctionImportName="Usp_DeleteSubscriptionPlan" FunctionName="AIADatabaseV5Model.Store.Usp_DeleteSubscriptionPlan" /> | |
9221 | + <FunctionImportMapping FunctionImportName="Usp_GetSubscriptionPlans" FunctionName="AIADatabaseV5Model.Store.Usp_GetSubscriptionPlans"> | |
9222 | + <ResultMapping> | |
9223 | + <ComplexTypeMapping TypeName="AIADatabaseV5Model.Usp_GetSubscriptionPlans_Result"> | |
9224 | + <ScalarProperty Name="price" ColumnName="price" /> | |
9225 | + <ScalarProperty Name="title" ColumnName="title" /> | |
9226 | + <ScalarProperty Name="Id" ColumnName="Id" /> | |
9227 | + <ScalarProperty Name="Duration" ColumnName="Duration" /> | |
9228 | + </ComplexTypeMapping> | |
9229 | + </ResultMapping> | |
9230 | + </FunctionImportMapping> | |
9231 | + <FunctionImportMapping FunctionImportName="Usp_InsertSubscriptionPlan" FunctionName="AIADatabaseV5Model.Store.Usp_InsertSubscriptionPlan" /> | |
9232 | + <FunctionImportMapping FunctionImportName="Usp_UpdateSubscriptionPlan" FunctionName="AIADatabaseV5Model.Store.Usp_UpdateSubscriptionPlan" /> | |
9233 | + <FunctionImportMapping FunctionImportName="usp_GetAccountTypeList" FunctionName="AIADatabaseV5Model.Store.usp_GetAccountTypeList"> | |
9234 | + <ResultMapping> | |
9235 | + <ComplexTypeMapping TypeName="AIADatabaseV5Model.usp_GetAccountTypeList_Result"> | |
9236 | + <ScalarProperty Name="Id" ColumnName="Id" /> | |
9237 | + <ScalarProperty Name="Title" ColumnName="Title" /> | |
9238 | + </ComplexTypeMapping> | |
9239 | + </ResultMapping> | |
9240 | + </FunctionImportMapping> | |
9241 | + <FunctionImportMapping FunctionImportName="usp_GetUserType" FunctionName="AIADatabaseV5Model.Store.usp_GetUserType"> | |
9242 | + <ResultMapping> | |
9243 | + <ComplexTypeMapping TypeName="AIADatabaseV5Model.usp_GetUserType_Result"> | |
9244 | + <ScalarProperty Name="Id" ColumnName="Id" /> | |
9245 | + <ScalarProperty Name="Title" ColumnName="Title" /> | |
9246 | + </ComplexTypeMapping> | |
9247 | + </ResultMapping> | |
9248 | + </FunctionImportMapping> | |
9249 | + <FunctionImportMapping FunctionImportName="usp_UpdateUserId" FunctionName="AIADatabaseV5Model.Store.usp_UpdateUserId" /> | |
9130 | 9250 | </EntityContainerMapping> |
9131 | 9251 | </Mapping> |
9132 | 9252 | </edmx:Mappings> | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/Usp_GetSubscriptionPlans_Result.cs
0 → 100644
1 | +//------------------------------------------------------------------------------ | |
2 | +// <auto-generated> | |
3 | +// This code was generated from a template. | |
4 | +// | |
5 | +// Manual changes to this file may cause unexpected behavior in your application. | |
6 | +// Manual changes to this file will be overwritten if the code is regenerated. | |
7 | +// </auto-generated> | |
8 | +//------------------------------------------------------------------------------ | |
9 | + | |
10 | +namespace AIAHTML5.ADMIN.API.Entity | |
11 | +{ | |
12 | + using System; | |
13 | + | |
14 | + public partial class Usp_GetSubscriptionPlans_Result | |
15 | + { | |
16 | + public Nullable<decimal> price { get; set; } | |
17 | + public string title { get; set; } | |
18 | + public short Id { get; set; } | |
19 | + public byte Duration { get; set; } | |
20 | + } | |
21 | +} | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetAccountTypeList_Result.cs
0 → 100644
1 | +//------------------------------------------------------------------------------ | |
2 | +// <auto-generated> | |
3 | +// This code was generated from a template. | |
4 | +// | |
5 | +// Manual changes to this file may cause unexpected behavior in your application. | |
6 | +// Manual changes to this file will be overwritten if the code is regenerated. | |
7 | +// </auto-generated> | |
8 | +//------------------------------------------------------------------------------ | |
9 | + | |
10 | +namespace AIAHTML5.ADMIN.API.Entity | |
11 | +{ | |
12 | + using System; | |
13 | + | |
14 | + public partial class usp_GetAccountTypeList_Result | |
15 | + { | |
16 | + public byte Id { get; set; } | |
17 | + public string Title { get; set; } | |
18 | + } | |
19 | +} | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUserType_Result.cs
0 → 100644
1 | +//------------------------------------------------------------------------------ | |
2 | +// <auto-generated> | |
3 | +// This code was generated from a template. | |
4 | +// | |
5 | +// Manual changes to this file may cause unexpected behavior in your application. | |
6 | +// Manual changes to this file will be overwritten if the code is regenerated. | |
7 | +// </auto-generated> | |
8 | +//------------------------------------------------------------------------------ | |
9 | + | |
10 | +namespace AIAHTML5.ADMIN.API.Entity | |
11 | +{ | |
12 | + using System; | |
13 | + | |
14 | + public partial class usp_GetUserType_Result | |
15 | + { | |
16 | + public byte Id { get; set; } | |
17 | + public string Title { get; set; } | |
18 | + } | |
19 | +} | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/DiscountCodeModel.cs
... | ... | @@ -66,8 +66,8 @@ namespace AIAHTML5.ADMIN.API.Models |
66 | 66 | { |
67 | 67 | try |
68 | 68 | { |
69 | - var result = dbContext.UpdateDiscount(discountCodeModel.Id, discountCodeModel.Percentage, discountCodeModel.StartDate.ToString(), | |
70 | - discountCodeModel.EndDate.ToString(), (byte?)(discountCodeModel.IsActive == true ? 1 : 0), discountCodeModel.DiscountCode); | |
69 | + var result = dbContext.UpdateDiscount(discountCodeModel.Id, discountCodeModel.Percentage, discountCodeModel.StartDate.ToString("MM/dd/yyyy"), | |
70 | + discountCodeModel.EndDate.ToString("MM/dd/yyyy"), (byte?)(discountCodeModel.IsActive == true ? 1 : 0), discountCodeModel.DiscountCode); | |
71 | 71 | if (result.Count() > 0) |
72 | 72 | { |
73 | 73 | return true; | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/SubscriptionPriceModel.cs
0 → 100644
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Web; | |
5 | +using AIAHTML5.ADMIN.API.Entity; | |
6 | + | |
7 | +namespace AIAHTML5.ADMIN.API.Models | |
8 | +{ | |
9 | + public class SubscriptionPriceModel | |
10 | + { | |
11 | + public int Id { get; set; } | |
12 | + public string Title { get; set; } | |
13 | + public decimal Price { get; set; } | |
14 | + public int Duration { get; set; } | |
15 | + public int EditionId { get; set; } | |
16 | + public bool IsActive { get; set; } | |
17 | + | |
18 | + public static List<SubscriptionPriceModel> GetSubscriptionPrices(AIADatabaseV5Entities dbContext, int editionId, int duration) | |
19 | + { | |
20 | + List<SubscriptionPriceModel> SubscriptionPriceList = new List<SubscriptionPriceModel>(); | |
21 | + SubscriptionPriceModel SubscriptionPriceObj = new SubscriptionPriceModel(); | |
22 | + try | |
23 | + { | |
24 | + var result = dbContext.Usp_GetSubscriptionPlans((byte?)editionId, (byte?)duration).ToList(); | |
25 | + if (result.Count > 0) | |
26 | + { | |
27 | + foreach (var item in result) | |
28 | + { | |
29 | + SubscriptionPriceObj = new SubscriptionPriceModel(); | |
30 | + SubscriptionPriceObj.Id = item.Id; | |
31 | + SubscriptionPriceObj.Title = item.title; | |
32 | + SubscriptionPriceObj.Price = item.price.Value; | |
33 | + SubscriptionPriceObj.Duration = item.Duration; | |
34 | + SubscriptionPriceObj.EditionId = item.Id; | |
35 | + SubscriptionPriceObj.IsActive = true ; | |
36 | + SubscriptionPriceList.Add(SubscriptionPriceObj); | |
37 | + } | |
38 | + } | |
39 | + } | |
40 | + catch (Exception ex) { } | |
41 | + return SubscriptionPriceList; | |
42 | + } | |
43 | + | |
44 | + public static bool InsertSubscriptionPrice(AIADatabaseV5Entities dbContext, SubscriptionPriceModel subscriptionPriceModel) | |
45 | + { | |
46 | + var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); | |
47 | + try | |
48 | + { | |
49 | + dbContext.Usp_InsertSubscriptionPlan((byte?)subscriptionPriceModel.Id, subscriptionPriceModel.Title, (decimal?)subscriptionPriceModel.Price, | |
50 | + (byte?)subscriptionPriceModel.Duration, (byte?)subscriptionPriceModel.EditionId, subscriptionPriceModel.IsActive, spStatus); | |
51 | + if (spStatus.Value.ToString() == "1") | |
52 | + { | |
53 | + return true; | |
54 | + } | |
55 | + else | |
56 | + { | |
57 | + return false; | |
58 | + } | |
59 | + } | |
60 | + catch (Exception ex) | |
61 | + { | |
62 | + return false; | |
63 | + } | |
64 | + } | |
65 | + | |
66 | + public static bool UpdateSubscriptionPrice(AIADatabaseV5Entities dbContext, SubscriptionPriceModel subscriptionPriceModel) | |
67 | + { | |
68 | + var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); | |
69 | + try | |
70 | + { | |
71 | + dbContext.Usp_UpdateSubscriptionPlan((byte?)subscriptionPriceModel.Id, subscriptionPriceModel.Title, subscriptionPriceModel.Price, | |
72 | + (byte?)subscriptionPriceModel.Duration, (byte?)subscriptionPriceModel.EditionId, subscriptionPriceModel.IsActive, spStatus); | |
73 | + if (spStatus.Value.ToString() == "1") | |
74 | + { | |
75 | + return true; | |
76 | + } | |
77 | + else | |
78 | + { | |
79 | + return false; | |
80 | + } | |
81 | + } | |
82 | + catch (Exception ex) | |
83 | + { | |
84 | + return false; | |
85 | + } | |
86 | + } | |
87 | + | |
88 | + public static bool DeleteSubscriptionPrice(AIADatabaseV5Entities dbContext, int subscriptionPriceId) | |
89 | + { | |
90 | + var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); | |
91 | + try | |
92 | + { | |
93 | + dbContext.Usp_DeleteSubscriptionPlan((byte?)subscriptionPriceId, spStatus); | |
94 | + if (spStatus.Value.ToString() == "1") | |
95 | + { | |
96 | + return true; | |
97 | + } | |
98 | + else | |
99 | + { | |
100 | + return false; | |
101 | + } | |
102 | + } | |
103 | + catch (Exception ex) | |
104 | + { | |
105 | + return false; | |
106 | + } | |
107 | + } | |
108 | + } | |
109 | +} | |
0 | 110 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/app.module.ts
... | ... | @@ -6,6 +6,8 @@ import { RouterModule, Routes } from '@angular/router'; |
6 | 6 | import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; |
7 | 7 | import { APP_BASE_HREF } from '@angular/common'; |
8 | 8 | import { HttpModule } from '@angular/http'; |
9 | +import { Pipe, PipeTransform } from '@angular/core'; | |
10 | +import { DatePipe } from '@angular/common'; | |
9 | 11 | |
10 | 12 | //import { ModalModule } from 'ngx-bootstrap/modal'; |
11 | 13 | import { UpdateUserProfile } from './components/UpdateProfile/updateuserprofile.component'; |
... | ... | @@ -38,8 +40,8 @@ import { GlobalService } from './Shared/global'; |
38 | 40 | // useClass: MyInterceptor, |
39 | 41 | // multi: true |
40 | 42 | //} |
41 | - { provide: APP_BASE_HREF, useValue: '/' } | |
42 | - , GlobalService | |
43 | + { provide: APP_BASE_HREF, useValue: '/' }, DatePipe, | |
44 | + GlobalService | |
43 | 45 | ], |
44 | 46 | bootstrap: [AppComponent] |
45 | 47 | }) | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/ManageDiscountCode.zip deleted
No preview for this file type
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/ManageDiscountCode/managediscountcode.component.html
... | ... | @@ -7,15 +7,9 @@ |
7 | 7 | <!-- container --> |
8 | 8 | <div [className]="divClass"> |
9 | 9 | <div class="container-fluid main-full"> |
10 | - <div class="form-group" *ngIf="alerts != ''"> | |
11 | - <div class="col-xs-12"> | |
12 | - <div class="alert alert-danger" [innerHTML]="alerts"> | |
13 | - </div> | |
14 | - </div> | |
15 | - </div> | |
10 | + | |
16 | 11 | <!-- form --> |
17 | 12 | <form class="form-horizontal" [formGroup]="manageDiscountCodeFrm"> |
18 | - | |
19 | 13 | <div [style.visibility]="(Mode == 'Manage') ? 'visible' : 'hidden'" class="row"> |
20 | 14 | <div class="well no-margin-btm"> |
21 | 15 | <div class="row"> |
... | ... | @@ -40,8 +34,8 @@ |
40 | 34 | <div id="datetimepicker1" class="input-group input-append date"> |
41 | 35 | <input id="searchStartDate" type="text" class="form-control" formControlName="searchStartDate"> |
42 | 36 | <span class="input-group-btn add-on"> |
43 | - <button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button> | |
44 | - </span> | |
37 | + <button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button> | |
38 | + </span> | |
45 | 39 | </div> |
46 | 40 | </div> |
47 | 41 | </div> |
... | ... | @@ -80,7 +74,7 @@ |
80 | 74 | |
81 | 75 | <div class="well"> |
82 | 76 | <div class="table-responsive blue table-fixT"> |
83 | - <table class="table table-condensed table-bordered margin-btm0 table-striped table-hover table-fixed"> | |
77 | + <table class="table table-condensed table-bordered margin-btm0 table-striped table-fixed"> | |
84 | 78 | <thead> |
85 | 79 | <tr> |
86 | 80 | <th>Discount Code</th> |
... | ... | @@ -91,7 +85,7 @@ |
91 | 85 | </tr> |
92 | 86 | </thead> |
93 | 87 | <tbody> |
94 | - <tr *ngFor="let item of this.manageDiscountCodeFrm.controls['discountCodes'].value"> | |
88 | + <tr *ngFor="let item of this.manageDiscountCodeFrm.controls['discountCodes'].value; let i = index" (click)="SetClickedRow(i, item)" [class.active]="i == selectedRow" [class.inactive]="i != selectedRow"> | |
95 | 89 | <td><input type="hidden" value="{{item.Id}}">{{item.DiscountCode}}</td> |
96 | 90 | <td>{{item.Percentage | number : '1.2'}}</td> |
97 | 91 | <td>{{item.StartDate | date: 'MM/dd/yyyy'}}</td> |
... | ... | @@ -122,32 +116,43 @@ |
122 | 116 | <div class="panel-body"> |
123 | 117 | <!-- form --> |
124 | 118 | <form class="form-horizontal" [formGroup]="insertUpdateDiscountCodeFrm" (submit)="InsertUpdateDiscountCode()"> |
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 | + | |
125 | 126 | <div class="form-group"> |
126 | 127 | <label for="discountCode" class="col-sm-4 control-label">Discount Code :</label> |
127 | 128 | <div class="col-sm-7"> |
128 | 129 | <input type="hidden" formControlName="discountId"> |
129 | - <input type="text" class="form-control" id="discountCode" placeholder="" formControlName="discountCode"> | |
130 | + <input type="text" class="form-control" id="discountCode" formControlName="discountCode"> | |
130 | 131 | </div> |
131 | 132 | </div> |
133 | + | |
132 | 134 | <div class="form-group"> |
133 | 135 | <label for="startDate" class="col-sm-4 control-label">Discount Start Date <span class="red">*</span> :</label> |
134 | 136 | <div class="col-sm-7"> |
135 | - <div id="datetimepicker1" class="input-group input-group-sm input-append date"> | |
136 | - <input type="text" class="form-control" id="startDate" formControlName="startDate"> | |
137 | + <div id="bsdatetimepicker3" class="input-group input-group-sm input-append date"> | |
138 | + <input type="text" class="form-control" formControlName="startDate" #dp3="bsDatepicker" bsDatepicker [(bsValue)]="bsValue3"> | |
139 | + <div *ngIf="insertUpdateDiscountCodeFrm.controls.startDate.hasError('required') && insertUpdateDiscountCodeFrm.controls.startDate.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Discount start date is required</div> | |
137 | 140 | <span class="input-group-btn add-on"> |
138 | - <button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button> | |
139 | - </span> | |
141 | + <button class="btn btn-default" type="button" (click)="dp3.toggle()"><i class="fa fa-calendar"></i></button> | |
142 | + </span> | |
140 | 143 | </div> |
141 | 144 | </div> |
142 | 145 | </div> |
146 | + | |
143 | 147 | <div class="form-group"> |
144 | 148 | <label for="endDate" class="col-sm-4 control-label">Discount End Date <span class="red">*</span> :</label> |
145 | 149 | <div class="col-sm-7"> |
146 | - <div id="datetimepicker2" class="input-group input-group-sm input-append date"> | |
147 | - <input type="text" class="form-control" id="endDate" formControlName="endDate"> | |
150 | + <div id="bdatetimepicker4" class="input-group input-group-sm input-append date"> | |
151 | + <input type="text" class="form-control" formControlName="endDate" #dp4="bsDatepicker" bsDatepicker [(bsValue)]="bsValue4"> | |
152 | + <div *ngIf="insertUpdateDiscountCodeFrm.controls.endDate.hasError('required') && insertUpdateDiscountCodeFrm.controls.endDate.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Discount end date is required</div> | |
148 | 153 | <span class="input-group-btn add-on"> |
149 | - <button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button> | |
150 | - </span> | |
154 | + <button class="btn btn-default" type="button" (click)="dp4.toggle()"><i class="fa fa-calendar"></i></button> | |
155 | + </span> | |
151 | 156 | </div> |
152 | 157 | </div> |
153 | 158 | </div> |
... | ... | @@ -155,16 +160,33 @@ |
155 | 160 | <div class="form-group"> |
156 | 161 | <label for="percentage" class="col-sm-4 control-label">Percentage <span class="red">*</span> :</label> |
157 | 162 | <div class="col-sm-7"> |
158 | - <input type="text" class="form-control" id="percentage" placeholder="" formControlName="percentage"> | |
163 | + <input type="text" class="form-control" id="percentage" formControlName="percentage" maxlength="5"> | |
164 | + <div *ngIf="insertUpdateDiscountCodeFrm.controls.percentage.hasError('required') && insertUpdateDiscountCodeFrm.controls.percentage.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Discount percentage is required</div> | |
165 | + <div *ngIf="insertUpdateDiscountCodeFrm.controls.percentage.hasError('pattern') && insertUpdateDiscountCodeFrm.controls.percentage.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Discount percentage must be numeric</div> | |
159 | 166 | </div> |
160 | 167 | </div> |
168 | + | |
169 | + <div class="form-group"> | |
170 | + <label for="status" class="col-sm-4 control-label">Status :</label> | |
171 | + <div class="col-sm-7"> | |
172 | + <label class="radio-inline"> | |
173 | + <input name="isActive" value="true" type="radio" formControlName="isActive"> | |
174 | + Active | |
175 | + </label> | |
176 | + <label class="radio-inline"> | |
177 | + <input name="isActive" value="false" type="radio" formControlName="isActive"> | |
178 | + Inactive | |
179 | + </label> | |
180 | + </div> | |
181 | + </div> | |
161 | 182 | |
162 | 183 | <div class="form-group"> |
163 | 184 | <div class="col-sm-offset-4 col-sm-7 mar-top17"> |
164 | - <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-plus-circle"></i> Save</button> | |
185 | + <button type="submit" [disabled]="!insertUpdateDiscountCodeFrm.valid" class="btn btn-primary btn-sm"><i class="fa fa-plus-circle"></i> Save</button> | |
165 | 186 | <button type="button" (click)="CancelAddEdit()" class="btn btn-primary btn-sm"><i class="fa fa-times-circle"></i> Cancel</button> |
166 | 187 | </div> |
167 | 188 | </div> |
189 | + | |
168 | 190 | <!--cancel-button--> |
169 | 191 | <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" id="mymodal"> |
170 | 192 | <div class="modal-dialog modal-sm" role="document"> |
... | ... | @@ -181,7 +203,6 @@ |
181 | 203 | <div class="col-sm-12"><button class="btn btn-primary btn-sm">Ok</button></div> |
182 | 204 | </div> |
183 | 205 | </div> |
184 | - | |
185 | 206 | </div> |
186 | 207 | <!-- /.modal-content --> |
187 | 208 | </div> |
... | ... | @@ -189,6 +210,7 @@ |
189 | 210 | </div> |
190 | 211 | <!-- /.modal --> |
191 | 212 | <!--cancel-button--> |
213 | + | |
192 | 214 | </form> |
193 | 215 | <!-- form --> |
194 | 216 | </div> | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/ManageDiscountCode/managediscountcode.component.ts
... | ... | @@ -5,6 +5,8 @@ import { FormControl, FormBuilder, FormGroup, Validators } from '@angular/forms' |
5 | 5 | import { DiscountCode } from '../UpdateProfile/datamodel'; |
6 | 6 | import { BsDatepickerModule } from 'ngx-bootstrap'; |
7 | 7 | import { Http, Response } from '@angular/http'; |
8 | +import { Pipe, PipeTransform } from '@angular/core'; | |
9 | +import { DatePipe } from '@angular/common'; | |
8 | 10 | |
9 | 11 | //import { Global } from '../../Shared/global'; |
10 | 12 | //import { DBOperation } from 'S'; |
... | ... | @@ -25,7 +27,11 @@ error: any; |
25 | 27 | alerts: string; |
26 | 28 | divClass: string = ''; |
27 | 29 | topPos: string = '2000px'; |
28 | -bsValue: Date = new Date(); | |
30 | +selectedRow: number = 0; | |
31 | +datePipe: DatePipe = new DatePipe('en-US'); | |
32 | +bsValue3: Date = new Date(); | |
33 | +bsValue4: Date = new Date(); | |
34 | +selectedId: number = 0; | |
29 | 35 | |
30 | 36 | constructor(private manageDiscountCodeService: ManageDiscountCodeService, private router: Router, private fb: FormBuilder) { } |
31 | 37 | |
... | ... | @@ -41,19 +47,23 @@ constructor(private manageDiscountCodeService: ManageDiscountCodeService, privat |
41 | 47 | }); |
42 | 48 | this.insertUpdateDiscountCodeFrm = this.fb.group({ |
43 | 49 | discountId: [''], |
44 | - discountCode: ['', Validators.required], | |
50 | + discountCode: [''], | |
45 | 51 | startDate: ['', Validators.required], |
46 | 52 | endDate: ['', Validators.required], |
47 | - percentage: ['', Validators.required], | |
48 | - isActive: [''] | |
53 | + percentage: ['', [Validators.required, Validators.pattern('[0-9.]*')]], | |
54 | + isActive: [true] | |
49 | 55 | }); |
50 | 56 | this.SearchDiscountCodes(); |
51 | 57 | } |
52 | 58 | |
53 | - SearchDiscountCodes() { | |
54 | - console.log(this.manageDiscountCodeFrm.controls['searchDiscountCode'].value + ', ' + | |
55 | - this.manageDiscountCodeFrm.controls['searchStartDate'].value + ', ' + | |
56 | - this.manageDiscountCodeFrm.controls['searchEndDate'].value); | |
59 | + public SetClickedRow(i: number, item: any) { | |
60 | + this.selectedRow = i; | |
61 | + this.selectedId = item['Id']; | |
62 | + this.discountCode = item; | |
63 | + } | |
64 | + | |
65 | + public SearchDiscountCodes() { | |
66 | + this.selectedRow = -1; | |
57 | 67 | this.manageDiscountCodeService.GetDiscountCodes( |
58 | 68 | { |
59 | 69 | discountCode: this.manageDiscountCodeFrm.controls['searchDiscountCode'].value, |
... | ... | @@ -66,21 +76,39 @@ constructor(private manageDiscountCodeService: ManageDiscountCodeService, privat |
66 | 76 | public InsertUpdateDiscountCode() { |
67 | 77 | console.log('InsertUpdateDiscountCode'); |
68 | 78 | this.alerts = ''; |
69 | - | |
79 | + if(parseInt(this.insertUpdateDiscountCodeFrm.value.percentage) > 100){ | |
80 | + this.alerts = '<span>Percentage must be between 0 to 100</span>'; | |
81 | + } | |
70 | 82 | if(this.alerts == ''){ |
71 | 83 | var obj = this.insertUpdateDiscountCodeFrm.value; |
72 | - return this.manageDiscountCodeService.InsertDiscountCode(obj) | |
73 | - .subscribe( | |
74 | - n => (this.AfterInsertData(n)), | |
75 | - error => this.error = <any>error); | |
84 | + if(obj.discountId == 0){ | |
85 | + return this.manageDiscountCodeService.InsertDiscountCode(obj) | |
86 | + .subscribe( | |
87 | + n => (this.AfterInsertData(n)), | |
88 | + error => this.error = <any>error); | |
89 | + } | |
90 | + else{ | |
91 | + return this.manageDiscountCodeService.UpdateDiscountCode(obj) | |
92 | + .subscribe( | |
93 | + n => (this.AfterUpdateData(n)), | |
94 | + error => this.error = <any>error); | |
95 | + } | |
76 | 96 | } |
77 | 97 | } |
78 | 98 | |
79 | 99 | AfterInsertData(data) { |
80 | 100 | if (data.Status == "false") { |
81 | - this.alerts = "<span>Password change unsuccessfully</span>"; | |
101 | + this.alerts = "<span>Discount code save unsuccessfull</span>"; | |
102 | + } else { | |
103 | + this.alerts = "<span>Discount code saved successfully</span>"; | |
104 | + } | |
105 | + } | |
106 | + | |
107 | + AfterUpdateData(data) { | |
108 | + if (data.Status == "false") { | |
109 | + this.alerts = "<span>Discount code update unsuccessfull</span>"; | |
82 | 110 | } else { |
83 | - this.alerts = "<span>Password changed successfully</span>"; | |
111 | + this.alerts = "<span>Discount code updated successfully</span>"; | |
84 | 112 | } |
85 | 113 | } |
86 | 114 | |
... | ... | @@ -89,30 +117,39 @@ constructor(private manageDiscountCodeService: ManageDiscountCodeService, privat |
89 | 117 | this.manageDiscountCodeFrm.setControl('discountCodes', this.fb.array(this.discountCodes)); |
90 | 118 | } |
91 | 119 | |
92 | - ResetFormFields(){ | |
93 | - this.manageDiscountCodeFrm.reset() | |
94 | - //this.manageDiscountCodeFrm.controls['loginId'].setValue(this.user.LoginId); | |
95 | - //this.manageDiscountCodeFrm.controls['oldPassword'].setValue(''); | |
96 | - //this.manageDiscountCodeFrm.controls['newPassword'].setValue(''); | |
97 | - //this.manageDiscountCodeFrm.controls['confirmPassword'].setValue(''); | |
98 | - this.alerts = ''; | |
99 | - } | |
100 | - | |
101 | 120 | AddDiscountCode(){ |
102 | 121 | this.Mode = 'Add'; |
103 | 122 | this.topPos = '100px'; |
104 | 123 | this.divClass = 'col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3'; |
124 | + this.insertUpdateDiscountCodeFrm.reset(); | |
125 | + this.alerts = ''; | |
126 | + this.insertUpdateDiscountCodeFrm.controls['discountId'].setValue(0); | |
127 | + this.insertUpdateDiscountCodeFrm.controls['discountCode'].setValue(''); | |
128 | + this.insertUpdateDiscountCodeFrm.controls['startDate'].setValue(''); | |
129 | + this.insertUpdateDiscountCodeFrm.controls['endDate'].setValue(''); | |
130 | + this.insertUpdateDiscountCodeFrm.controls['percentage'].setValue(''); | |
131 | + this.insertUpdateDiscountCodeFrm.controls['isActive'].setValue(true); | |
105 | 132 | } |
106 | 133 | |
107 | 134 | EditDiscountCode(){ |
108 | 135 | this.Mode = 'Edit'; |
109 | 136 | this.topPos = '100px'; |
110 | 137 | this.divClass = 'col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3'; |
138 | + this.alerts = ''; | |
139 | + this.insertUpdateDiscountCodeFrm.controls['discountId'].setValue(this.discountCode.Id); | |
140 | + this.insertUpdateDiscountCodeFrm.controls['discountCode'].setValue(this.discountCode.DiscountCode); | |
141 | + this.insertUpdateDiscountCodeFrm.controls['startDate'].setValue(this.datePipe.transform(this.discountCode.StartDate, 'MM/dd/yyyy')); | |
142 | + this.insertUpdateDiscountCodeFrm.controls['endDate'].setValue(this.datePipe.transform(this.discountCode.EndDate, 'MM/dd/yyyy')); | |
143 | + this.insertUpdateDiscountCodeFrm.controls['percentage'].setValue(this.discountCode.Percentage); | |
144 | + this.insertUpdateDiscountCodeFrm.controls['isActive'].setValue(this.discountCode.IsActive); | |
111 | 145 | } |
112 | 146 | |
113 | 147 | CancelAddEdit(){ |
114 | 148 | this.Mode = 'Manage'; |
115 | 149 | this.topPos = '2000px'; |
116 | 150 | this.divClass = 'col-sm-12'; |
151 | + this.SearchDiscountCodes(); | |
152 | + this.selectedRow = this.discountCodes.findIndex(C => C.Id == this.selectedId); | |
153 | + this.SetClickedRow(this.selectedRow, this.manageDiscountCodeFrm.controls['discountCodes'].value.find(C => C.Id == this.selectedId)); | |
117 | 154 | } |
118 | 155 | } | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/ManageDiscountCode/managediscountcode.service.ts
... | ... | @@ -49,12 +49,12 @@ export class ManageDiscountCodeService { |
49 | 49 | |
50 | 50 | InsertDiscountCode(obj: any) { |
51 | 51 | //let options = new RequestOptions({ headers: this.headers }); |
52 | - var jsonData = {'id': obj.userId, 'newPassword': obj.newPassword }; | |
52 | + var jsonData = {'id': obj.discountId, 'discountCode': obj.discountCode, 'startDate': obj.startDate, 'endDate': obj.endDate, 'percentage': obj.percentage, 'isActive': obj.isActive }; | |
53 | 53 | console.log(obj); |
54 | 54 | var headers = new Headers({ |
55 | 55 | 'Content-Type': 'application/json' |
56 | 56 | }); |
57 | - return this.http.post(this.commonService.resourceBaseUrl + "/api/ChangeUserPassword", | |
57 | + return this.http.post(this.commonService.resourceBaseUrl + "/api/InsertDiscountCode", | |
58 | 58 | JSON.stringify(jsonData), {headers: headers}) |
59 | 59 | .map(this.extractData) |
60 | 60 | .catch((res: Response) => this.handleError(res)); |
... | ... | @@ -62,12 +62,12 @@ export class ManageDiscountCodeService { |
62 | 62 | |
63 | 63 | UpdateDiscountCode(obj: any) { |
64 | 64 | //let options = new RequestOptions({ headers: this.headers }); |
65 | - var jsonData = {'id': obj.userId, 'newPassword': obj.newPassword }; | |
65 | + var jsonData = {'id': obj.discountId, 'discountCode': obj.discountCode, 'startDate': obj.startDate, 'endDate': obj.endDate, 'percentage': obj.percentage, 'isActive': obj.isActive }; | |
66 | 66 | console.log(obj); |
67 | 67 | var headers = new Headers({ |
68 | 68 | 'Content-Type': 'application/json' |
69 | 69 | }); |
70 | - return this.http.post(this.commonService.resourceBaseUrl + "/api/ChangeUserPassword", | |
70 | + return this.http.post(this.commonService.resourceBaseUrl + "/api/UpdateDiscountCode", | |
71 | 71 | JSON.stringify(jsonData), {headers: headers}) |
72 | 72 | .map(this.extractData) |
73 | 73 | .catch((res: Response) => this.handleError(res)); | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/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 | + <!-- container --> | |
8 | + <div class="col-sm-12"> | |
9 | + | |
10 | + <div class="container-fluid main-full"> | |
11 | + <div class="row"> | |
12 | + <div class="well marginBtm12"> | |
13 | + <!--tab-content--> | |
14 | + <div> | |
15 | + <!-- Nav tabs --> | |
16 | + <ul class="nav nav-tabs" role="tablist"> | |
17 | + <li role="presentation" class="active"><a href="#higher-edu" aria-controls="higher-edu" role="tab" data-toggle="tab">Higher Education Instructor</a></li> | |
18 | + <li role="presentation"><a href="#higher-school" aria-controls="higher-school" role="tab" data-toggle="tab">Higher School Instructor</a></li> | |
19 | + <li role="presentation"><a href="#higher-student" aria-controls="higher-student" role="tab" data-toggle="tab">Higher Education Student</a></li> | |
20 | + <li role="presentation"><a href="#higher-school-student" aria-controls="higher-school-student" role="tab" data-toggle="tab">Higher School Student</a></li> | |
21 | + <li role="presentation"><a href="#public-library" aria-controls="public-library" role="tab" data-toggle="tab">Public Library</a></li> | |
22 | + <li role="presentation"><a href="#academic-library" aria-controls="academic-library" role="tab" data-toggle="tab">Academic Library</a></li> | |
23 | + </ul> | |
24 | + | |
25 | + <!-- Tab panes --> | |
26 | + <div class="tab-content"> | |
27 | + <!--first-table--> | |
28 | + <div role="tabpanel" class="tab-pane active" id="higher-edu"> | |
29 | + <div class="table-responsive blue"> | |
30 | + <table class="table table-condensed table-bordered margin-btm0 table-striped table-hover"> | |
31 | + | |
32 | + <tbody> | |
33 | + <tr> | |
34 | + <th>Select</th> | |
35 | + <th>Subscription Type</th> | |
36 | + <th>Duration(in Month)</th> | |
37 | + <th>Price</th> | |
38 | + <th>Active</th> | |
39 | + </tr> | |
40 | + <tr> | |
41 | + <td><input value="" type="checkbox"></td> | |
42 | + <td contenteditable="true">A</td> | |
43 | + <td contenteditable="true">11</td> | |
44 | + <td contenteditable="true">349.95</td> | |
45 | + <td><input value="" type="checkbox" checked=""></td> | |
46 | + </tr> | |
47 | + <tr> | |
48 | + <td><input value="" type="checkbox"></td> | |
49 | + <td contenteditable="true">B</td> | |
50 | + <td contenteditable="true">23</td> | |
51 | + <td contenteditable="true">200</td> | |
52 | + <td><input value="" type="checkbox" checked=""></td> | |
53 | + </tr> | |
54 | + <tr> | |
55 | + <td><input value="" type="checkbox"></td> | |
56 | + <td contenteditable="true">1 year Single User Online Access</td> | |
57 | + <td contenteditable="true">11</td> | |
58 | + <td contenteditable="true">349.95</td> | |
59 | + <td><input value="" type="checkbox"></td> | |
60 | + </tr> | |
61 | + <tr> | |
62 | + <td><input value="" type="checkbox"></td> | |
63 | + <td contenteditable="true">1 year Single User Online Access</td> | |
64 | + <td contenteditable="true">23</td> | |
65 | + <td contenteditable="true">200</td> | |
66 | + <td><input value="" type="checkbox"></td> | |
67 | + </tr> | |
68 | + <tr> | |
69 | + <td><input value="" type="checkbox"></td> | |
70 | + <td contenteditable="true">1 year Single User Online Access</td> | |
71 | + <td contenteditable="true">11</td> | |
72 | + <td contenteditable="true">349.95</td> | |
73 | + <td><input value="" type="checkbox"></td> | |
74 | + </tr> | |
75 | + <tr> | |
76 | + <td><input value="" type="checkbox" checked=""></td> | |
77 | + <td contenteditable="true">1 year Single User Online Access</td> | |
78 | + <td contenteditable="true">23</td> | |
79 | + <td contenteditable="true">200</td> | |
80 | + <td><input value="" type="checkbox"></td> | |
81 | + </tr> | |
82 | + <tr> | |
83 | + <td><input value="" type="checkbox"></td> | |
84 | + <td contenteditable="true">1 year Single User Online Access</td> | |
85 | + <td contenteditable="true">1</td> | |
86 | + <td contenteditable="true">349.95</td> | |
87 | + <td><input value="" type="checkbox"></td> | |
88 | + </tr> | |
89 | + <tr> | |
90 | + <td><input value="" type="checkbox"></td> | |
91 | + <td contenteditable="true">1 year Single User Online Access</td> | |
92 | + <td contenteditable="true">23</td> | |
93 | + <td contenteditable="true">200</td> | |
94 | + <td><input value="" type="checkbox" checked=""></td> | |
95 | + </tr> | |
96 | + <tr> | |
97 | + <td><input value="" type="checkbox" checked=""></td> | |
98 | + <td contenteditable="true">1 year Single User Online Access</td> | |
99 | + <td contenteditable="true">11</td> | |
100 | + <td contenteditable="true">349.95</td> | |
101 | + <td><input value="" type="checkbox"></td> | |
102 | + </tr> | |
103 | + <tr> | |
104 | + <td><input value="" type="checkbox"></td> | |
105 | + <td contenteditable="true">1 year Single User Online Access</td> | |
106 | + <td contenteditable="true">23</td> | |
107 | + <td contenteditable="true">200</td> | |
108 | + <td><input value="" type="checkbox"></td> | |
109 | + </tr> | |
110 | + <tr> | |
111 | + <td><input value="" type="checkbox" checked=""></td> | |
112 | + <td contenteditable="true">1 year Single User Online Access</td> | |
113 | + <td contenteditable="true">11</td> | |
114 | + <td contenteditable="true">349.95</td> | |
115 | + <td><input value="" type="checkbox"></td> | |
116 | + </tr> | |
117 | + <tr> | |
118 | + <td><input value="" type="checkbox"></td> | |
119 | + <td contenteditable="true">1 year Single User Online Access</td> | |
120 | + <td contenteditable="true">23</td> | |
121 | + <td contenteditable="true">200</td> | |
122 | + <td><input value="" type="checkbox"></td> | |
123 | + </tr> | |
124 | + </tbody> | |
125 | + </table> | |
126 | + </div> | |
127 | + </div> | |
128 | + <!--first-table--> | |
129 | + | |
130 | + <!--second-table--> | |
131 | + <div role="tabpanel" class="tab-pane" id="higher-school"> | |
132 | + <div class="table-responsive blue"> | |
133 | + <table class="table table-condensed table-bordered margin-btm0 table-striped table-hover"> | |
134 | + <tbody> | |
135 | + <tr> | |
136 | + <th>Select</th> | |
137 | + <th>Subscription Type</th> | |
138 | + <th>Duration(in Month)</th> | |
139 | + <th>Price</th> | |
140 | + <th>Active</th> | |
141 | + </tr> | |
142 | + <tr> | |
143 | + <td><input value="" type="checkbox"></td> | |
144 | + <td contenteditable="true">A</td> | |
145 | + <td contenteditable="true">11</td> | |
146 | + <td contenteditable="true">349.95</td> | |
147 | + <td><input value="" type="checkbox" checked=""></td> | |
148 | + </tr> | |
149 | + <tr> | |
150 | + <td><input value="" type="checkbox"></td> | |
151 | + <td contenteditable="true">B</td> | |
152 | + <td contenteditable="true">23</td> | |
153 | + <td contenteditable="true">200</td> | |
154 | + <td><input value="" type="checkbox" checked=""></td> | |
155 | + </tr> | |
156 | + <tr> | |
157 | + <td><input value="" type="checkbox"></td> | |
158 | + <td contenteditable="true">1 year Single User Online Access</td> | |
159 | + <td contenteditable="true">11</td> | |
160 | + <td contenteditable="true">349.95</td> | |
161 | + <td><input value="" type="checkbox"></td> | |
162 | + </tr> | |
163 | + <tr> | |
164 | + <td><input value="" type="checkbox"></td> | |
165 | + <td contenteditable="true">1 year Single User Online Access</td> | |
166 | + <td contenteditable="true">23</td> | |
167 | + <td contenteditable="true">200</td> | |
168 | + <td><input value="" type="checkbox"></td> | |
169 | + </tr> | |
170 | + <tr> | |
171 | + <td><input value="" type="checkbox"></td> | |
172 | + <td contenteditable="true">1 year Single User Online Access</td> | |
173 | + <td contenteditable="true">11</td> | |
174 | + <td contenteditable="true">349.95</td> | |
175 | + <td><input value="" type="checkbox"></td> | |
176 | + </tr> | |
177 | + <tr> | |
178 | + <td><input value="" type="checkbox" checked=""></td> | |
179 | + <td contenteditable="true">1 year Single User Online Access</td> | |
180 | + <td contenteditable="true">23</td> | |
181 | + <td contenteditable="true">200</td> | |
182 | + <td><input value="" type="checkbox"></td> | |
183 | + </tr> | |
184 | + <tr> | |
185 | + <td><input value="" type="checkbox"></td> | |
186 | + <td contenteditable="true">1 year Single User Online Access</td> | |
187 | + <td contenteditable="true">1</td> | |
188 | + <td contenteditable="true">349.95</td> | |
189 | + <td><input value="" type="checkbox"></td> | |
190 | + </tr> | |
191 | + <tr> | |
192 | + <td><input value="" type="checkbox"></td> | |
193 | + <td contenteditable="true">1 year Single User Online Access</td> | |
194 | + <td contenteditable="true">23</td> | |
195 | + <td contenteditable="true">200</td> | |
196 | + <td><input value="" type="checkbox" checked=""></td> | |
197 | + </tr> | |
198 | + </tbody> | |
199 | + </table> | |
200 | + </div> | |
201 | + </div> | |
202 | + <!--second-table--> | |
203 | + | |
204 | + <!--third-table--> | |
205 | + <div role="tabpanel" class="tab-pane" id="higher-student"> | |
206 | + <div class="table-responsive blue"> | |
207 | + <table class="table table-condensed table-bordered margin-btm0 table-striped table-hover"> | |
208 | + | |
209 | + <tbody> | |
210 | + <tr> | |
211 | + <th>Select</th> | |
212 | + <th>Subscription Type</th> | |
213 | + <th>Duration(in Month)</th> | |
214 | + <th>Price</th> | |
215 | + <th>Active</th> | |
216 | + </tr> | |
217 | + <tr> | |
218 | + <td><input value="" type="checkbox"></td> | |
219 | + <td contenteditable="true">A</td> | |
220 | + <td contenteditable="true">11</td> | |
221 | + <td contenteditable="true">349.95</td> | |
222 | + <td><input value="" type="checkbox" checked=""></td> | |
223 | + </tr> | |
224 | + <tr> | |
225 | + <td><input value="" type="checkbox"></td> | |
226 | + <td contenteditable="true">B</td> | |
227 | + <td contenteditable="true">23</td> | |
228 | + <td contenteditable="true">200</td> | |
229 | + <td><input value="" type="checkbox" checked=""></td> | |
230 | + </tr> | |
231 | + <tr> | |
232 | + <td><input value="" type="checkbox"></td> | |
233 | + <td contenteditable="true">1 year Single User Online Access</td> | |
234 | + <td contenteditable="true">11</td> | |
235 | + <td contenteditable="true">349.95</td> | |
236 | + <td><input value="" type="checkbox"></td> | |
237 | + </tr> | |
238 | + <tr> | |
239 | + <td><input value="" type="checkbox"></td> | |
240 | + <td contenteditable="true">1 year Single User Online Access</td> | |
241 | + <td contenteditable="true">23</td> | |
242 | + <td contenteditable="true">200</td> | |
243 | + <td><input value="" type="checkbox"></td> | |
244 | + </tr> | |
245 | + <tr> | |
246 | + <td><input value="" type="checkbox"></td> | |
247 | + <td contenteditable="true">1 year Single User Online Access</td> | |
248 | + <td contenteditable="true">11</td> | |
249 | + <td contenteditable="true">349.95</td> | |
250 | + <td><input value="" type="checkbox"></td> | |
251 | + </tr> | |
252 | + <tr> | |
253 | + <td><input value="" type="checkbox" checked=""></td> | |
254 | + <td contenteditable="true">1 year Single User Online Access</td> | |
255 | + <td contenteditable="true">23</td> | |
256 | + <td contenteditable="true">200</td> | |
257 | + <td><input value="" type="checkbox"></td> | |
258 | + </tr> | |
259 | + <tr> | |
260 | + <td><input value="" type="checkbox"></td> | |
261 | + <td contenteditable="true">1 year Single User Online Access</td> | |
262 | + <td contenteditable="true">1</td> | |
263 | + <td contenteditable="true">349.95</td> | |
264 | + <td><input value="" type="checkbox"></td> | |
265 | + </tr> | |
266 | + <tr> | |
267 | + <td><input value="" type="checkbox"></td> | |
268 | + <td contenteditable="true">1 year Single User Online Access</td> | |
269 | + <td contenteditable="true">23</td> | |
270 | + <td contenteditable="true">200</td> | |
271 | + <td><input value="" type="checkbox" checked=""></td> | |
272 | + </tr> | |
273 | + <tr> | |
274 | + <td><input value="" type="checkbox" checked=""></td> | |
275 | + <td contenteditable="true">1 year Single User Online Access</td> | |
276 | + <td contenteditable="true">11</td> | |
277 | + <td contenteditable="true">349.95</td> | |
278 | + <td><input value="" type="checkbox"></td> | |
279 | + </tr> | |
280 | + <tr> | |
281 | + <td><input value="" type="checkbox"></td> | |
282 | + <td contenteditable="true">1 year Single User Online Access</td> | |
283 | + <td contenteditable="true">23</td> | |
284 | + <td contenteditable="true">200</td> | |
285 | + <td><input value="" type="checkbox"></td> | |
286 | + </tr> | |
287 | + <tr> | |
288 | + <td><input value="" type="checkbox" checked=""></td> | |
289 | + <td contenteditable="true">1 year Single User Online Access</td> | |
290 | + <td contenteditable="true">11</td> | |
291 | + <td contenteditable="true">349.95</td> | |
292 | + <td><input value="" type="checkbox"></td> | |
293 | + </tr> | |
294 | + <tr> | |
295 | + <td><input value="" type="checkbox"></td> | |
296 | + <td contenteditable="true">1 year Single User Online Access</td> | |
297 | + <td contenteditable="true">23</td> | |
298 | + <td contenteditable="true">200</td> | |
299 | + <td><input value="" type="checkbox"></td> | |
300 | + </tr> | |
301 | + </tbody> | |
302 | + </table> | |
303 | + </div> | |
304 | + </div> | |
305 | + <!--third-table--> | |
306 | + | |
307 | + <!--fourth-table--> | |
308 | + <div role="tabpanel" class="tab-pane" id="higher-school-student"> | |
309 | + <div class="table-responsive blue"> | |
310 | + <table class="table table-condensed table-bordered margin-btm0 table-striped table-hover"> | |
311 | + <tbody> | |
312 | + <tr> | |
313 | + <th>Select</th> | |
314 | + <th>Subscription Type</th> | |
315 | + <th>Duration(in Month)</th> | |
316 | + <th>Price</th> | |
317 | + <th>Active</th> | |
318 | + </tr> | |
319 | + <tr> | |
320 | + <td><input value="" type="checkbox"></td> | |
321 | + <td contenteditable="true">A</td> | |
322 | + <td contenteditable="true">11</td> | |
323 | + <td contenteditable="true">349.95</td> | |
324 | + <td><input value="" type="checkbox" checked=""></td> | |
325 | + </tr> | |
326 | + <tr> | |
327 | + <td><input value="" type="checkbox"></td> | |
328 | + <td contenteditable="true">B</td> | |
329 | + <td contenteditable="true">23</td> | |
330 | + <td contenteditable="true">200</td> | |
331 | + <td><input value="" type="checkbox" checked=""></td> | |
332 | + </tr> | |
333 | + <tr> | |
334 | + <td><input value="" type="checkbox"></td> | |
335 | + <td contenteditable="true">1 year Single User Online Access</td> | |
336 | + <td contenteditable="true">11</td> | |
337 | + <td contenteditable="true">349.95</td> | |
338 | + <td><input value="" type="checkbox"></td> | |
339 | + </tr> | |
340 | + <tr> | |
341 | + <td><input value="" type="checkbox"></td> | |
342 | + <td contenteditable="true">1 year Single User Online Access</td> | |
343 | + <td contenteditable="true">23</td> | |
344 | + <td contenteditable="true">200</td> | |
345 | + <td><input value="" type="checkbox"></td> | |
346 | + </tr> | |
347 | + <tr> | |
348 | + <td><input value="" type="checkbox"></td> | |
349 | + <td contenteditable="true">1 year Single User Online Access</td> | |
350 | + <td contenteditable="true">11</td> | |
351 | + <td contenteditable="true">349.95</td> | |
352 | + <td><input value="" type="checkbox"></td> | |
353 | + </tr> | |
354 | + <tr> | |
355 | + <td><input value="" type="checkbox" checked=""></td> | |
356 | + <td contenteditable="true">1 year Single User Online Access</td> | |
357 | + <td contenteditable="true">23</td> | |
358 | + <td contenteditable="true">200</td> | |
359 | + <td><input value="" type="checkbox"></td> | |
360 | + </tr> | |
361 | + <tr> | |
362 | + <td><input value="" type="checkbox"></td> | |
363 | + <td contenteditable="true">1 year Single User Online Access</td> | |
364 | + <td contenteditable="true">1</td> | |
365 | + <td contenteditable="true">349.95</td> | |
366 | + <td><input value="" type="checkbox"></td> | |
367 | + </tr> | |
368 | + <tr> | |
369 | + <td><input value="" type="checkbox"></td> | |
370 | + <td contenteditable="true">1 year Single User Online Access</td> | |
371 | + <td contenteditable="true">23</td> | |
372 | + <td contenteditable="true">200</td> | |
373 | + <td><input value="" type="checkbox" checked=""></td> | |
374 | + </tr> | |
375 | + </tbody> | |
376 | + </table> | |
377 | + </div> | |
378 | + </div> | |
379 | + <!--fourth-table--> | |
380 | + | |
381 | + <!--fifth-table--> | |
382 | + <div role="tabpanel" class="tab-pane" id="public-library"> | |
383 | + <div class="table-responsive blue"> | |
384 | + <table class="table table-condensed table-bordered margin-btm0 table-striped table-hover"> | |
385 | + | |
386 | + <tbody> | |
387 | + <tr> | |
388 | + <th>Select</th> | |
389 | + <th>Subscription Type</th> | |
390 | + <th>Duration(in Month)</th> | |
391 | + <th>Price</th> | |
392 | + <th>Active</th> | |
393 | + </tr> | |
394 | + <tr> | |
395 | + <td><input value="" type="checkbox"></td> | |
396 | + <td contenteditable="true">A</td> | |
397 | + <td contenteditable="true">11</td> | |
398 | + <td contenteditable="true">349.95</td> | |
399 | + <td><input value="" type="checkbox" checked=""></td> | |
400 | + </tr> | |
401 | + <tr> | |
402 | + <td><input value="" type="checkbox"></td> | |
403 | + <td contenteditable="true">B</td> | |
404 | + <td contenteditable="true">23</td> | |
405 | + <td contenteditable="true">200</td> | |
406 | + <td><input value="" type="checkbox" checked=""></td> | |
407 | + </tr> | |
408 | + <tr> | |
409 | + <td><input value="" type="checkbox"></td> | |
410 | + <td contenteditable="true">1 year Single User Online Access</td> | |
411 | + <td contenteditable="true">11</td> | |
412 | + <td contenteditable="true">349.95</td> | |
413 | + <td><input value="" type="checkbox"></td> | |
414 | + </tr> | |
415 | + <tr> | |
416 | + <td><input value="" type="checkbox"></td> | |
417 | + <td contenteditable="true">1 year Single User Online Access</td> | |
418 | + <td contenteditable="true">23</td> | |
419 | + <td contenteditable="true">200</td> | |
420 | + <td><input value="" type="checkbox"></td> | |
421 | + </tr> | |
422 | + <tr> | |
423 | + <td><input value="" type="checkbox"></td> | |
424 | + <td contenteditable="true">1 year Single User Online Access</td> | |
425 | + <td contenteditable="true">11</td> | |
426 | + <td contenteditable="true">349.95</td> | |
427 | + <td><input value="" type="checkbox"></td> | |
428 | + </tr> | |
429 | + <tr> | |
430 | + <td><input value="" type="checkbox" checked=""></td> | |
431 | + <td contenteditable="true">1 year Single User Online Access</td> | |
432 | + <td contenteditable="true">23</td> | |
433 | + <td contenteditable="true">200</td> | |
434 | + <td><input value="" type="checkbox"></td> | |
435 | + </tr> | |
436 | + <tr> | |
437 | + <td><input value="" type="checkbox"></td> | |
438 | + <td contenteditable="true">1 year Single User Online Access</td> | |
439 | + <td contenteditable="true">1</td> | |
440 | + <td contenteditable="true">349.95</td> | |
441 | + <td><input value="" type="checkbox"></td> | |
442 | + </tr> | |
443 | + <tr> | |
444 | + <td><input value="" type="checkbox"></td> | |
445 | + <td contenteditable="true">1 year Single User Online Access</td> | |
446 | + <td contenteditable="true">23</td> | |
447 | + <td contenteditable="true">200</td> | |
448 | + <td><input value="" type="checkbox" checked=""></td> | |
449 | + </tr> | |
450 | + <tr> | |
451 | + <td><input value="" type="checkbox" checked=""></td> | |
452 | + <td contenteditable="true">1 year Single User Online Access</td> | |
453 | + <td contenteditable="true">11</td> | |
454 | + <td contenteditable="true">349.95</td> | |
455 | + <td><input value="" type="checkbox"></td> | |
456 | + </tr> | |
457 | + <tr> | |
458 | + <td><input value="" type="checkbox"></td> | |
459 | + <td contenteditable="true">1 year Single User Online Access</td> | |
460 | + <td contenteditable="true">23</td> | |
461 | + <td contenteditable="true">200</td> | |
462 | + <td><input value="" type="checkbox"></td> | |
463 | + </tr> | |
464 | + <tr> | |
465 | + <td><input value="" type="checkbox" checked=""></td> | |
466 | + <td contenteditable="true">1 year Single User Online Access</td> | |
467 | + <td contenteditable="true">11</td> | |
468 | + <td contenteditable="true">349.95</td> | |
469 | + <td><input value="" type="checkbox"></td> | |
470 | + </tr> | |
471 | + <tr> | |
472 | + <td><input value="" type="checkbox"></td> | |
473 | + <td contenteditable="true">1 year Single User Online Access</td> | |
474 | + <td contenteditable="true">23</td> | |
475 | + <td contenteditable="true">200</td> | |
476 | + <td><input value="" type="checkbox"></td> | |
477 | + </tr> | |
478 | + </tbody> | |
479 | + </table> | |
480 | + </div> | |
481 | + </div> | |
482 | + <!--fifth-table--> | |
483 | + | |
484 | + <!--sixth-table--> | |
485 | + <div role="tabpanel" class="tab-pane" id="academic-library"> | |
486 | + <div class="table-responsive blue"> | |
487 | + <table class="table table-condensed table-bordered margin-btm0 table-striped table-hover"> | |
488 | + <tbody> | |
489 | + <tr> | |
490 | + <th>Select</th> | |
491 | + <th>Subscription Type</th> | |
492 | + <th>Duration(in Month)</th> | |
493 | + <th>Price</th> | |
494 | + <th>Active</th> | |
495 | + </tr> | |
496 | + <tr> | |
497 | + <td><input value="" type="checkbox"></td> | |
498 | + <td contenteditable="true">A</td> | |
499 | + <td contenteditable="true">11</td> | |
500 | + <td contenteditable="true">349.95</td> | |
501 | + <td><input value="" type="checkbox" checked=""></td> | |
502 | + </tr> | |
503 | + <tr> | |
504 | + <td><input value="" type="checkbox"></td> | |
505 | + <td contenteditable="true">B</td> | |
506 | + <td contenteditable="true">23</td> | |
507 | + <td contenteditable="true">200</td> | |
508 | + <td><input value="" type="checkbox" checked=""></td> | |
509 | + </tr> | |
510 | + <tr> | |
511 | + <td><input value="" type="checkbox"></td> | |
512 | + <td contenteditable="true">1 year Single User Online Access</td> | |
513 | + <td contenteditable="true">11</td> | |
514 | + <td contenteditable="true">349.95</td> | |
515 | + <td><input value="" type="checkbox"></td> | |
516 | + </tr> | |
517 | + <tr> | |
518 | + <td><input value="" type="checkbox"></td> | |
519 | + <td contenteditable="true">1 year Single User Online Access</td> | |
520 | + <td contenteditable="true">23</td> | |
521 | + <td contenteditable="true">200</td> | |
522 | + <td><input value="" type="checkbox"></td> | |
523 | + </tr> | |
524 | + <tr> | |
525 | + <td><input value="" type="checkbox"></td> | |
526 | + <td contenteditable="true">1 year Single User Online Access</td> | |
527 | + <td contenteditable="true">11</td> | |
528 | + <td contenteditable="true">349.95</td> | |
529 | + <td><input value="" type="checkbox"></td> | |
530 | + </tr> | |
531 | + <tr> | |
532 | + <td><input value="" type="checkbox" checked=""></td> | |
533 | + <td contenteditable="true">1 year Single User Online Access</td> | |
534 | + <td contenteditable="true">23</td> | |
535 | + <td contenteditable="true">200</td> | |
536 | + <td><input value="" type="checkbox"></td> | |
537 | + </tr> | |
538 | + <tr> | |
539 | + <td><input value="" type="checkbox"></td> | |
540 | + <td contenteditable="true">1 year Single User Online Access</td> | |
541 | + <td contenteditable="true">1</td> | |
542 | + <td contenteditable="true">349.95</td> | |
543 | + <td><input value="" type="checkbox"></td> | |
544 | + </tr> | |
545 | + <tr> | |
546 | + <td><input value="" type="checkbox"></td> | |
547 | + <td contenteditable="true">1 year Single User Online Access</td> | |
548 | + <td contenteditable="true">23</td> | |
549 | + <td contenteditable="true">200</td> | |
550 | + <td><input value="" type="checkbox" checked=""></td> | |
551 | + </tr> | |
552 | + </tbody> | |
553 | + </table> | |
554 | + </div> | |
555 | + </div> | |
556 | + <!--sixth-table--> | |
557 | + | |
558 | + <div class="row"> | |
559 | + <div class="col-sm-12 marginTop20 text-center"> | |
560 | + <button class="btn btn-primary btn-sm"><i class="fa fa-plus-circle"></i> Add</button> | |
561 | + <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mymodal"><i class="fa fa-trash"></i> Delete</button> | |
562 | + <!--modal--> | |
563 | + <div class="modal fade bs-example-modal-sm text-left" tabindex="-1" role="dialog" id="mymodal"> | |
564 | + <div class="modal-dialog modal-sm" role="document"> | |
565 | + <div class="modal-content"> | |
566 | + <div class="modal-header annotation-modal-header ui-draggable-handle"> | |
567 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
568 | + <h4 class="modal-title" id="">Alert</h4> | |
569 | + </div> | |
570 | + <div class="modal-body"> | |
571 | + <h5>Please select subscription to delete.</h5> | |
572 | + </div> | |
573 | + <div class="modal-footer"> | |
574 | + <div class="row"> | |
575 | + <div class="col-sm-12"><button class="btn btn-primary btn-sm">Ok</button></div> | |
576 | + </div> | |
577 | + </div> | |
578 | + | |
579 | + </div> | |
580 | + <!-- /.modal-content --> | |
581 | + </div> | |
582 | + <!-- /.modal-dialog --> | |
583 | + </div> | |
584 | + <!-- /.modal --> | |
585 | + <!--modal--> | |
586 | + <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mymodal1"><i class="fa fa-check"></i> Apply</button> | |
587 | + <!--modal--> | |
588 | + <div class="modal fade bs-example-modal-sm text-left" tabindex="-1" role="dialog" id="mymodal1"> | |
589 | + <div class="modal-dialog modal-sm" role="document"> | |
590 | + <div class="modal-content"> | |
591 | + <div class="modal-header annotation-modal-header ui-draggable-handle"> | |
592 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
593 | + <h4 class="modal-title" id="">Alert</h4> | |
594 | + </div> | |
595 | + <div class="modal-body"> | |
596 | + <h5>Subscription type is required.</h5> | |
597 | + </div> | |
598 | + <div class="modal-footer"> | |
599 | + <div class="row"> | |
600 | + <div class="col-sm-12"><button class="btn btn-primary btn-sm">Ok</button></div> | |
601 | + </div> | |
602 | + </div> | |
603 | + | |
604 | + </div> | |
605 | + <!-- /.modal-content --> | |
606 | + </div> | |
607 | + <!-- /.modal-dialog --> | |
608 | + </div> | |
609 | + <!-- /.modal --> | |
610 | + <!--modal--> | |
611 | + <button class="btn btn-primary btn-sm"><i class="fa fa-close"></i> Cancel</button> | |
612 | + </div> | |
613 | + </div> | |
614 | + </div> | |
615 | + </div> | |
616 | + <!--tab-content--> | |
617 | + </div> | |
618 | + </div> | |
619 | + | |
620 | + </div> | |
621 | + </div> | |
622 | + | |
623 | + <!-- container --> | |
624 | +</div> | |
0 | 625 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/SubscriptionPrice/subscriptionprice.component.ts
0 → 100644
1 | +import { Component, OnInit, AfterViewInit, Input, Output, EventEmitter } from '@angular/core'; | |
2 | +import { SubscriptionPriceService } from './subscriptionprice.service'; | |
3 | +import { Router } from '@angular/router'; | |
4 | +import { FormControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; | |
5 | +import { SubscriptionPriceModel } from '../UpdateProfile/datamodel'; | |
6 | +import { BsDatepickerModule } from 'ngx-bootstrap'; | |
7 | +import { Http, Response } from '@angular/http'; | |
8 | +import { Pipe, PipeTransform } from '@angular/core'; | |
9 | +import { DatePipe } from '@angular/common'; | |
10 | + | |
11 | +//import { Global } from '../../Shared/global'; | |
12 | +//import { DBOperation } from 'S'; | |
13 | +//import { Observable } from 'rxjs/Observable'; | |
14 | + | |
15 | +@Component({ | |
16 | + templateUrl: './subscriptionprice.component.html' | |
17 | +}) | |
18 | + | |
19 | +export class SubscriptionPrice implements OnInit { | |
20 | + | |
21 | +Mode: string = 'Manage'; | |
22 | +subscriptionPrice: SubscriptionPriceModel; | |
23 | +subscriptionPrices: Array<SubscriptionPriceModel>; | |
24 | +subscriptionPriceFrm: FormGroup; | |
25 | +insertUpdateSubscriptionPriceFrm: FormGroup; | |
26 | +error: any; | |
27 | +alerts: string; | |
28 | +divClass: string = ''; | |
29 | +topPos: string = '2000px'; | |
30 | +selectedRow: number = 0; | |
31 | +datePipe: DatePipe = new DatePipe('en-US'); | |
32 | +bsValue3: Date = new Date(); | |
33 | +bsValue4: Date = new Date(); | |
34 | +selectedId: number = 0; | |
35 | + | |
36 | +constructor(private subscriptionPriceService: SubscriptionPriceService, private router: Router, private fb: FormBuilder) { } | |
37 | + | |
38 | + ngOnInit(): void { | |
39 | + this.divClass = 'col-sm-12'; | |
40 | + this.subscriptionPrice = new SubscriptionPriceModel(); | |
41 | + this.alerts = ''; | |
42 | + this.subscriptionPriceFrm = this.fb.group({ | |
43 | + searchSubscriptionPriceType: [''], | |
44 | + subscriptionPrices: this.fb.array([]) | |
45 | + }); | |
46 | + this.insertUpdateSubscriptionPriceFrm = this.fb.group({ | |
47 | + discountId: [''], | |
48 | + discountCode: [''], | |
49 | + startDate: ['', Validators.required], | |
50 | + endDate: ['', Validators.required], | |
51 | + percentage: ['', [Validators.required, Validators.pattern('[0-9.]*')]], | |
52 | + isActive: [true] | |
53 | + }); | |
54 | + this.SearchSubscriptionPrices(); | |
55 | + } | |
56 | + | |
57 | + public SetClickedRow(i: number, item: any) { | |
58 | + this.selectedRow = i; | |
59 | + this.selectedId = item['Id']; | |
60 | + this.subscriptionPrice = item; | |
61 | + } | |
62 | + | |
63 | + public SearchSubscriptionPrices() { | |
64 | + this.selectedRow = -1; | |
65 | + this.subscriptionPriceService.GetSubscriptionPrices( | |
66 | + { | |
67 | + subscriptionPriceType: this.subscriptionPriceFrm.controls['searchSubscriptionPriceType'].value, | |
68 | + }) | |
69 | + .subscribe(x => { this.BindFormFields(x) }, error => this.error = error); | |
70 | + } | |
71 | + | |
72 | + public InsertUpdateSubscriptionPrice() { | |
73 | + console.log('InsertUpdateSubscriptionPrice'); | |
74 | + this.alerts = ''; | |
75 | + if(parseInt(this.insertUpdateSubscriptionPriceFrm.value.percentage) > 100){ | |
76 | + this.alerts = '<span>Percentage must be between 0 to 100</span>'; | |
77 | + } | |
78 | + if(this.alerts == ''){ | |
79 | + var obj = this.insertUpdateSubscriptionPriceFrm.value; | |
80 | + if(obj.discountId == 0){ | |
81 | + return this.subscriptionPriceService.InsertDiscountCode(obj) | |
82 | + .subscribe( | |
83 | + n => (this.AfterInsertData(n)), | |
84 | + error => this.error = <any>error); | |
85 | + } | |
86 | + else{ | |
87 | + return this.subscriptionPriceService.UpdateDiscountCode(obj) | |
88 | + .subscribe( | |
89 | + n => (this.AfterUpdateData(n)), | |
90 | + error => this.error = <any>error); | |
91 | + } | |
92 | + } | |
93 | + } | |
94 | + | |
95 | + AfterInsertData(data) { | |
96 | + if (data.Status == "false") { | |
97 | + this.alerts = "<span>Subscription price save unsuccessfull</span>"; | |
98 | + } else { | |
99 | + this.alerts = "<span>Subscription price saved successfully</span>"; | |
100 | + } | |
101 | + } | |
102 | + | |
103 | + AfterUpdateData(data) { | |
104 | + if (data.Status == "false") { | |
105 | + this.alerts = "<span>Subscription price update unsuccessfull</span>"; | |
106 | + } else { | |
107 | + this.alerts = "<span>Subscription price updated successfully</span>"; | |
108 | + } | |
109 | + } | |
110 | + | |
111 | + BindFormFields(data){ | |
112 | + this.subscriptionPrices = data; | |
113 | + this.subscriptionPriceFrm.setControl('subscriptionPrices', this.fb.array(this.subscriptionPrices)); | |
114 | + } | |
115 | + | |
116 | + AddDiscountCode(){ | |
117 | + this.Mode = 'Add'; | |
118 | + this.topPos = '100px'; | |
119 | + this.divClass = 'col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3'; | |
120 | + this.insertUpdateSubscriptionPriceFrm.reset(); | |
121 | + this.alerts = ''; | |
122 | + this.insertUpdateSubscriptionPriceFrm.controls['discountId'].setValue(0); | |
123 | + this.insertUpdateSubscriptionPriceFrm.controls['discountCode'].setValue(''); | |
124 | + this.insertUpdateSubscriptionPriceFrm.controls['startDate'].setValue(''); | |
125 | + this.insertUpdateSubscriptionPriceFrm.controls['endDate'].setValue(''); | |
126 | + this.insertUpdateSubscriptionPriceFrm.controls['percentage'].setValue(''); | |
127 | + this.insertUpdateSubscriptionPriceFrm.controls['isActive'].setValue(true); | |
128 | + } | |
129 | + | |
130 | + EditDiscountCode(){ | |
131 | + this.Mode = 'Edit'; | |
132 | + this.topPos = '100px'; | |
133 | + this.divClass = 'col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3'; | |
134 | + this.alerts = ''; | |
135 | + this.insertUpdateSubscriptionPriceFrm.controls['discountId'].setValue(this.subscriptionPrice.Id); | |
136 | + this.insertUpdateSubscriptionPriceFrm.controls['discountCode'].setValue(this.subscriptionPrice.DiscountCode); | |
137 | + this.insertUpdateSubscriptionPriceFrm.controls['startDate'].setValue(this.datePipe.transform(this.subscriptionPrice.StartDate, 'MM/dd/yyyy')); | |
138 | + this.insertUpdateSubscriptionPriceFrm.controls['endDate'].setValue(this.datePipe.transform(this.subscriptionPrice.EndDate, 'MM/dd/yyyy')); | |
139 | + this.insertUpdateSubscriptionPriceFrm.controls['percentage'].setValue(this.subscriptionPrice.Percentage); | |
140 | + this.insertUpdateSubscriptionPriceFrm.controls['isActive'].setValue(this.subscriptionPrice.IsActive); | |
141 | + } | |
142 | + | |
143 | + CancelAddEdit(){ | |
144 | + this.Mode = 'Manage'; | |
145 | + this.topPos = '2000px'; | |
146 | + this.divClass = 'col-sm-12'; | |
147 | + this.SearchSubscriptionPrices(); | |
148 | + this.selectedRow = this.subscriptionPrices.findIndex(C => C.Id == this.selectedId); | |
149 | + this.SetClickedRow(this.selectedRow, this.subscriptionPriceFrm.controls['subscriptionPrices'].value.find(C => C.Id == this.selectedId)); | |
150 | + } | |
151 | +} | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/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 | + //public GetUserById(Id: any): Observable<User> { | |
17 | + // return this.http.request<User>( | |
18 | + // 'GET', | |
19 | + // 'http://192.168.86.13:92/API/Api/Users/' + Id); | |
20 | + //} | |
21 | + | |
22 | + //GetUserByLoginIdPassword(LoginId: string, Password: string): Observable<User> { | |
23 | + // return this.http.request<User>( | |
24 | + // 'GET', | |
25 | + // 'http://192.168.86.13:92/API/Api/Users/{LoginId=' + LoginId + '&Password=' + Password + '}'); | |
26 | + //} | |
27 | + | |
28 | + //UpdateProfile(UserObj: User): Observable<any> { | |
29 | + // return this.http.request<any>( | |
30 | + // 'POST', | |
31 | + // 'http://192.168.86.13:92/API/Api/Users/UpdateProfile', | |
32 | + // { | |
33 | + // body: UserObj | |
34 | + // }); | |
35 | + //} | |
36 | + | |
37 | + GetSubscriptionPrices(obj: any) { | |
38 | + return this.http.get(this.commonService.resourceBaseUrl + "/api/GetSubscriptionPrices?editionId=" | |
39 | + + obj.editionId + "&duration=" + obj.duration) | |
40 | + .map(this.extractData) | |
41 | + .catch((res: Response) => this.handleError(res)); | |
42 | + } | |
43 | + | |
44 | + InsertSubscriptionPrice(obj: any) { | |
45 | + //let options = new RequestOptions({ headers: this.headers }); | |
46 | + var jsonData = {'id': obj.discountId, 'discountCode': obj.discountCode, 'startDate': obj.startDate, 'endDate': obj.endDate, 'percentage': obj.percentage, 'isActive': obj.isActive }; | |
47 | + console.log(obj); | |
48 | + var headers = new Headers({ | |
49 | + 'Content-Type': 'application/json' | |
50 | + }); | |
51 | + return this.http.post(this.commonService.resourceBaseUrl + "/api/InsertSubscriptionPrice", | |
52 | + JSON.stringify(jsonData), {headers: headers}) | |
53 | + .map(this.extractData) | |
54 | + .catch((res: Response) => this.handleError(res)); | |
55 | + } | |
56 | + | |
57 | + UpdateSubscriptionPrice(obj: any) { | |
58 | + //let options = new RequestOptions({ headers: this.headers }); | |
59 | + var jsonData = {'id': obj.discountId, 'discountCode': obj.discountCode, 'startDate': obj.startDate, 'endDate': obj.endDate, 'percentage': obj.percentage, 'isActive': obj.isActive }; | |
60 | + console.log(obj); | |
61 | + var headers = new Headers({ | |
62 | + 'Content-Type': 'application/json' | |
63 | + }); | |
64 | + return this.http.post(this.commonService.resourceBaseUrl + "/api/UpdateSubscriptionPrice", | |
65 | + JSON.stringify(jsonData), {headers: headers}) | |
66 | + .map(this.extractData) | |
67 | + .catch((res: Response) => this.handleError(res)); | |
68 | + } | |
69 | + | |
70 | + extractData(res: Response) { | |
71 | + //debugger; | |
72 | + let body = res.json(); | |
73 | + return body; | |
74 | + } | |
75 | + | |
76 | + handleError(error: any) { | |
77 | + // In a real world app, we might use a remote logging infrastructure | |
78 | + // We'd also dig deeper into the error to get a better message | |
79 | + let errMsg = (error.message) ? error.message : | |
80 | + error.status ? `${error.status} - ${error.statusText}` : 'Server error'; | |
81 | + console.error(errMsg); // log to console instead | |
82 | + return Observable.throw(errMsg); | |
83 | + } | |
84 | + | |
85 | + ////public GetUserById(url: string): Observable<any> { | |
86 | + | |
87 | + //// return this._http.get(url) | |
88 | + //// .map((response: Response) => <any>response.json()) | |
89 | + //// .do(data => console.log("All: " + JSON.stringify(data))) | |
90 | + //// .catch(this.handleError); | |
91 | + ////} | |
92 | + //// private handleError(error: Response) { | |
93 | + //// console.error(error); | |
94 | + //// return Observable.throw(error.json().error || 'Server error'); | |
95 | + //// } | |
96 | + | |
97 | +} | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/components/UpdateProfile/datamodel.ts
... | ... | @@ -25,6 +25,15 @@ export class DiscountCode { |
25 | 25 | IsActive: boolean; |
26 | 26 | } |
27 | 27 | |
28 | +export class SubscriptionPriceModel { | |
29 | + Id: number; | |
30 | + Title: string; | |
31 | + Price: DoubleRange; | |
32 | + Duration: number; | |
33 | + EditionId: number; | |
34 | + IsActive: boolean; | |
35 | +} | |
36 | + | |
28 | 37 | //export class User { |
29 | 38 | // userId: number; |
30 | 39 | // firstName: string; | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/shared/enum.js deleted
1 | -"use strict"; | |
2 | -Object.defineProperty(exports, "__esModule", { value: true }); | |
3 | -var DBOperation; | |
4 | -(function (DBOperation) { | |
5 | - DBOperation[DBOperation["create"] = 1] = "create"; | |
6 | - DBOperation[DBOperation["update"] = 2] = "update"; | |
7 | - DBOperation[DBOperation["delete"] = 3] = "delete"; | |
8 | -})(DBOperation = exports.DBOperation || (exports.DBOperation = {})); | |
9 | -//# sourceMappingURL=enum.js.map | |
10 | 0 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/shared/enum.js.map deleted
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/shared/global.js deleted
1 | -"use strict"; | |
2 | -Object.defineProperty(exports, "__esModule", { value: true }); | |
3 | -var Global = (function () { | |
4 | - function Global() { | |
5 | - } | |
6 | - return Global; | |
7 | -}()); | |
8 | -Global.BASE_USER_ENDPOINT = 'api/userapi/'; | |
9 | -exports.Global = Global; | |
10 | -//# sourceMappingURL=global.js.map | |
11 | 0 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/app/shared/global.js.map deleted
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/assets/styles/admin-custom.css
... | ... | @@ -147,4 +147,14 @@ |
147 | 147 | } |
148 | 148 | .table-fixed thead { |
149 | 149 | width: calc( 100% - 0em ) |
150 | -} | |
151 | 150 | \ No newline at end of file |
151 | +} | |
152 | + | |
153 | +.table>tbody>tr.active>td { | |
154 | + background: #000; | |
155 | + color: #FDFBFB; | |
156 | + } | |
157 | + | |
158 | + .table>tbody>tr.inactive>td { | |
159 | + background: #FDFBFB; | |
160 | + color: #000; | |
161 | + } | |
152 | 162 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.Web/src/index.html
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> |
13 | 13 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,800,700,600,400italic"> |
14 | 14 | <link href="../assets/styles/bootstrap-datetimepicker.min.css" rel="stylesheet"> |
15 | + <link rel="stylesheet" href="https://unpkg.com/ngx-bootstrap/datepicker/bs-datepicker.css" | |
15 | 16 | |
16 | 17 | <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> |
17 | 18 | <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> |
... | ... | @@ -32,16 +33,27 @@ |
32 | 33 | <script src="../assets/scripts/bootstrap-datetimepicker.min.js"></script> |
33 | 34 | <!--Nav--> |
34 | 35 | <script> |
36 | + | |
35 | 37 | $(function () { |
36 | - $('#datetimepicker1, #datetimepicker2').datetimepicker({ | |
37 | - // language: 'pt-BR' | |
38 | + | |
39 | + $('#datetimepicker1').datetimepicker({ | |
40 | + //format: 'mm/dd/yyyy' | |
41 | + }); | |
42 | + $('#datetimepicker2').datetimepicker({ | |
43 | + //format: 'mm/dd/yyyy' | |
44 | + }); | |
45 | + $('#datetimepicker3').datetimepicker({ | |
46 | + //format: 'MM/dd/yyyy' | |
38 | 47 | }); |
39 | - //$('#datetimepicker1').datepicker() | |
40 | - //.on('changeDate', function(e) { | |
41 | - //$('#searchStartDate').val($('#datetimepicker1').val()); | |
48 | + $('#datetimepicker4').datetimepicker({ | |
49 | + //format: 'mm/dd/yyyy' | |
50 | + }); | |
51 | + | |
52 | + //$('#datetimepicker3').on('changeDate', function() { | |
53 | + //$('#datetimepicker3 input').val(new date()); | |
42 | 54 | //}); |
43 | - $('#searchStartDate').val($('#datetimepicker1').val()); | |
44 | - $("#slider-range-min-2").slider({ | |
55 | + | |
56 | + $("#slider-range-min-2").slider({ | |
45 | 57 | range: "min", |
46 | 58 | min: 1, |
47 | 59 | max: 60, | ... | ... |