protected void ToString(List <string> toStringOutput) { toStringOutput.Add($"Scope = {(Scope == null ? "null" : Scope.ToString())}"); toStringOutput.Add($"DiscountType = {(DiscountType == null ? "null" : DiscountType.ToString())}"); toStringOutput.Add($"PercentageDiscount = {(PercentageDiscount == null ? "null" : PercentageDiscount == string.Empty ? "" : PercentageDiscount)}"); toStringOutput.Add($"CatalogObjectIds = {(CatalogObjectIds == null ? "null" : $"[{ string.Join(", ", CatalogObjectIds)} ]")}"); toStringOutput.Add($"FixedDiscountMoney = {(FixedDiscountMoney == null ? "null" : FixedDiscountMoney.ToString())}"); toStringOutput.Add($"MaxDiscountMoney = {(MaxDiscountMoney == null ? "null" : MaxDiscountMoney.ToString())}"); }
protected void ToString(List <string> toStringOutput) { toStringOutput.Add($"Name = {(Name == null ? "null" : Name == string.Empty ? "" : Name)}"); toStringOutput.Add($"DiscountType = {(DiscountType == null ? "null" : DiscountType.ToString())}"); toStringOutput.Add($"Percentage = {(Percentage == null ? "null" : Percentage == string.Empty ? "" : Percentage)}"); toStringOutput.Add($"AmountMoney = {(AmountMoney == null ? "null" : AmountMoney.ToString())}"); toStringOutput.Add($"PinRequired = {(PinRequired == null ? "null" : PinRequired.ToString())}"); toStringOutput.Add($"LabelColor = {(LabelColor == null ? "null" : LabelColor == string.Empty ? "" : LabelColor)}"); toStringOutput.Add($"ModifyTaxBasis = {(ModifyTaxBasis == null ? "null" : ModifyTaxBasis.ToString())}"); }
internal override void WriteXml(XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("coupon"); // Start: coupon xmlWriter.WriteElementString("coupon_code", CouponCode); xmlWriter.WriteElementString("name", Name); xmlWriter.WriteElementString("hosted_description", HostedDescription); xmlWriter.WriteElementString("invoice_description", InvoiceDescription); if (RedeemByDate.HasValue) { xmlWriter.WriteElementString("redeem_by_date", RedeemByDate.Value.ToString("s")); } if (SingleUse.HasValue) { xmlWriter.WriteElementString("single_use", SingleUse.Value.AsString()); } if (AppliesForMonths.HasValue) { xmlWriter.WriteElementString("applies_for_months", AppliesForMonths.Value.AsString()); } if (AppliesToAllPlans.HasValue) { xmlWriter.WriteElementString("applies_to_all_plans", AppliesToAllPlans.Value.AsString()); } if (MaxRedemptions.HasValue) { xmlWriter.WriteElementString("max_redemptions", MaxRedemptions.Value.AsString()); } xmlWriter.WriteElementString("discount_type", DiscountType.ToString().EnumNameToTransportCase()); if (CouponDiscountType.Percent == DiscountType && DiscountPercent.HasValue) { xmlWriter.WriteElementString("discount_percent", DiscountPercent.Value.AsString()); } if (CouponDiscountType.Dollars == DiscountType) { xmlWriter.WriteIfCollectionHasAny("discount_in_cents", DiscountInCents, pair => pair.Key, pair => pair.Value.AsString()); } xmlWriter.WriteIfCollectionHasAny("plan_codes", Plans, s => "plan_code", s => s); xmlWriter.WriteEndElement(); // End: coupon }
protected void btnNextPage_Click(object sender, EventArgs e) { int intActionStatus = 0; if (changeCheckBox.Checked) { if (Page.IsValid) { intActionStatus = this.UpdateRecord_DiscountStore(); } else { // } if (intActionStatus == 0) { lblSystemMessage.Text = "Your Discount store type could not be saved."; } else if (intActionStatus > 0) { Enable_Panel(panelSaleOffer, false); changeCheckBox.Checked = false; this.DiscountStoreType(); string strQueryString = "&mode=0&CI=" + Server.UrlEncode(GetCategoryID); strQueryString += "&SUBC=" + Server.UrlEncode(GetSubCategoryID); strQueryString += "&DT=" + Server.UrlEncode(DiscountType.ToString()); Response.Redirect("DiscountProfileAE.aspx?" + strQueryString, false); } } else { string strQueryString = "&mode=0&CI=" + Server.UrlEncode(GetCategoryID); strQueryString += "&SUBC=" + Server.UrlEncode(GetSubCategoryID); strQueryString += "&DT=" + Server.UrlEncode(DiscountType.ToString()); Response.Redirect("DiscountProfileAE.aspx?" + strQueryString, false); } }
public DiscountTypeAlreadyAllowedException(DiscountType type) : base(String.Format("Discount type {0} is already allowed", type.ToString())) { }
internal override void WriteXml(XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("coupon"); // Start: coupon xmlWriter.WriteElementString("coupon_code", CouponCode); xmlWriter.WriteElementString("name", Name); xmlWriter.WriteElementString("hosted_description", HostedDescription); xmlWriter.WriteElementString("invoice_description", InvoiceDescription); if (RedeemByDate.HasValue) { xmlWriter.WriteElementString("redeem_by_date", RedeemByDate.Value.ToString("s")); } if (SingleUse.HasValue) { xmlWriter.WriteElementString("single_use", SingleUse.Value.AsString()); } if (AppliesForMonths.HasValue) { xmlWriter.WriteElementString("applies_for_months", AppliesForMonths.Value.AsString()); } if (Duration != null) { xmlWriter.WriteElementString("duration", Duration.ToString().EnumNameToTransportCase()); } if (TemporalUnit != null) { xmlWriter.WriteElementString("temporal_unit", TemporalUnit.ToString().EnumNameToTransportCase()); } if (TemporalAmount.HasValue) { xmlWriter.WriteElementString("temporal_amount", TemporalAmount.Value.ToString()); } if (AppliesToAllPlans.HasValue) { xmlWriter.WriteElementString("applies_to_all_plans", AppliesToAllPlans.Value.AsString()); } if (AppliesToNonPlanCharges.HasValue) { xmlWriter.WriteElementString("applies_to_non_plan_charges", AppliesToNonPlanCharges.Value.AsString()); } if (MaxRedemptions.HasValue) { xmlWriter.WriteElementString("max_redemptions", MaxRedemptions.Value.AsString()); } if (MaxRedemptionsPerAccount.HasValue) { xmlWriter.WriteElementString("max_redemptions_per_account", MaxRedemptionsPerAccount.Value.AsString()); } xmlWriter.WriteElementString("discount_type", DiscountType.ToString().EnumNameToTransportCase()); xmlWriter.WriteElementString("redemption_resource", RedemptionResource.ToString().EnumNameToTransportCase()); xmlWriter.WriteElementString("coupon_type", Type.ToString().EnumNameToTransportCase()); if (Type == CouponType.Bulk) { xmlWriter.WriteElementString("unique_code_template", UniqueCodeTemplate); } if (CouponDiscountType.Percent == DiscountType && DiscountPercent.HasValue) { xmlWriter.WriteElementString("discount_percent", DiscountPercent.Value.AsString()); } if (CouponDiscountType.Dollars == DiscountType) { xmlWriter.WriteIfCollectionHasAny("discount_in_cents", DiscountInCents, pair => pair.Key, pair => pair.Value.AsString()); } xmlWriter.WriteIfCollectionHasAny("plan_codes", Plans, s => "plan_code", s => s); if (FreeTrialAmount.HasValue) { xmlWriter.WriteElementString("free_trial_amount", FreeTrialAmount.Value.AsString()); } if (FreeTrialUnit.HasValue) { xmlWriter.WriteElementString("free_trial_unit", FreeTrialUnit.Value.ToString().EnumNameToTransportCase()); } xmlWriter.WriteEndElement(); // End: coupon }
public DiscountTypeNotAllowedException(DiscountType type) : base(String.Format("Discount type {0} is not allowed", type.ToString())) { }
internal static string ToApiValue(this DiscountType value) { return(value.ToString().ToUpperInvariant()); }
public async Task <ActionResult> DiscountReport(ReqDiscount ReqDiscount, string FileType) { try { string[] lines = ReqDiscount.BranchList.Split(","); Pagination pagination = new Pagination(HttpContext); string filetype = (FileType ?? "").ToLower(); DateTime DateTo = DateTime.ParseExact(ReqDiscount.DateTo, "dd/MM/yyyy", new CultureInfo("en-US")); DateTime DateFrom = DateTime.ParseExact(ReqDiscount.DateFrom, "dd/MM/yyyy", new CultureInfo("en-US")); if (filetype.Equals("excel")) { return(ExportExcelDiscountReport(ReqDiscount, DateTo, DateFrom)); } List <BranchIdList> _items = new List <BranchIdList>(); foreach (var branch in lines) { BranchIdList _b = new BranchIdList { BranchId = branch.ToString() }; _items.Add(_b); } List <DiscountTypeList> _Dis = new List <DiscountTypeList>(); foreach (var DiscountType in ReqDiscount.DiscountTypeList) { DiscountTypeList _d = new DiscountTypeList { DiscountType = DiscountType.ToString() }; _Dis.Add(_d); } ReqDiscountType DiscountTypeList = new ReqDiscountType { DateFrom = DateFrom.ToString("yyyyMMdd"), DateTo = DateTo.ToString("yyyyMMdd"), BranchIdList = _items, DiscountTypeList = _Dis }; string json = JsonConvert.SerializeObject(DiscountTypeList); SqlParameter jsonInput = new SqlParameter() { ParameterName = "@jsonreq", SqlDbType = SqlDbType.NVarChar, SqlValue = json, Size = int.MaxValue }; SqlParameter jsonOutput = new SqlParameter() { ParameterName = "@jsonOutput", SqlDbType = SqlDbType.NVarChar, Direction = ParameterDirection.Output, Size = int.MaxValue }; DB.Database.ExecuteSqlCommand(" sp_PDC_Discount_Report_Detail @jsonreq, @jsonOutput OUTPUT ", jsonInput, jsonOutput); var data = jsonOutput.Value.ToString(); if (data == "" || data == null) { Response.Success = false; Response.Result = DiscountTypeList; Response.ResultInfo = new { page = pagination.Page, perPage = pagination.PerPage, count = 0, totalCount = 0 }; return(Json(Response.Render())); } //JObject dd = JObject.Parse("[" + jsonOutput.Value.ToString() + "]"); ResResultDiscount Discount = JsonConvert.DeserializeObject <ResResultDiscount>(jsonOutput.Value.ToString()); //GlobalVal._listDiscount = Discount; List <DiscountModel> disc = new List <DiscountModel>(); foreach (var item in Discount.Result) { DiscountModel dc = new DiscountModel { BranchType = item.BranchType, ERPID = item.ERPID, BranchId = item.BranchId, ReceiptNo = item.ReceiptNo, ReceiptDate = item.ReceiptDate, MemberId = item.MemberId, SenderName = item.SenderName, SenderMobile = item.SenderMobile, DiscountCode = item.DiscountCode, DiscountType = item.DiscountType, Surcharge = item.Surcharge, DiscountAmount = item.DiscountAmount }; disc.Add(dc); } GlobalVal._listDiscount = disc; int totalCount = Discount.Result.Count(); var _discount = Discount.Result.Skip(pagination.From()).Take(pagination.To()).ToList(); Response.Success = true; Response.Result = disc; Response.ResultInfo = new { page = pagination.Page, perPage = pagination.PerPage, count = _discount.Count(), totalCount = totalCount }; DB.Dispose(); return(Json(Response.Render())); } catch (Exception ex) { var mss = ex.Message.ToString(); return(null); } }