public bool Update(DeliverTypeInfo deliverTypeInfo) { Parameters cmdParams = AddInCommonParameter(deliverTypeInfo); cmdParams.AddInParameter("@orderId", DbType.Int32, deliverTypeInfo.OrderId); return(DBHelper.ExecuteProc("PR_Shop_DeliverType_Update", cmdParams)); }
protected void DropDeliverType_SelectedIndexChanged(object sender, EventArgs e) { DeliverTypeInfo deliverTypeById = new DeliverTypeInfo(); deliverTypeById = DeliverType.GetDeliverTypeById(DataConverter.CLng(this.DropDeliverType.SelectedValue)); if (!deliverTypeById.IsNull) { this.LblDeliverTypeIntro.Text = deliverTypeById.Intro; } }
private static string GetDeliverType(int deliverTypeId) { DeliverTypeInfo deliverTypeById = DeliverType.GetDeliverTypeById(deliverTypeId); if (!deliverTypeById.IsNull) { return(deliverTypeById.TypeName); } return(string.Empty); }
private static decimal GetChargeByTotalMoney(DeliverTypeInfo deliverTypeInfo, decimal totalMoney) { decimal chargeMax = 0M; chargeMax = ((totalMoney * deliverTypeInfo.ChargePercent) / 100M) + deliverTypeInfo.ChargeMin; if (chargeMax > deliverTypeInfo.ChargeMax) { chargeMax = deliverTypeInfo.ChargeMax; } return(chargeMax); }
public static bool Update(DeliverTypeInfo deliverTypeInfo) { if (deliverTypeInfo == null) { return(false); } if (deliverTypeInfo.ChargeType == 0) { deliverTypeInfo.IncludeTax = TaxRateType.BarringTaxNeedInvoiceNoTax; } return(dal.Update(deliverTypeInfo)); }
public static decimal TaxRateComputeOfDeliver(DeliverTypeInfo deliverTypeInfo, decimal deliverCharge, bool needInvoice) { if ((deliverTypeInfo.IncludeTax == TaxRateType.IncludeTaxNoInvoiceFavourable) || (deliverTypeInfo.IncludeTax == TaxRateType.IncludeTaxNoInvoiceNoFavourable)) { if (!needInvoice && (deliverTypeInfo.IncludeTax == TaxRateType.IncludeTaxNoInvoiceFavourable)) { deliverCharge = (deliverCharge * (100M - DataConverter.CDecimal(deliverTypeInfo.TaxRate))) / 100M; } return(deliverCharge); } if (needInvoice && (deliverTypeInfo.IncludeTax == TaxRateType.BarringTaxNeedInvoiceAddTax)) { deliverCharge = (deliverCharge * (100M + DataConverter.CDecimal(deliverTypeInfo.TaxRate))) / 100M; } return(deliverCharge); }
public static decimal GetDeliverCharge(int deliverTypeId, double totalWeight, string postCode, decimal totalMoney, bool needInvoice) { DeliverTypeInfo deliverTypeById = DeliverType.GetDeliverTypeById(deliverTypeId); decimal chargeByTotalMoney = 0M; if (!deliverTypeById.IsNull) { switch (deliverTypeById.ChargeType) { case 0: chargeByTotalMoney = 0M; break; case 1: if (totalWeight > 0.0) { chargeByTotalMoney = GetChargeByWeight(postCode, deliverTypeId, totalWeight); } break; case 2: chargeByTotalMoney = GetChargeByTotalMoney(deliverTypeById, totalMoney); break; case 3: return(deliverTypeById.MinMoney1); } if (((chargeByTotalMoney > 0M) && (deliverTypeById.ReleaseType > 0)) && (totalMoney >= deliverTypeById.MinMoney1)) { chargeByTotalMoney = GetAgreedCharge(chargeByTotalMoney, totalMoney, deliverTypeById); } } if (chargeByTotalMoney > 0M) { chargeByTotalMoney = TaxRateComputeOfDeliver(deliverTypeById, chargeByTotalMoney, needInvoice); } if (chargeByTotalMoney < 0M) { chargeByTotalMoney = 0M; } return(chargeByTotalMoney); }
public IList <DeliverTypeInfo> GetDeliverTypeList() { IList <DeliverTypeInfo> list = new List <DeliverTypeInfo>(); using (NullableDataReader reader = DBHelper.ExecuteReaderProc("PR_Shop_DeliverType_GetList")) { while (reader.Read()) { DeliverTypeInfo item = new DeliverTypeInfo(); item.TypeId = reader.GetInt32("TypeId"); item.TypeName = reader.GetString("TypeName"); item.Intro = Convert.IsDBNull(reader["Intro"]) ? "" : reader.GetString("Intro"); item.ChargeType = reader.GetInt32("ChargeType"); item.IsDefault = reader.GetBoolean("IsDefault"); item.IsDisabled = reader.GetBoolean("IsDisabled"); item.OrderId = reader.GetInt32("OrderId"); item.IncludeTax = (TaxRateType)reader.GetInt32("IncludeTax"); list.Add(item); } } return(list); }
private static Parameters AddInCommonParameter(DeliverTypeInfo deliverTypeInfo) { Parameters parameters = new Parameters(); parameters.AddInParameter("@typeId", DbType.Int32, deliverTypeInfo.TypeId); parameters.AddInParameter("@typeName", DbType.String, deliverTypeInfo.TypeName); parameters.AddInParameter("@intro", DbType.String, deliverTypeInfo.Intro); parameters.AddInParameter("@chargeType", DbType.Int32, deliverTypeInfo.ChargeType); parameters.AddInParameter("@isDefault", DbType.Boolean, deliverTypeInfo.IsDefault); parameters.AddInParameter("@isDisabled", DbType.Boolean, deliverTypeInfo.IsDisabled); parameters.AddInParameter("@releaseType", DbType.Int32, deliverTypeInfo.ReleaseType); parameters.AddInParameter("@minMoney1", DbType.Currency, deliverTypeInfo.MinMoney1); parameters.AddInParameter("@releaseCharge", DbType.Currency, deliverTypeInfo.ReleaseCharge); parameters.AddInParameter("@minMoney2", DbType.Currency, deliverTypeInfo.MinMoney2); parameters.AddInParameter("@maxCharge", DbType.Currency, deliverTypeInfo.MaxCharge); parameters.AddInParameter("@minMoney3", DbType.Currency, deliverTypeInfo.MinMoney3); parameters.AddInParameter("@charge_Min", DbType.Currency, deliverTypeInfo.ChargeMin); parameters.AddInParameter("@charge_Max", DbType.Currency, deliverTypeInfo.ChargeMax); parameters.AddInParameter("@includeTax", DbType.Int32, deliverTypeInfo.IncludeTax); parameters.AddInParameter("@taxRate", DbType.Double, deliverTypeInfo.TaxRate); parameters.AddInParameter("@charge_Percent", DbType.Int16, deliverTypeInfo.ChargePercent); return(parameters); }
private static DeliverTypeInfo DeliverTypeInfoFromrdr(NullableDataReader rdr) { DeliverTypeInfo info = new DeliverTypeInfo(); info.TypeId = rdr.GetInt32("TypeId"); info.TypeName = rdr.GetString("TypeName"); info.Intro = rdr.GetString("Intro"); info.ChargeType = rdr.GetInt32("ChargeType"); info.IsDefault = rdr.GetBoolean("IsDefault"); info.IsDisabled = rdr.GetBoolean("IsDisabled"); info.OrderId = rdr.GetInt32("OrderId"); info.ReleaseType = rdr.GetInt32("ReleaseType"); info.MinMoney1 = rdr.GetDecimal("MinMoney1"); info.ReleaseCharge = rdr.GetDecimal("ReleaseCharge"); info.MinMoney2 = rdr.GetDecimal("MinMoney2"); info.MaxCharge = rdr.GetDecimal("MaxCharge"); info.MinMoney3 = rdr.GetDecimal("MinMoney3"); info.ChargeMin = rdr.GetDecimal("Charge_Min"); info.ChargeMax = rdr.GetDecimal("Charge_Max"); info.IncludeTax = (TaxRateType)rdr.GetInt32("IncludeTax"); info.TaxRate = rdr.GetDouble("TaxRate"); info.ChargePercent = rdr.GetInt16("Charge_Percent"); return(info); }
protected void RptShoppingCart_ItemDataBound(object sender, RepeaterItemEventArgs e) { ShopConfig shopConfig = SiteConfig.ShopConfig; bool isPaymentShowProducdtThumb = true; int paymentThumbsWidth = 0; int paymentThumbsHeight = 0; bool isShowPaymentProductType = true; bool isShowPaymentSaleType = true; bool isShowPaymentMarkPrice = true; if (this.IsPreview == 0) { isPaymentShowProducdtThumb = shopConfig.IsPaymentShowProducdtThumb; isShowPaymentProductType = shopConfig.IsShowPaymentProductType; isShowPaymentSaleType = shopConfig.IsShowPaymentSaleType; isShowPaymentMarkPrice = shopConfig.IsShowPaymentMarkPrice; paymentThumbsWidth = shopConfig.PaymentThumbsWidth; paymentThumbsHeight = shopConfig.PaymentThumbsHeight; } else if (this.IsPreview == 1) { isPaymentShowProducdtThumb = shopConfig.IsPreviewShowProducdtThumb; isShowPaymentProductType = shopConfig.IsShowPreviewProductType; isShowPaymentSaleType = shopConfig.IsShowPreviewSaleType; isShowPaymentMarkPrice = shopConfig.IsShowPreviewMarkPrice; paymentThumbsWidth = shopConfig.PreviewThumbsWidth; paymentThumbsHeight = shopConfig.PreviewThumbsHeight; } if ((e.Item.ItemType != ListItemType.Item) && (e.Item.ItemType != ListItemType.AlternatingItem)) { if (e.Item.ItemType == ListItemType.Footer) { PresentProjectInfo presentProInfo = new PresentProjectInfo(true); if (this.m_IsPreview != 3) { presentProInfo = PresentProject.GetPresentProjectByTotalMoney(this.total); this.presentExpInfomation = this.ShowPresentExp(presentProInfo).ToString(); } if (this.m_IsPreview == 1) { int presentId = DataConverter.CLng(this.PresentId); PlaceHolder holder = (PlaceHolder)e.Item.FindControl("PlhPresentInfo"); holder.Visible = false; if (((presentId > 0) && !presentProInfo.IsNull) && (presentProInfo.PresentContent.Contains("1") && (presentId > 0))) { holder.Visible = true; AbstractItemInfo info7 = new ConcretePresentProject(presentId, presentProInfo); info7.GetItemInfo(); Label label2 = (Label)e.Item.FindControl("LblProductName"); Label label3 = (Label)e.Item.FindControl("LblUnit"); Label label4 = (Label)e.Item.FindControl("LblPresentPriceMarket"); Label label5 = (Label)e.Item.FindControl("LblPresentPrice"); Label label6 = (Label)e.Item.FindControl("LblPresentPrice1"); label2.Text = info7.ProductName; label3.Text = info7.Unit; label4.Text = info7.PriceMarket.ToString("0.00"); label5.Text = info7.Price.ToString("0.00"); label6.Text = info7.Price.ToString("0.00"); this.weight += info7.TotalWeight; this.total += info7.Price; } ((PlaceHolder)e.Item.FindControl("PlhMoneyInfo")).Visible = true; Label label7 = (Label)e.Item.FindControl("LblDeliverCharge"); Label label8 = (Label)e.Item.FindControl("LblTaxRate"); Label label9 = (Label)e.Item.FindControl("LblIncludeTax"); Label label10 = (Label)e.Item.FindControl("LblCoupon"); Label label11 = (Label)e.Item.FindControl("LblTotalMoney"); Label label12 = (Label)e.Item.FindControl("LblTrueTotalMoney"); PackageInfo packageByGoodsWeight = Package.GetPackageByGoodsWeight(this.weight); if (!packageByGoodsWeight.IsNull) { this.weight += packageByGoodsWeight.PackageWeight; } decimal num7 = DeliverCharge.GetDeliverCharge(this.m_DeliverType, this.weight, this.m_ZipCode, this.total, this.m_NeedInvoice); DeliverTypeInfo deliverTypeById = EasyOne.Shop.DeliverType.GetDeliverTypeById(this.m_DeliverType); label7.Text = num7.ToString("0.00"); label8.Text = deliverTypeById.TaxRate.ToString(); if ((deliverTypeById.IncludeTax == TaxRateType.IncludeTaxNoInvoiceFavourable) || (deliverTypeById.IncludeTax == TaxRateType.IncludeTaxNoInvoiceNoFavourable)) { label9.Text = "是"; } else { label9.Text = "否"; } decimal num8 = this.total + num7; if (this.m_CouponMoney > 0M) { label10.Visible = true; decimal num9 = this.total - this.m_CouponMoney; if (num9 < 0M) { num9 = 0M; } num8 = num9 + num7; label10.Text = "使用优惠券,面值为:" + this.m_CouponMoney.ToString("0.00") + "元,商品实际价格为:" + num9.ToString("0.00") + "元 <br>"; label11.Text = num9.ToString("0.00") + "+" + num7.ToString("0.00") + "=" + num8.ToString("0.00") + "元"; label12.Text = num8.ToString("0.00"); } else { label10.Visible = false; label11.Text = this.total.ToString("0.00") + "+" + num7.ToString("0.00") + "=" + num8.ToString("0.00") + "元"; label12.Text = num8.ToString("0.00"); } this.ViewState["TrueTotalMoney"] = num8; } else { ((PlaceHolder)e.Item.FindControl("PlhMoneyInfo")).Visible = false; } ExtendedImage image3 = (ExtendedImage)e.Item.FindControl("presentImage"); Control control9 = e.Item.FindControl("footerPresentImage"); Control control10 = e.Item.FindControl("footerTdThemeImage"); Control control11 = e.Item.FindControl("footerTdProductType"); Control control12 = e.Item.FindControl("footerTdSaleType"); Control control13 = e.Item.FindControl("footerTdMarkPrice"); Control control14 = e.Item.FindControl("footerTdThemeImage"); Control control15 = e.Item.FindControl("footerTdMoneyInfoSaleType"); Control control16 = e.Item.FindControl("footerTdMoneyInfoMarkPrice"); Control control17 = e.Item.FindControl("footerPresentType"); Control control18 = e.Item.FindControl("footerPresentSaleType"); Control control19 = e.Item.FindControl("footerPresentMarkPrice"); if (!isPaymentShowProducdtThumb) { control10.Visible = false; control9.Visible = false; } else { PresentInfo presentById = Present.GetPresentById(DataConverter.CLng(this.PresentId)); if (!string.IsNullOrEmpty(presentById.PresentThumb)) { image3.Src = presentById.PresentThumb; } else { image3.Src = SiteConfig.SiteInfo.VirtualPath + "Images/nopic.gif"; } image3.Width = paymentThumbsWidth; image3.Height = paymentThumbsHeight; } if (!isShowPaymentProductType) { control11.Visible = false; control14.Visible = false; control17.Visible = false; } if (!isShowPaymentSaleType) { control12.Visible = false; control15.Visible = false; control18.Visible = false; } if (!isShowPaymentMarkPrice) { control13.Visible = false; control16.Visible = false; control19.Visible = false; return; } } else if (e.Item.ItemType == ListItemType.Header) { Control control20 = e.Item.FindControl("ProductImageTitle"); Control control21 = e.Item.FindControl("tdProductTypeTitle"); Control control22 = e.Item.FindControl("tdSaleTypeTitle"); Control control23 = e.Item.FindControl("tdMarkPriceTitle"); if (!isPaymentShowProducdtThumb) { control20.Visible = false; } if (!isShowPaymentProductType) { control21.Visible = false; } if (!isShowPaymentSaleType) { control22.Visible = false; } if (!isShowPaymentMarkPrice) { control23.Visible = false; } } return; } int productNum = 0; string str = ""; string str2 = ""; decimal subTotal = 0M; ShoppingCartInfo dataItem = (ShoppingCartInfo)e.Item.DataItem; if (dataItem == null) { return; } productNum = dataItem.Quantity; bool haveWholesalePurview = Convert.ToBoolean(this.ViewState["HaveWholesalePurview"]); str2 = ShoppingCart.GetSaleType(dataItem.ProductInfomation, productNum, haveWholesalePurview); str = ShoppingCart.GetProductType(dataItem.ProductInfomation, productNum, haveWholesalePurview); AbstractItemInfo info2 = new ConcreteProductInfo(productNum, dataItem.Property, dataItem.ProductInfomation, this.m_UserInfo, false, false, haveWholesalePurview); info2.GetItemInfo(); subTotal = info2.SubTotal; this.total += subTotal; this.totalExp += dataItem.ProductInfomation.PresentExp * productNum; this.totalMoney += dataItem.ProductInfomation.PresentMoney * productNum; this.totalPoint += dataItem.ProductInfomation.PresentPoint * productNum; this.weight += info2.TotalWeight; if (!string.IsNullOrEmpty(dataItem.Property)) { ((Literal)e.Item.FindControl("LitProperty")).Text = "(" + info2.Property + ")"; } InsideStaticLabel label = new InsideStaticLabel(); string str3 = "<a href='"; str3 = (str3 + label.GetInfoPath(info2.ProductId.ToString())) + "' Target='_blank'>" + info2.ProductName + "</a>"; ((Literal)e.Item.FindControl("LitProductName")).Text = str3; ((Literal)e.Item.FindControl("LitProductUnit")).Text = info2.Unit; ((Literal)e.Item.FindControl("LitTruePrice")).Text = info2.Price.ToString("0.00"); ((Literal)e.Item.FindControl("LitSubTotal")).Text = subTotal.ToString("0.00"); ExtendedImage image = (ExtendedImage)e.Item.FindControl("extendedImage"); ExtendedImage image2 = (ExtendedImage)e.Item.FindControl("extendedPresentImage"); Control control = e.Item.FindControl("ProductImage"); Control control2 = e.Item.FindControl("presentImage"); if (!isPaymentShowProducdtThumb) { image.Visible = false; control.Visible = false; control2.Visible = false; } else { if (!string.IsNullOrEmpty(dataItem.ProductInfomation.ProductThumb)) { image.Src = dataItem.ProductInfomation.ProductThumb; } else { image.Src = SiteConfig.SiteInfo.VirtualPath + "Images/nopic.gif"; } image.ImageHeight = paymentThumbsHeight; image.ImageWidth = paymentThumbsWidth; if (dataItem.ProductInfomation.PresentId > 0) { PresentInfo info3 = Present.GetPresentById(dataItem.ProductInfomation.PresentId); if (!string.IsNullOrEmpty(info3.PresentThumb)) { image2.Src = info3.PresentThumb; } else { image2.Src = SiteConfig.SiteInfo.VirtualPath + "Images/nopic.gif"; } image2.ImageHeight = paymentThumbsHeight; image2.ImageWidth = paymentThumbsWidth; } } if (!isShowPaymentProductType) { e.Item.FindControl("tdProductType").Visible = false; } else { ((Literal)e.Item.FindControl("LitProductType")).Text = str; } if (!isShowPaymentSaleType) { e.Item.FindControl("tdSaleType").Visible = false; } else { ((Literal)e.Item.FindControl("LitSaleType")).Text = str2; } if (!isShowPaymentMarkPrice) { e.Item.FindControl("tdMarkPrice").Visible = false; } else { ((Literal)e.Item.FindControl("LitPriceMarket")).Text = info2.PriceMarket.ToString("0.00"); } int num5 = Order.CountBuyNum(PEContext.Current.User.UserName, dataItem.ProductId); ProductInfo productById = Product.GetProductById(dataItem.ProductId); if ((productById.LimitNum > 0) && ((dataItem.Quantity + num5) > productById.LimitNum)) { BaseUserControl.WriteErrMsg(string.Concat(new object[] { "您订购了", num5, productById.Unit, productById.ProductName, ",曾经购买了", num5, productById.Unit, ",而此商品每人限购数量为", productById.LimitNum, productById.Unit, ",请重新调整您的购物车!" }), "ShoppingCart.aspx"); } if ((dataItem.ProductInfomation.SalePromotionType <= 0) || (productNum < dataItem.ProductInfomation.MinNumber)) { return; } e.Item.FindControl("PresentInfomation").Visible = true; string str4 = ""; string str5 = ""; string str6 = ""; AbstractItemInfo info5 = new ConcreteSalePromotionType(productNum, dataItem.ProductInfomation, false, null); info5.GetItemInfo(); switch (dataItem.ProductInfomation.SalePromotionType) { case 1: case 3: str5 = "<font color=red>(赠品)</font>"; str4 = "赠送礼品"; str6 = "赠送"; goto Label_06A1; case 2: case 4: if (info5.Price <= 0M) { str5 = "<font color=red>(赠送赠品)</font>"; str6 = "赠送"; break; } str5 = "<font color=red>(换购赠品)</font>"; str6 = "换购"; break; default: goto Label_06A1; } str4 = "促销礼品"; Label_06A1: if (this.PresentExist(this.m_CartId, info5.Id)) { ((HiddenField)e.Item.FindControl("HdnPresentId")).Value = info5.Id.ToString(); ExtendedLiteral literal = (ExtendedLiteral)e.Item.FindControl("LitPresentName"); literal.Text = info5.ProductName; literal.EndTag = str5; ((Literal)e.Item.FindControl("LitPresentUnit")).Text = info5.Unit; ((Literal)e.Item.FindControl("LitPresentNum")).Text = info5.Amount.ToString(); ((Literal)e.Item.FindControl("LitPresentTruePrice")).Text = info5.Price.ToString("0.00"); ((Literal)e.Item.FindControl("LitPresentSubtotal")).Text = info5.SubTotal.ToString("0.00"); this.total += info5.SubTotal; this.weight += info5.TotalWeight; } if (!isShowPaymentProductType) { e.Item.FindControl("tdPresentType").Visible = false; } else { ((Literal)e.Item.FindControl("LitPresentType")).Text = str4; } if (!isShowPaymentSaleType) { e.Item.FindControl("tdPresentSaleType").Visible = false; } else { ((Literal)e.Item.FindControl("LitPresentSaleType")).Text = str6; } if (!isShowPaymentMarkPrice) { e.Item.FindControl("tdPresentMarkPrice").Visible = false; } else { ((Literal)e.Item.FindControl("LitPresentPriceOriginal")).Text = info5.PriceMarket.ToString("0.00"); } }
public bool Add(DeliverTypeInfo deliverTypeInfo) { return(DBHelper.ExecuteProc("PR_Shop_DeliverType_Add", AddInCommonParameter(deliverTypeInfo))); }
private static decimal GetAgreedCharge(decimal charge_Deliver, decimal totalMoney, DeliverTypeInfo deliverTypeInfo) { decimal num = charge_Deliver; if (charge_Deliver <= deliverTypeInfo.ReleaseCharge) { charge_Deliver = 0M; } else { charge_Deliver -= deliverTypeInfo.ReleaseCharge; } if (totalMoney >= deliverTypeInfo.MinMoney2) { if (totalMoney >= deliverTypeInfo.MinMoney3) { charge_Deliver = 0M; return(charge_Deliver); } if (num <= deliverTypeInfo.MaxCharge) { charge_Deliver = 0M; } } return(charge_Deliver); }