protected override void Render(HtmlTextWriter writer) { DataTable coupon = ShoppingProcessor.GetCoupon(this.CartTotal); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("<button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">请选择一张优惠券<span class=\"caret\"></span></button>"); stringBuilder.AppendLine("<ul class=\"dropdown-menu\" role=\"menu\">"); stringBuilder.AppendLine("<li><a href='#' name='' value='0.00'>请选择一张优惠券</a></li>"); foreach (DataRow dataRow in coupon.Rows) { string fmType = "<li><a href=\"#\" name=\"{0}\" value=\"{3}\">{1}(满{2}减{3})</a></li>"; if (dataRow["SendType"].ToString() == "4") { fmType = "<li><a href=\"#\" name=\"{0}\" value=\"{3}\">{1}(¥{3})</a></li>"; } stringBuilder.AppendFormat(fmType, new object[] { dataRow["ClaimCode"], dataRow["Name"], ((decimal)dataRow["Amount"]).ToString("F2"), ((decimal)dataRow["DiscountValue"]).ToString("F2") }).AppendLine(); } stringBuilder.AppendLine("</ul>"); writer.Write(stringBuilder.ToString()); }
protected override void Render(HtmlTextWriter writer) { DataTable coupon = ShoppingProcessor.GetCoupon(this.CartTotal); StringBuilder builder = new StringBuilder(); builder.AppendLine("<button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">请选择一张优惠券<span class=\"caret\"></span></button>"); builder.AppendLine("<ul class=\"dropdown-menu\" role=\"menu\">"); foreach (DataRow row in coupon.Rows) { object[] args = new object[] { row["ClaimCode"], row["Name"], ((decimal)row["Amount"]).ToString("F2"), ((decimal)row["DiscountValue"]).ToString("F2") }; builder.AppendFormat("<li><a href=\"#\" name=\"{0}\" value=\"{3}\">{1}(满{2}减{3})</a></li>", args).AppendLine(); } builder.AppendLine("</ul>"); writer.Write(builder.ToString()); }
protected override void Render(HtmlTextWriter writer) { DataTable coupon = ShoppingProcessor.GetCoupon(this.CartTotal, this.itemList, false, false, false); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("<ul " + (string.IsNullOrEmpty(this.className) ? "" : ("class=\"" + this.className + "\"")) + ">"); if (coupon != null && coupon.Rows.Count > 0) { stringBuilder.AppendLine("<li><input type=\"radio\" value=\"\" class=\"icheck\" name=\"radCoupon\" amount=\"0\" discount=\"0\"><i class=\"icon_coupon\"></i>不使用优惠券</li>"); } foreach (DataRow row in coupon.Rows) { stringBuilder.AppendFormat("<li><input type=\"radio\" value=\"{3}\" class=\"icheck\" name=\"radCoupon\" amount=\"{1}\" discount=\"{2}\"><i class=\"icon_coupon\"></i>{0}(满{1}减{2}</li>", row["CouponName"], ((decimal)row["OrderUseLimit"]).F2ToString("f2"), ((decimal)row["Price"]).F2ToString("f2"), row["ClaimCode"].ToNullString()).AppendLine(); } stringBuilder.AppendLine("</ul>"); writer.Write(stringBuilder.ToString()); }
protected override void Render(HtmlTextWriter writer) { DataTable coupon = ShoppingProcessor.GetCoupon(this.CartTotal, this.BindId, this.CategoryId); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat(" <select id=\"{0}\">", this.ID); stringBuilder.AppendLine("<option name=\" \" value=\"0\" >请选择一张优惠券"); foreach (DataRow dataRow in coupon.Rows) { stringBuilder.AppendFormat("<option name=\"{0}\" value=\"{1}\">{2}</option>", new object[] { dataRow["ClaimCode"], ((decimal)dataRow["discountValue"]).ToString("F2"), dataRow["Name"], }).AppendLine(); } stringBuilder.Append("</select>"); writer.Write(stringBuilder.ToString()); }
private void bindCouponInfo() { DataTable dataTable = null; if (HiContext.Current.User != null && HiContext.Current.UserId != 0 && this.cart.GetTotal(this.storeId > 0) > decimal.Zero) { dataTable = ShoppingProcessor.GetCoupon(this.cart.GetTotal(this.storeId > 0), this.cart.LineItems, this.isGroupBuy, this.isCountDown, this.isFightGroup); this.rptOrderCoupon.DataSource = dataTable; this.rptOrderCoupon.DataBind(); } if (dataTable != null && dataTable.Rows.Count > 0) { CouponItemInfo userCouponInfo = ShoppingProcessor.GetUserCouponInfo(this.cart.GetTotal(this.storeId > 0), dataTable.Rows[0]["ClaimCode"].ToString()); if (userCouponInfo != null) { this.litCouponAmout.InnerHtml = (userCouponInfo.Price.HasValue ? userCouponInfo.Price.Value.F2ToString("f2") : "0.00"); this.htmlCouponCode.Value = userCouponInfo.ClaimCode; this.couponName.InnerHtml = "-¥" + (userCouponInfo.Price.HasValue ? userCouponInfo.Price.Value.F2ToString("f2") : "0.00"); } } }
protected override void AttachChildControls() { radlAddress = (Common_ShippingAddressRadioButtonList)FindControl("Common_ShippingAddressesRadioButtonList"); dropRegions = (RegionSelector)FindControl("dropRegions"); txtShipTo = (TextBox)FindControl("txtShipTo"); txtAddress = (TextBox)FindControl("txtAddress"); txtZipcode = (TextBox)FindControl("txtZipcode"); txtCellPhone = (TextBox)FindControl("txtCellPhone"); txtTelPhone = (TextBox)FindControl("txtTelPhone"); orderOptionList = (Common_OrderOptionList)FindControl("Common_OrderOptions"); shippingModeList = (Common_ShippingModeList)FindControl("Common_ShippingModeList"); paymentModeList = (Common_PaymentModeList)FindControl("grd_Common_PaymentModeList"); inputPaymentModeId = (HtmlInputHidden)FindControl("inputPaymentModeId"); inputShippingModeId = (HtmlInputHidden)FindControl("inputShippingModeId"); hdbuytype = (HtmlInputHidden)FindControl("hdbuytype"); lblPaymentPrice = (PaymentPriceLabel)FindControl("lblPaymentPrice"); lblShippModePrice = (ShippingModePriceLabel)FindControl("lblShippModePrice"); cartProductList = (Common_SubmmintOrder_ProductList)FindControl("Common_SubmmintOrder_ProductList"); cartGiftList = (Common_SubmmintOrder_GiftList)FindControl("Common_SubmmintOrder_GiftList"); lblOrderOptionPrice = (OrderOptionPriceLabel)FindControl("lblOrderOptionPrice"); litProductAmount = (Literal)FindControl("litProductAmount"); litAllWeight = (WeightLabel)FindControl("litAllWeight"); litPoint = (PointTotalLabel)FindControl("litPoint"); lblOrderTotal = (OrderTotalPriceLabel)FindControl("lblOrderTotal"); lblCartTotalPrice = (CartTotalPriceLabel)FindControl("lblCartTotalPrice"); txtMessage = (TextBox)FindControl("txtMessage"); hlkFeeFreeName = (HyperLink)FindControl("hlkFeeFreeName"); lblServiceChargeFree = (ServiceChargeFreeNameLabel)FindControl("lblServiceChargeFree"); lblShipChargeFee = (ShipChargeFeeNameLabel)FindControl("lblShipChargeFee"); lblPackingChargeFree = (PackingChargeFreeNameLabel)FindControl("lblPackingChargeFree"); hlkDiscountName = (HyperLink)FindControl("hlkDiscountName"); litDiscountPrice = (Literal)FindControl("litDiscountPrice"); htmlCouponCode = (HtmlInputText)FindControl("htmlCouponCode"); CmbCoupCode = (HtmlSelect)FindControl("CmbCoupCode"); litCouponAmout = (CouponPriceLabel)FindControl("litCouponAmout"); btnCreateOrder = ButtonManager.Create(FindControl("btnCreateOrder")); btnCreateOrder.Click += new EventHandler(btnCreateOrder_Click); if (!Page.IsPostBack) { //绑定地址 BindUserAddress(); //绑定订单 orderOptionList.DataSource = ShoppingProcessor.GetUsableOrderLookupLists(); orderOptionList.DataBind(); //绑定配送方式 shippingModeList.DataSource = ShoppingProcessor.GetShippingModes(); shippingModeList.DataBind(); //绑定支付方式 ReBindPayment(); if (shoppingCart != null) { BindPromote(shoppingCart); BindShoppingCartInfo(shoppingCart); CmbCoupCode.DataTextField = "DisplayText"; CmbCoupCode.DataValueField = "ClaimCode"; CmbCoupCode.DataSource = ShoppingProcessor.GetCoupon(shoppingCart.GetTotal()); CmbCoupCode.DataBind(); ListItem item = new ListItem("", "0"); CmbCoupCode.Items.Insert(0, item); hdbuytype.Value = buytype; } } }
protected override void AttachChildControls() { this.dropRegions = (RegionSelector)this.FindControl("dropRegions"); this.txtShipTo = (System.Web.UI.WebControls.TextBox) this.FindControl("txtShipTo"); this.txtAddress = (System.Web.UI.WebControls.TextBox) this.FindControl("txtAddress"); this.txtZipcode = (System.Web.UI.WebControls.TextBox) this.FindControl("txtZipcode"); this.txtCellPhone = (System.Web.UI.WebControls.TextBox) this.FindControl("txtCellPhone"); this.txtTelPhone = (System.Web.UI.WebControls.TextBox) this.FindControl("txtTelPhone"); this.txtInvoiceTitle = (System.Web.UI.WebControls.TextBox) this.FindControl("txtInvoiceTitle"); this.drpShipToDate = (System.Web.UI.HtmlControls.HtmlSelect) this.FindControl("drpShipToDate"); this.litTaxRate = (System.Web.UI.WebControls.Label) this.FindControl("litTaxRate"); this.shippingModeList = (Common_ShippingModeList)this.FindControl("Common_ShippingModeList"); this.paymentModeList = (Common_PaymentModeList)this.FindControl("grd_Common_PaymentModeList"); this.inputPaymentModeId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("inputPaymentModeId"); this.inputShippingModeId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("inputShippingModeId"); this.hdbuytype = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hdbuytype"); this.pannel_useraddress = (System.Web.UI.WebControls.Panel) this.FindControl("pannel_useraddress"); this.lblPaymentPrice = (FormatedMoneyLabel)this.FindControl("lblPaymentPrice"); this.lblShippModePrice = (FormatedMoneyLabel)this.FindControl("lblShippModePrice"); this.chkTax = (System.Web.UI.HtmlControls.HtmlInputCheckBox) this.FindControl("chkTax"); this.cartProductList = (Common_SubmmintOrder_ProductList)this.FindControl("Common_SubmmintOrder_ProductList"); this.cartGiftList = (Common_SubmmintOrder_GiftList)this.FindControl("Common_SubmmintOrder_GiftList"); this.litProductAmount = (System.Web.UI.WebControls.Literal) this.FindControl("litProductAmount"); this.litProductBundling = (System.Web.UI.WebControls.Literal) this.FindControl("litProductBundling"); this.litAllWeight = (System.Web.UI.WebControls.Label) this.FindControl("litAllWeight"); this.litPoint = (System.Web.UI.WebControls.Label) this.FindControl("litPoint"); this.hlkSentTimesPoint = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlkSentTimesPoint"); this.lblOrderTotal = (FormatedMoneyLabel)this.FindControl("lblOrderTotal"); this.txtMessage = (System.Web.UI.WebControls.TextBox) this.FindControl("txtMessage"); this.hlkFeeFreight = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlkFeeFreight"); this.hlkReducedPromotion = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlkReducedPromotion"); this.lblTotalPrice = (FormatedMoneyLabel)this.FindControl("lblTotalPrice"); this.htmlCouponCode = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("htmlCouponCode"); this.CmbCoupCode = (System.Web.UI.HtmlControls.HtmlSelect) this.FindControl("CmbCoupCode"); this.tbCoupon = (System.Web.UI.HtmlControls.HtmlTable) this.FindControl("tbCoupon"); this.litCouponAmout = (FormatedMoneyLabel)this.FindControl("litCouponAmout"); this.btnCreateOrder = ButtonManager.Create(this.FindControl("btnCreateOrder")); this.btnCreateOrder.Click += new System.EventHandler(this.btnCreateOrder_Click); Hidistro.Membership.Context.SiteSettings masterSettings = Hidistro.Membership.Context.SettingsManager.GetMasterSettings(false); if (!this.Page.IsPostBack) { this.BindUserAddress(); this.shippingModeList.DataSource = ShoppingProcessor.GetShippingModes(); this.shippingModeList.DataBind(); this.ReBindPayment(); if (this.shoppingCart != null) { this.litTaxRate.Text = masterSettings.TaxRate.ToString(System.Globalization.CultureInfo.InvariantCulture); this.BindShoppingCartInfo(this.shoppingCart); if (this.isGroupBuy || this.isCountDown || this.isBundling || this.shoppingCart.LineItems.Count == 0) { this.tbCoupon.Visible = false; } this.CmbCoupCode.DataTextField = "DisplayText"; this.CmbCoupCode.DataValueField = "ClaimCode"; this.CmbCoupCode.DataSource = ShoppingProcessor.GetCoupon(this.shoppingCart.GetTotal()); this.CmbCoupCode.DataBind(); System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem("", "0"); this.CmbCoupCode.Items.Insert(0, item); this.hdbuytype.Value = this.buytype; this.pannel_useraddress.Visible = (!Hidistro.Membership.Context.HiContext.Current.User.IsAnonymous && PersonalHelper.GetShippingAddressCount(Hidistro.Membership.Context.HiContext.Current.User.UserId) > 0); } } }