/// <summary> /// 生成真实订单 /// </summary> /// <returns></returns> public string CreateOrder() { ResultObj _result = new ResultObj(); int _resultstatus = (int)CommonStatus.Fail; long _preordercode = FormString.LongIntSafeQ("preordercode"); int _addressid = FormString.IntSafeQ("addressid"); //int _paytype = FormString.IntSafeQ("paytype"); int _systype = FormString.IntSafeQ("systype"); if (_systype == 0) { _systype = (int)SystemType.B2B; } string _remark = FormString.SafeQ("remark"); string acceptername = FormString.SafeQ("acceptername"); int province = FormString.IntSafeQ("province"); int city = FormString.IntSafeQ("city"); string address = FormString.SafeQ("address", 500); string mobilephone = FormString.SafeQ("mobilephone"); int jifen = FormString.IntSafeQ("jifen"); int memcouponid = FormString.IntSafeQ("memcouponid"); int expressid = FormString.IntSafeQ("expressid"); int ordertype = FormString.IntSafeQ("ordertype", -1); if (jifen % 100 != 0) { jifen = jifen / 100 * 100; } if (jifen > 0 && !AssetBLL.Instance.CheckIntegralEnough(memid, jifen)) { jifen = 0; } int billtype = FormString.IntSafeQ("billtype"); OrderBillBasicEntity _billentity = new OrderBillBasicEntity(); _billentity.BillType = billtype; if (billtype == (int)BillType.Normal) { string title = FormString.SafeQ("billtitle", 200); _billentity.CompanyName = title; } else if (billtype == (int)BillType.VAT) { _billentity.BillId = FormString.IntSafeQ("billvatid"); MemBillVATEntity _mementity = MemBillVATBLL.Instance.GetMemBillVAT(memid); //if (_mementity.Status != 1) //{ // resultstatus = (int)CommonStatus.BillVATNoCheck; // _result.Status = resultstatus; // return JsonJC.ObjectToJson(_result); //} _billentity.ReceiverName = FormString.SafeQ("billvatrename"); _billentity.ReceiverPhone = FormString.SafeQ("billvatrephone"); _billentity.ReceiverProvince = FormString.IntSafeQ("billvatreprovince"); _billentity.ReceiverCity = FormString.IntSafeQ("billvatrecity"); _billentity.ReceiverAddress = FormString.SafeQ("billvatreaddress", 300); _billentity.CompanyName = _mementity.CompanyName; _billentity.CompanyPhone = _mementity.CompanyPhone; _billentity.CompanyCode = _mementity.CompanyCode; _billentity.CompanyBank = _mementity.CompanyBank; _billentity.CompanyAddress = _mementity.CompanyAddress; _billentity.BankAccount = _mementity.BankAccount; _billentity.Status = _mementity.Status; } VWOrderEntity _vworder = OrderDetailPreTempBLL.Instance.GetVWOrderByTempCode(_preordercode); if (ordertype != -1) { _vworder.OrderType = ordertype; } _vworder.OrderStyle = (int)OrderStyleEnum.Normal; _vworder.DisCountFee = _vworder.DisCountFee; decimal tempprice = _vworder.PreDisCountPrice - _vworder.DisCountFee; if (tempprice > 1) { decimal jifenamt = OrderCommonBLL.Instance.GetJiFenAmt(jifen); _vworder.Integral = jifen; _vworder.IntegralFee = jifenamt; tempprice = tempprice - jifenamt; } else { _vworder.Integral = 0; _vworder.IntegralFee = 0; } if (memcouponid > 0) { MemCouponsEntity couponen = MemCouponsBLL.Instance.GetCouponByMemCouponId(memid, memcouponid); if (couponen != null && couponen.Id == memcouponid && couponen.EndTime > DateTime.Now) { DicCouponsEntity dicen = couponen.DicCoupons; if (dicen.CouponType == (int)CouponTypeEnum.Money && dicen.MinimumReqAmount < tempprice) { _vworder.MemCouponsId = memcouponid; _vworder.CouponsFee = dicen.CouponValue; tempprice = tempprice - dicen.CouponValue; } } } _vworder.ActPrice = tempprice; //_vworder.PayType = _paytype; _vworder.ExpressCom = expressid; _vworder.Remark = _remark; _vworder.MemId = memid; _vworder.MemLevel = member.MemGrade; _vworder.IsStore = member.IsStore; //if (_paytype == (int)PayType.OutLine) //{ // _vworder.PayConfirmCode = StringUtils.GetRandomString(12); //} //if (billtype == 1) //{ // _vworder.BillType = (int)BillType.Normal; //} //else if (billtype == 2) //{ // _vworder.BillType = (int)BillType.VAT; //} OrderAddressEntity _address = new OrderAddressEntity(); _address.CityId = city; _address.AccepterName = acceptername; _address.ProvinceId = province; _address.Address = address; _address.MobilePhone = mobilephone; //_vworder.AcceptAddress = _address; if (_vworder.ActPrice >= 1) { List <int> listpdids = new List <int>(); string productdetails = ""; if (_vworder != null && _vworder.Details != null && _vworder.Details.Count > 0) { foreach (VWOrderDetailEntity ordetailentity in _vworder.Details) { listpdids.Add(ordetailentity.ProductDetailId); productdetails += "|" + ordetailentity.ProductDetailId.ToString() + "_" + ordetailentity.Num.ToString(); } if (productdetails != "") { productdetails = productdetails.TrimStart('|'); if (ProductStyleBLL.Instance.ProductsEnough(productdetails)) { string ordercode = OrderBLL.Instance.CreateOrder(_vworder, _address, _billentity); if (!string.IsNullOrEmpty(ordercode)) { //IList<OrderDetailEntity> _listproduct = OrderDetailBLL.Instance.GetOrderDetailAllByOrder(memid, StringUtils.GetDbLong(ordercode), false); //foreach (OrderDetailEntity _entity in _listproduct) //{ // productdetails += "|" + _entity.ProductDetailId.ToString() + "_" + _entity.Num.ToString(); //} if (productdetails != "") { if (ProductStyleBLL.Instance.ProductsToOrder(productdetails) > 0) { VWShoppingCartInfo ShoppingCartentity = ShoppingCartProcessor.GetShoppingCart(); ShoppingCartProcessor.RemoveCartItems(ShoppingCartentity, listpdids); //if (_vworder.PayType == (int)PayType.WeChat) //{ _result.Obj = ordercode; //} //else //{ // _result.Obj = ordercode; //} _result.Status = (int)CommonStatus.Success; return(JsonJC.ObjectToJson(_result)); } else { _result.Status = (int)CommonStatus.ProductLess; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); } } else { _result.Status = (int)CommonStatus.Success; _result.Obj = ordercode; return(JsonJC.ObjectToJson(_result)); } } } else { _result.Status = (int)CommonStatus.ProductLess; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); } } } } _result.Status = (int)CommonStatus.Fail; _result.Obj = ""; return(JsonJC.ObjectToJson(_result)); }
protected override void AttachChildControls() { this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts"); this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound); this.rptCartPointProducts = (VshopTemplatedRepeater)this.FindControl("rptCartPointProducts"); this.litTotal = (Literal)this.FindControl("litTotal"); this.divShowTotal = (HtmlGenericControl)this.FindControl("divShowTotal"); //this.aLink = (HtmlAnchor)this.FindControl("aLink"); this.Page.Session["stylestatus"] = "0"; this.cart = ShoppingCartProcessor.GetShoppingCartAviti(0); this.cartPoint = ShoppingCartProcessor.GetShoppingCartAviti(1); if (this.cart != null) { this.rptCartProducts.DataSource = this.cart; this.rptCartProducts.DataBind(); } else { Panel panel = (Panel)this.FindControl("products"); panel.Visible = false; } if (this.cartPoint != null) { this.rptCartPointProducts.DataSource = this.cartPoint; this.rptCartPointProducts.DataBind(); } else { Panel panel2 = (Panel)this.FindControl("pointproducts"); panel2.Visible = false; } if ((this.cart != null) || (this.cartPoint != null)) { //this.aLink.HRef = "/Vshop/SubmmitOrder.aspx"; } else { Panel panel3 = (Panel)this.FindControl("divEmpty"); panel3.Visible = true; Panel panel4 = (Panel)this.FindControl("pannelGo"); panel4.Visible = false; HtmlInputHidden hidden = (HtmlInputHidden)this.FindControl("hdIsShow"); hidden.Value = "1"; } decimal num = 0M; if (this.cart != null) { foreach (ShoppingCartInfo info in this.cart) { num += info.GetAmount(); } } int num2 = 0; if (this.cartPoint != null) { foreach (ShoppingCartInfo info in this.cartPoint) { num2 += info.GetTotalPoint(); } } PageTitle.AddSiteNameTitle("购物车"); string str = string.Empty; decimal num3 = num - this.ReductionMoneyALL; #region 购物车合计=购物车合计-积分兑换金额 MemberInfo currentMember = MemberProcessor.GetCurrentMember(); decimal PointsForMoney = 0; int UserId = currentMember.UserId;//获取用户编号 DataTable dt = service.SelIntegralSetInShopCar(UserId); for (int i = 0; i < dt.Rows.Count; i++) { if (!String.IsNullOrEmpty(dt.Rows[i]["IntegralSet"].ToString())) { PointsForMoney += Convert.ToDecimal(dt.Rows[i]["IntegralSet"]); } } num3 = num3 - PointsForMoney; #endregion if (num3 > 0M) { str = "¥" + num3.ToString("F2"); } if (num2 > 0) { str = str + "+" + num2.ToString() + "积分"; } this.litTotal.Text = str; }
protected override void AttachChildControls() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId)) { this.ShowWapMessage("错误的商品ID", "Default.aspx"); } if (base.ClientType.Equals(ClientType.VShop)) { FightGroupActivitiyModel fightGroupActivitiyModel = VShopHelper.GetFightGroupActivities(new FightGroupActivitiyQuery { PageIndex = 1, PageSize = 1, ProductId = this.productId, Status = EnumFightGroupActivitiyStatus.BeingCarried }).Models.FirstOrDefault(); if (fightGroupActivitiyModel != null) { this.Page.Response.Redirect("FightGroupActivityDetails.aspx?fightGroupActivityId=" + fightGroupActivitiyModel.FightGroupActivityId); } } this.hidSupplier = (HtmlInputHidden)this.FindControl("hidSupplier"); this.litSupplierName = (Literal)this.FindControl("litSupplierName"); this.aCountDownUrl = (HyperLink)this.FindControl("aCountDownUrl"); this.aCountDownUrl.Visible = false; this.divCountDownUrl = (HtmlGenericControl)this.FindControl("divCountDownUrl"); this.hidCanTakeOnStore = (HtmlInputHidden)this.FindControl("hidCanTakeOnStore"); this.HasActivitiesToJumpUrl(); this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations"); this.rptProductImages = (WapTemplatedRepeater)this.FindControl("rptProductImages"); this.rptCouponList = (WapTemplatedRepeater)this.FindControl("rptCouponList"); this.rp_guest = (WapTemplatedRepeater)this.FindControl("rp_guest"); this.rp_com = (WapTemplatedRepeater)this.FindControl("rp_com"); this.litProdcutName = (Literal)this.FindControl("litProdcutName"); this.litSalePrice = (Literal)this.FindControl("litSalePrice"); this.litMarketPrice = (Literal)this.FindControl("litMarketPrice"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.litDescription = (Literal)this.FindControl("litDescription"); this.ltlcombinamaininfo = (Literal)this.FindControl("ltlcombinamaininfo"); this.skuSubmitOrder = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder"); this.expandAttr = (Common_ExpandAttributes)this.FindControl("ExpandAttributes"); this.litSoldCount = (Literal)this.FindControl("litSoldCount"); this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount"); this.litReviewsCount = (Literal)this.FindControl("litReviewsCount"); this.litHasCollected = (HtmlInputHidden)this.FindControl("litHasCollected"); this.hidden_skus = (HtmlInputHidden)this.FindControl("hidden_skus"); this.ltlOrderPromotion = (Literal)this.FindControl("ltlOrderPromotion"); this.ltlOrderPromotion2 = (Literal)this.FindControl("ltlOrderPromotion2"); this.ltlProductSendGifts2 = (Literal)this.FindControl("ltlProductSendGifts2"); this.ltlProductSendGifts = (Literal)this.FindControl("ltlProductSendGifts"); this.liOrderPromotions = (HtmlGenericControl)this.FindControl("liOrderPromotions"); this.liOrderPromotions2 = (HtmlGenericControl)this.FindControl("liOrderPromotions2"); this.liProductSendGifts2 = (HtmlGenericControl)this.FindControl("liProductSendGifts2"); this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2"); this.liOrderPromotions_free = (HtmlGenericControl)this.FindControl("liOrderPromotions_free"); this.divActivities = (HtmlGenericControl)this.FindControl("divActivities"); this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2"); this.ltlOrderPromotion_free = (Literal)this.FindControl("ltlOrderPromotion_free"); this.liProductSendGifts = (HtmlGenericControl)this.FindControl("liProductSendGifts"); this.lbUserProductRefer = (UserProductReferLabel)this.FindControl("lbUserProductRefer"); this.divshiptoregion = (HtmlGenericControl)this.FindControl("divshiptoregion"); this.divwaplocateaddress = (HtmlGenericControl)this.FindControl("divwaplocateaddress"); this.productFreight = (ProductFreightLiteral)this.FindControl("productFreight"); this.promote = (ProductPromote)this.FindControl("ProductPromote"); this.hdAppId = (HtmlInputHidden)this.FindControl("hdAppId"); this.hdTitle = (HtmlInputHidden)this.FindControl("hdTitle"); this.hdDesc = (HtmlInputHidden)this.FindControl("hdDesc"); this.hdImgUrl = (HtmlInputHidden)this.FindControl("hdImgUrl"); this.hdLink = (HtmlInputHidden)this.FindControl("hdLink"); this.hidCombinaid = (HtmlInputHidden)this.FindControl("hidCombinaid"); this.divConsultationEmpty = (HtmlGenericControl)this.FindControl("divConsultationEmpty"); this.ulConsultations = (HtmlGenericControl)this.FindControl("ulConsultations"); this.divShortDescription = (HtmlGenericControl)this.FindControl("divShortDescription"); this.hidRegionId = (HtmlInputHidden)this.FindControl("hidRegionId"); this.divProductReferral = (HtmlGenericControl)this.FindControl("divProductReferral"); this.hidden_productId = (HtmlInputHidden)this.FindControl("hidden_productId"); this.hidCouponCount = (HtmlInputHidden)this.FindControl("hidCouponCount"); this.hidHasStores = (HtmlInputHidden)this.FindControl("hidHasStores"); this.divPodrequest = (HtmlGenericControl)this.FindControl("divPodrequest"); this.divGuest = (HtmlGenericControl)this.FindControl("divGuest"); this.divcombina = (HtmlGenericControl)this.FindControl("divcombina"); this.hidUnOnSale = (HtmlInputHidden)this.FindControl("hidUnOnSale"); this.hidUnAudit = (HtmlInputHidden)this.FindControl("hidUnAudit"); this.divPhonePrice = (HtmlGenericControl)this.FindControl("divPhonePrice"); this.litPhonePrice = (Literal)this.FindControl("litPhonePrice"); this.spdiscount = (HtmlGenericControl)this.FindControl("spdiscount"); this.ulsupplier = (HtmlGenericControl)this.FindControl("ulsupplier"); this.hdAppId.Value = masterSettings.WeixinAppId; HtmlInputHidden htmlInputHidden = this.hidRegionId; int num = HiContext.Current.DeliveryScopRegionId; htmlInputHidden.Value = num.ToString(); this.hidden_skuItem = (HtmlInputHidden)this.FindControl("hidden_skuItem"); this.hidCartQuantity = (HtmlInputHidden)this.FindControl("txCartQuantity"); this.lblStock = (StockLabel)this.FindControl("lblStock"); this.litUnit = (Literal)this.FindControl("litUnit"); ProductBrowseInfo wAPProductBrowseInfo = ProductBrowser.GetWAPProductBrowseInfo(this.productId, null, masterSettings.OpenMultStore, 0); if (wAPProductBrowseInfo.Product == null || wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete) { this.Page.Response.Redirect("ProductDelete.aspx"); return; } if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock) { base.GotoResourceNotFound("商品已经入库"); } if (wAPProductBrowseInfo.Product.ProductType == 1.GetHashCode()) { HttpContext.Current.Response.Redirect("ServiceProductDetails?productId=" + this.productId); } if (masterSettings.OpenMultStore) { if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId)) { this.hidHasStores.Value = "1"; this.hidCanTakeOnStore.Value = "1"; } } else if (masterSettings.IsOpenPickeupInStore && wAPProductBrowseInfo.Product.SupplierId == 0) { this.hidCanTakeOnStore.Value = "1"; } if (SalesHelper.IsSupportPodrequest() && wAPProductBrowseInfo.Product.SupplierId == 0) { this.divPodrequest.Visible = true; } if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale) { this.hidUnOnSale.Value = "1"; } HtmlInputHidden htmlInputHidden2 = this.hidUnAudit; num = (int)wAPProductBrowseInfo.Product.AuditStatus; htmlInputHidden2.Value = num.ToString(); if (this.spdiscount != null && HiContext.Current.User.UserId > 0) { MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(HiContext.Current.User.GradeId); this.spdiscount.Visible = true; this.spdiscount.InnerHtml = "<strong class='vip_price'><img src='/templates/pccommon/images/vip_price.png' />" + memberGrade.Name + "价</strong>"; } this.skuSubmitOrder.ProductInfo = wAPProductBrowseInfo.Product; this.lbUserProductRefer.product = wAPProductBrowseInfo.Product; this.productFreight.ShippingTemplateId = wAPProductBrowseInfo.Product.ShippingTemplateId; this.productFreight.Volume = wAPProductBrowseInfo.Product.Weight; this.productFreight.Weight = wAPProductBrowseInfo.Product.Weight; this.hdTitle.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.Title) ? wAPProductBrowseInfo.Product.ProductName : wAPProductBrowseInfo.Product.Title); this.hdDesc.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : wAPProductBrowseInfo.Product.ShortDescription); string oldValue = "/storage/master/product/images/"; string newValue = "/storage/master/product/thumbs410/410_"; string text = wAPProductBrowseInfo.Product.ImageUrl1; if (!string.IsNullOrEmpty(text)) { text = text.ToLower().Replace(oldValue, newValue); } string local = string.IsNullOrEmpty(text) ? SettingsManager.GetMasterSettings().DefaultProductImage : text; this.hdImgUrl.Value = Globals.FullPath(local); this.hdLink.Value = Globals.FullPath(HttpContext.Current.Request.Url.ToString()); if (this.hidCartQuantity != null) { this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(this.productId); } if (this.hidden_productId != null) { this.hidden_productId.Value = this.productId.ToString(); } if (this.promote != null) { this.promote.ProductId = this.productId; } MemberInfo user = HiContext.Current.User; if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || wAPProductBrowseInfo.Product.SubMemberDeduct.HasValue)) { if (!wAPProductBrowseInfo.Product.SubMemberDeduct.HasValue) { goto IL_0b8c; } decimal? subMemberDeduct = wAPProductBrowseInfo.Product.SubMemberDeduct; if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue) { goto IL_0b8c; } } goto IL_0bc6; IL_0bc6: int num2 = 1; goto IL_0bc7; IL_0bc7: if (num2 != 0) { this.divProductReferral.Visible = false; } bool flag = true; if (this.rptProductImages != null) { string locationUrl = "javascript:;"; if (string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl2) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl3) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl4) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl5)) { wAPProductBrowseInfo.Product.ImageUrl1 = masterSettings.DefaultProductImage; } DataTable skus = ProductBrowser.GetSkus(this.productId); List<SlideImage> list = new List<SlideImage>(); int supplierId = wAPProductBrowseInfo.Product.SupplierId; if (supplierId > 0) { SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId); if (supplierById != null) { this.hidSupplier.Value = "true"; this.litSupplierName.Text = "<a href=\"SupplierAbout?SupplierId=" + supplierById.SupplierId + "\">" + supplierById.SupplierName + "</a>"; } } else { this.hidSupplier.Value = "false"; flag = false; this.ulsupplier.Style.Add(HtmlTextWriterStyle.Display, "none"); } list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl1, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl2, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl3, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl4, locationUrl)); list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl5, locationUrl)); this.rptProductImages.DataSource = from item in list where !string.IsNullOrWhiteSpace(item.ImageUrl) select item; this.rptProductImages.DataBind(); } this.litProdcutName.Text = wAPProductBrowseInfo.Product.ProductName; this.litSalePrice.Text = ((wAPProductBrowseInfo.Product.MinSalePrice == wAPProductBrowseInfo.Product.MaxSalePrice) ? wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") : (wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") + "~" + wAPProductBrowseInfo.Product.MaxSalePrice.F2ToString("f2"))); if (wAPProductBrowseInfo.Product.MarketPrice.HasValue) { this.litMarketPrice.SetWhenIsNotNull(wAPProductBrowseInfo.Product.MarketPrice.GetValueOrDefault(decimal.Zero).F2ToString("f2")); } this.litShortDescription.Text = wAPProductBrowseInfo.Product.ShortDescription; this.divShortDescription.Visible = !string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription); if (this.litDescription != null) { string text2 = ""; Regex regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase); if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.MobbileDescription)) { text2 = regex.Replace(wAPProductBrowseInfo.Product.MobbileDescription, ""); } else if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.Description)) { text2 = regex.Replace(wAPProductBrowseInfo.Product.Description, ""); } text2 = text2.Replace("src", "data-url"); text2 = text2.Replace("vurl", "src"); this.litDescription.Text = text2; } Literal control = this.litSoldCount; num = wAPProductBrowseInfo.Product.ShowSaleCounts; control.SetWhenIsNotNull(num.ToString() + wAPProductBrowseInfo.Product.Unit); if (this.expandAttr != null) { this.expandAttr.ProductId = this.productId; } Literal control2 = this.litConsultationsCount; num = wAPProductBrowseInfo.ConsultationCount; control2.SetWhenIsNotNull(num.ToString()); Literal control3 = this.litReviewsCount; num = wAPProductBrowseInfo.ReviewCount; control3.SetWhenIsNotNull(num.ToString()); MemberInfo user2 = HiContext.Current.User; bool flag2 = false; if (user2 != null) { flag2 = ProductBrowser.CheckHasCollect(user2.UserId, this.productId); } this.litHasCollected.SetWhenIsNotNull(flag2 ? "1" : "0"); this.BindCouponList(); PageTitle.AddSiteNameTitle(wAPProductBrowseInfo.Product.ProductName); this.BindCombinaBuyInfo(); this.BindPromotionInfo(); this.BindGuestProducts(); DataTable dBConsultations = wAPProductBrowseInfo.DBConsultations; for (int i = 0; i < dBConsultations.Rows.Count; i++) { dBConsultations.Rows[i]["UserName"] = DataHelper.GetHiddenUsername(dBConsultations.Rows[i]["UserName"].ToNullString()); } this.rptProductConsultations.DataSource = dBConsultations; this.rptProductConsultations.DataBind(); this.divConsultationEmpty.Visible = dBConsultations.IsNullOrEmpty(); this.ulConsultations.Visible = !dBConsultations.IsNullOrEmpty(); string phonePriceByProductId = PromoteHelper.GetPhonePriceByProductId(this.productId); if (!string.IsNullOrEmpty(phonePriceByProductId)) { this.divPhonePrice.Visible = true; decimal num3 = phonePriceByProductId.Split(',')[0].ToDecimal(0); this.litPhonePrice.Text = num3.F2ToString("f2"); decimal num4 = wAPProductBrowseInfo.Product.MinSalePrice - num3; this.litSalePrice.Text = ((num4 > decimal.Zero) ? num4 : decimal.Zero).F2ToString("f2"); this.lbUserProductRefer.MobileExclusive = num3; } if (flag || this.liOrderPromotions.Visible || this.liOrderPromotions_free2.Visible || this.liProductSendGifts.Visible || this.rptCouponList.Visible) { this.divActivities.Visible = true; } else { this.divActivities.Visible = false; } return; IL_0b8c: if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null) { num2 = (user.Referral.IsRepeled ? 1 : 0); goto IL_0bc7; } goto IL_0bc6; }
protected override void AttachChildControls() { this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts"); this.rptCartProducts.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound); this.rptCartPointProducts = (VshopTemplatedRepeater)this.FindControl("rptCartPointProducts"); this.litTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litTotal"); this.divShowTotal = (System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("divShowTotal"); this.aLink = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("aLink"); this.Page.Session["stylestatus"] = "0"; this.cart = ShoppingCartProcessor.GetShoppingCartAviti(0); this.cartPoint = ShoppingCartProcessor.GetShoppingCartAviti(1); if (this.cart != null) { this.rptCartProducts.DataSource = this.cart; this.rptCartProducts.DataBind(); } else { System.Web.UI.WebControls.Panel panel = (System.Web.UI.WebControls.Panel) this.FindControl("products"); panel.Visible = false; } if (this.cartPoint != null) { this.rptCartPointProducts.DataSource = this.cartPoint; this.rptCartPointProducts.DataBind(); } else { System.Web.UI.WebControls.Panel panel2 = (System.Web.UI.WebControls.Panel) this.FindControl("pointproducts"); panel2.Visible = false; } if (this.cart != null || this.cartPoint != null) { this.aLink.HRef = "/Vshop/SubmmitOrder.aspx"; } else { System.Web.UI.WebControls.Panel panel3 = (System.Web.UI.WebControls.Panel) this.FindControl("divEmpty"); panel3.Visible = true; System.Web.UI.WebControls.Panel panel4 = (System.Web.UI.WebControls.Panel) this.FindControl("pannelGo"); panel4.Visible = false; System.Web.UI.HtmlControls.HtmlInputHidden htmlInputHidden = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hdIsShow"); htmlInputHidden.Value = "1"; } decimal d = 0m; if (this.cart != null) { foreach (ShoppingCartInfo current in this.cart) { d += current.GetAmount(); } } int num = 0; if (this.cartPoint != null) { foreach (ShoppingCartInfo current in this.cartPoint) { num += current.GetTotalPoint(); } } PageTitle.AddSiteNameTitle("购物车"); string text = string.Empty; decimal d2 = d - this.ReductionMoneyALL; if (d2 > 0m) { text = "¥" + d2.ToString("F2"); } if (num > 0) { if (d2 > 0m) { text += "+"; } text = text + num.ToString() + "积分"; } this.litTotal.Text = text; }
protected override void AttachChildControls() { if (!int.TryParse(base.GetParameter("PreSaleId", false), out this.preSaleId)) { base.GotoResourceNotFound(); } ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.preSaleId); if (productPreSaleInfo == null) { base.GotoResourceNotFound(); } this.productId = productPreSaleInfo.ProductId; if (productPreSaleInfo.PreSaleEndDate < DateTime.Now) { this.Page.Response.Redirect("/ProductDetails.aspx?productId=" + this.productId); return; } this.hidSupName = (HtmlInputHidden)this.FindControl("hidSupName"); this.litSupplierName = (Literal)this.FindControl("litSupplierName"); this.hiddenpid = (HtmlInputHidden)this.FindControl("hiddenpid"); this.hidCartQuantity = (HtmlInputHidden)this.FindControl("txCartQuantity"); this.hiddenpid.Value = this.productId.ToString(); this.common_Location = (Common_Location)this.FindControl("common_Location"); this.litProductName = (Literal)this.FindControl("litProductName"); this.lblStock = (StockLabel)this.FindControl("lblStock"); this.litUnit = (Literal)this.FindControl("litUnit"); this.litSaleCounts = (Literal)this.FindControl("litSaleCounts"); this.lblBuyPrice = (Label)this.FindControl("lblBuyPrice"); this.lblTotalPrice = (TotalLabel)this.FindControl("lblTotalPrice"); this.lblSku = (SkuLabel)this.FindControl("lblSku"); this.litDescription = (Literal)this.FindControl("litDescription"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.btnBuy = (BuyButton)this.FindControl("btnBuy"); this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations"); this.ltlSaleCount = (Literal)this.FindControl("ltlSaleCount"); this.ltlReviewCount = (Literal)this.FindControl("ltlReviewCount"); this.litReviewCount = (Literal)this.FindControl("litReviewCount"); this.ltlConsultation = (Literal)this.FindControl("ltlConsultation"); this.images = (Common_ProductImages)this.FindControl("common_ProductImages"); this.rptExpandAttributes = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes"); this.rptOnlineService = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService"); this.skuSelector = (SKUSelector)this.FindControl("SKUSelector"); this.consultations = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations"); this.correlative = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative"); this.lbUserProductRefer = (UserProductReferLabel)this.FindControl("lbUserProductRefer"); this.hidden_skus = (HtmlInputHidden)this.FindControl("hidden_skus"); this.hidden_skuItem = (HtmlInputHidden)this.FindControl("hidden_skuItem"); this.hidIsOpenMultiStore = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore"); this.aCountDownUrl = (HyperLink)this.FindControl("aCountDownUrl"); this.imgQrCode = (Image)this.FindControl("imgQrCode"); this.hidden_productId = (HtmlInputHidden)this.FindControl("hidden_productId"); this.hidHasStores = (HtmlInputHidden)this.FindControl("hidHasStores"); this.divGift = (HtmlGenericControl)this.FindControl("divGift"); this.ltlGiftName = (Literal)this.FindControl("ltlGiftName"); this.ltlGiftNum = (Literal)this.FindControl("ltlGiftNum"); this.aBrand = (HtmlAnchor)this.FindControl("aBrand"); this.imgBrand = (HiImage)this.FindControl("imgBrand"); this.imgCustomerService = (HtmlImage)this.FindControl("imgCustomerService"); this.ltlOrderPromotion = (Literal)this.FindControl("ltlOrderPromotion"); this.divOrderPromotions = (HtmlGenericControl)this.FindControl("divOrderPromotions"); this.divOrderPromotions2 = (HtmlGenericControl)this.FindControl("divOrderPromotions2"); this.divOrderPromotions4 = (HtmlGenericControl)this.FindControl("divOrderPromotions4"); this.divOrderPromotions3 = (HtmlGenericControl)this.FindControl("divOrderPromotions3"); this.ltlOrderPromotion_free = (Literal)this.FindControl("ltlOrderPromotion_free"); this.litPhonePrice = (Literal)this.FindControl("litPhonePrice"); this.litPhonePriceEndDate = (Literal)this.FindControl("litPhonePriceEndDate"); this.divCuxiao = (HtmlGenericControl)this.FindControl("divCuxiao"); this.ltlUnit = (Literal)this.FindControl("ltlUnit"); this.divProductReferral = (HtmlGenericControl)this.FindControl("divProductReferral"); this.ltlProductSendGifts = (Literal)this.FindControl("ltlProductSendGifts"); this.ltlPromotionSendGifts = (Literal)this.FindControl("ltlPromotionSendGifts"); this.setDeliverRegion = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion"); this.divqq = (HtmlGenericControl)this.FindControl("divqq"); this.lblPaymentStartDate = (Label)this.FindControl("lblPaymentStartDate"); this.lblPaymentEndDate = (Label)this.FindControl("lblPaymentEndDate"); this.lblDelivery = (Label)this.FindControl("lblDelivery"); this.lblDepositPercent = (Label)this.FindControl("lblDepositPercent"); this.lblDeposit = (Label)this.FindControl("lblDeposit"); this.lblFinalPaymentPercent = (Label)this.FindControl("lblFinalPaymentPercent"); this.lblFinalPayment = (Label)this.FindControl("lblFinalPayment"); this.hidEndDate = (HtmlInputHidden)this.FindControl("hidEndDate"); this.hidNowDate = (HtmlInputHidden)this.FindControl("hidNowDate"); this.hidDepositPercent = (HtmlInputHidden)this.FindControl("hidDepositPercent"); this.hidDeposit = (HtmlInputHidden)this.FindControl("hidDeposit"); ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts"); this.aCountDownUrl.Visible = false; if (this.Page.IsPostBack) { return; } if (this.imgQrCode != null) { string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png"; Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png); this.imgQrCode.ImageUrl = text; } ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, -1); if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete) { this.Page.Response.Redirect("/ProductDelete.aspx"); return; } this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId; this.setDeliverRegion.Volume = productBrowseInfo.Product.Weight; this.setDeliverRegion.Weight = productBrowseInfo.Product.Weight; this.ActivityBusiness(); if (this.hidCartQuantity != null) { this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId); } IEnumerable value = from item in productBrowseInfo.Product.Skus select item.Value; if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null) { this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs); } if (this.hidden_skus != null) { this.hidden_skus.Value = JsonConvert.SerializeObject(value); } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale) { this.Page.Response.Redirect(base.GetRouteUrl("unproductdetails", new { ProductId = this.productId })); } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库")); return; } this.hidden_productId.Value = this.productId.ToString(); this.LoadPageSearch(productBrowseInfo.Product); if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage) { this.lbUserProductRefer.product = productBrowseInfo.Product; } HyperLink hyperLink = this.hpkProductConsultations; int num = productBrowseInfo.ConsultationCount; hyperLink.Text = "查看全部" + num.ToString() + "条咨询"; Literal literal = this.ltlConsultation; num = productBrowseInfo.ConsultationCount; literal.Text = num.ToString(); Literal literal2 = this.ltlSaleCount; num = productBrowseInfo.SaleCount; literal2.Text = num.ToString(); Literal literal3 = this.ltlReviewCount; num = productBrowseInfo.ReviewCount; literal3.Text = num.ToString(); Literal literal4 = this.litReviewCount; num = productBrowseInfo.ReviewCount; literal4.Text = num.ToString(); this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}"; this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName); HtmlInputHidden htmlInputHidden = this.hidNowDate; DateTime dateTime = DateTime.Now; htmlInputHidden.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); HtmlInputHidden htmlInputHidden2 = this.hidEndDate; dateTime = productPreSaleInfo.PreSaleEndDate; htmlInputHidden2.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); Label label = this.lblPaymentStartDate; dateTime = productPreSaleInfo.PaymentStartDate; label.Text = dateTime.ToString("yyyy.MM.dd"); Label label2 = this.lblPaymentEndDate; dateTime = productPreSaleInfo.PaymentEndDate; label2.Text = dateTime.ToString("yyyy.MM.dd"); Label label3 = this.lblDelivery; object text2; if (productPreSaleInfo.DeliveryDays <= 0) { dateTime = productPreSaleInfo.DeliveryDate.Value; text2 = dateTime.ToString("yyyy.MM.dd") + "前发货"; } else { text2 = "尾款支付后" + productPreSaleInfo.DeliveryDays + "天发货"; } label3.Text = (string)text2; decimal d; if (productPreSaleInfo.DepositPercent > 0) { this.lblDepositPercent.Text = "定金:" + productPreSaleInfo.DepositPercent + "%"; this.lblFinalPaymentPercent.Text = "尾款:" + (100 - productPreSaleInfo.DepositPercent) + "%"; decimal num2 = Math.Round(productBrowseInfo.Product.MinSalePrice * (decimal)productPreSaleInfo.DepositPercent / 100m, 2); this.lblDeposit.Text = "¥" + num2; this.lblFinalPayment.Text = "¥" + Math.Round(productBrowseInfo.Product.MinSalePrice - num2, 2); HtmlInputHidden htmlInputHidden3 = this.hidDepositPercent; num = productPreSaleInfo.DepositPercent; htmlInputHidden3.Value = num.ToString(); } else { this.lblDeposit.Text = "定金:¥" + productPreSaleInfo.Deposit; this.lblFinalPayment.Text = "尾款:¥" + Math.Round(productBrowseInfo.Product.MinSalePrice - productPreSaleInfo.Deposit, 2); HtmlInputHidden htmlInputHidden4 = this.hidDeposit; d = productPreSaleInfo.Deposit; htmlInputHidden4.Value = d.ToString(); } this.btnBuy.Stock = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock); this.ltlUnit.Text = productBrowseInfo.Product.Unit; this.divqq.Visible = (this.sitesettings.ServiceIsOpen == "1"); MemberInfo user = HiContext.Current.User; if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productBrowseInfo.Product.SubMemberDeduct.HasValue)) { if (!productBrowseInfo.Product.SubMemberDeduct.HasValue) { goto IL_0d79; } decimal?subMemberDeduct = productBrowseInfo.Product.SubMemberDeduct; d = default(decimal); if (!(subMemberDeduct.GetValueOrDefault() <= d) || !subMemberDeduct.HasValue) { goto IL_0d79; } } goto IL_0d9f; IL_0da0: int num3; if (num3 != 0) { this.divProductReferral.Visible = false; } BrowsedProductQueue.EnQueue(this.productId); this.images.ImageInfo = productBrowseInfo.Product; if (productBrowseInfo.DbAttribute != null) { this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute; this.rptExpandAttributes.DataBind(); } if (productBrowseInfo.DbSKUs != null) { this.skuSelector.ProductId = this.productId; this.skuSelector.DataSource = productBrowseInfo.DbSKUs; } if (productBrowseInfo.Product.BrandId.HasValue) { BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value); if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo)) { this.imgBrand.ImageUrl = brandCategory.Logo; this.aBrand.HRef = base.GetRouteUrl("branddetails", new { brandId = brandCategory.BrandId }); } } int supplierId = productBrowseInfo.Product.SupplierId; if (supplierId > 0) { SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId); if (!string.IsNullOrEmpty(supplierById.Picture)) { this.imgBrand.ImageUrl = supplierById.Picture; } else if (productBrowseInfo.Product.BrandId.HasValue) { BrandCategoryInfo brandCategory2 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value); if (brandCategory2 != null && !string.IsNullOrEmpty(brandCategory2.Logo)) { this.imgBrand.ImageUrl = brandCategory2.Logo; this.aBrand.HRef = base.GetRouteUrl("branddetails", new { brandId = brandCategory2.BrandId }); } } else { this.imgBrand.Visible = false; } this.litSupplierName.Text = supplierById.SupplierName; this.hidSupName.Value = supplierById.SupplierName; } else { this.litSupplierName.Visible = false; if (productBrowseInfo.Product.BrandId.HasValue) { BrandCategoryInfo brandCategory3 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value); if (brandCategory3 != null && !string.IsNullOrEmpty(brandCategory3.Logo)) { this.imgBrand.ImageUrl = brandCategory3.Logo; this.aBrand.HRef = base.GetRouteUrl("branddetails", new { brandId = brandCategory3.BrandId }); } } } if (productBrowseInfo.DBConsultations != null) { this.consultations.DataSource = productBrowseInfo.DBConsultations; this.consultations.DataBind(); } if (productBrowseInfo.DbCorrelatives != null) { this.correlative.DataSource = productBrowseInfo.DbCorrelatives; this.correlative.DataBind(); } this.BindOrderPromotions(); if (!this.divOrderPromotions.Visible && !this.divOrderPromotions2.Visible && !this.divOrderPromotions3.Visible) { this.divCuxiao.Style.Add("display", "none"); } if (this.rptOnlineService != null) { IList <OnlineServiceInfo> allOnlineService = OnlineServiceHelper.GetAllOnlineService(0, 1); IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2); if (allOnlineService2 != null) { foreach (OnlineServiceInfo item in allOnlineService2) { allOnlineService.Add(item); } } this.rptOnlineService.DataSource = allOnlineService; this.rptOnlineService.DataBind(); } return; IL_0d9f: num3 = 1; goto IL_0da0; IL_0d79: if (HiContext.Current.SiteSettings.OpenReferral == 1) { num3 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0); goto IL_0da0; } goto IL_0d9f; }
protected override void AttachChildControls() { this.litShipTo = (Literal)this.FindControl("litShipTo"); this.litIsUseBalance = (Literal)this.FindControl("litIsUseBalance"); this.litCellPhone = (Literal)this.FindControl("litCellPhone"); this.litAddress = (Literal)this.FindControl("litAddress"); this.litShowMes = (Literal)this.FindControl("litShowMes"); this.GetUserCoupons = MemberProcessor.GetUserCoupons(); this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts"); this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound); this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.litPointNumber = (Literal)this.FindControl("litPointNumber"); this.litUseMembersPointShow = (Literal)this.FindControl("litUseMembersPointShow"); this.litDisplayPointNumber = (Literal)this.FindControl("litDisplayPointNumber"); this.litDisplayPoint = (Literal)this.FindControl("litDisplayPoint"); this.BalanceCanPayMoney = (HtmlInputHidden)this.FindControl("BalanceCanPayMoney"); this.groupbuyHiddenBox = (HtmlInputControl)this.FindControl("groupbuyHiddenBox"); this.rptAddress = (VshopTemplatedRepeater)this.FindControl("rptAddress"); this.selectShipTo = (HtmlInputHidden)this.FindControl("selectShipTo"); this.MembersPointMoney = (HtmlInputHidden)this.FindControl("MembersPointMoney"); this.regionId = (HtmlInputHidden)this.FindControl("regionId"); this.litAddAddress = (Literal)this.FindControl("litAddAddress"); IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(); this.rptAddress.DataSource = from item in shippingAddresses orderby item.IsDefault select item; this.rptAddress.DataBind(); ShippingAddressInfo info = shippingAddresses.FirstOrDefault <ShippingAddressInfo>(item => item.IsDefault); if (info == null) { info = (shippingAddresses.Count > 0) ? shippingAddresses[0] : null; } if (info != null) { this.litShipTo.Text = info.ShipTo; this.litCellPhone.Text = info.CellPhone; this.litAddress.Text = info.Address; this.selectShipTo.SetWhenIsNotNull(info.ShippingId.ToString()); this.regionId.SetWhenIsNotNull(info.RegionId.ToString()); } this.litAddAddress.Text = "<li><a href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()) + "'>新增收货地址</a></li>"; if ((shippingAddresses == null) || (shippingAddresses.Count == 0)) { this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString())); } else { List <ShoppingCartInfo> orderSummitCart = new List <ShoppingCartInfo>(); if (((int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"])) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"])) && ((this.Page.Request.QueryString["from"] == "signBuy") || (this.Page.Request.QueryString["from"] == "groupBuy"))) { this.productSku = this.Page.Request.QueryString["productSku"]; if (this.isbargain) { int bargainDetialId = Globals.RequestQueryNum("bargainDetialId"); orderSummitCart = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0); } else { int buyAmount = this.buyAmount; int id = Globals.RequestQueryNum("limitedTimeDiscountId"); if (id > 0) { bool flag = true; LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(id); if (discountInfo == null) { flag = false; } if (flag) { if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, base.CurrentMemberInfo.UserId)) { if (discountInfo.LimitNumber != 0) { int num4 = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(id, this.productSku, 0, base.CurrentMemberInfo.UserId, false); if (this.buyAmount > (discountInfo.LimitNumber - num4)) { buyAmount = discountInfo.LimitNumber - num4; } } } else { id = 0; } } else { id = 0; } } if (id > 0) { ShoppingCartProcessor.RemoveLineItem(this.productSku, 0, id); } if ((buyAmount == 0) && (id > 0)) { buyAmount = this.buyAmount; id = 0; } orderSummitCart = ShoppingCartProcessor.GetListShoppingCart(this.productSku, buyAmount, 0, id); } } else { orderSummitCart = ShoppingCartProcessor.GetOrderSummitCart(); } if (orderSummitCart == null) { HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>"); } else { if (orderSummitCart.Count > 1) { this.litShowMes.Text = "<div style=\"color: #F60; \"><img src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>"; } this.rptCartProducts.DataSource = orderSummitCart; this.rptCartProducts.DataBind(); decimal num5 = 0M; decimal num6 = 0M; decimal num7 = 0M; int num8 = 0; foreach (ShoppingCartInfo info3 in orderSummitCart) { num8 += info3.GetPointNumber; num5 += info3.Total; num6 += info3.Exemption; num7 += info3.ShipCost; } decimal num9 = num6; decimal d = num5 - num9; if (d <= 0M) { d = 0M; } d = decimal.Round(d, 2); this.litOrderTotal.Text = d.ToString("F2"); if (num8 == 0) { this.litDisplayPointNumber.Text = "style=\"display:none;\""; } this.litPointNumber.Text = num8.ToString(); int num11 = base.CurrentMemberInfo.Points - num8; decimal num12 = 0M; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); if ((d * masterSettings.PointToCashRate) > base.CurrentMemberInfo.Points) { if (num11 > (masterSettings.PonitToCash_MaxAmount * masterSettings.PointToCashRate)) { num12 = masterSettings.PonitToCash_MaxAmount; num11 = ((int)masterSettings.PonitToCash_MaxAmount) * masterSettings.PointToCashRate; } else { num12 = num11 / masterSettings.PointToCashRate; } } else { num12 = masterSettings.PonitToCash_MaxAmount; if (num12 > d) { num12 = d; } num12 = decimal.Round(num12, 2); num11 = (int)(num12 * masterSettings.PointToCashRate); } if (num11 <= 0) { num11 = 0; num12 = 0M; } this.MembersPointMoney.Value = num12.ToString("F2"); if (num11 > 0) { this.litUseMembersPointShow.Text = string.Concat(new object[] { "<input type='hidden' id='hdCanUsePoint' value='", num11, "'/><input type='hidden' id='hdCanUsePointMoney' value='", num12.ToString("F2"), "'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span id=\"usepointnum\">", num11, "</span>积分抵 <span class=\"colorr\">\x00a5<span id=\"usepointmoney\">", num12.ToString("F2"), "</span></span>元</div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\"><input type=\"checkbox\" /></div>" }); } else { this.litUseMembersPointShow.Text = "<input type='hidden' id='hdCanUsePoint' value='0'/><input type='hidden' id='hdCanUsePointMoney' value='0'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span id=\"usepointnum\">0</span>积分 <span id=\"usepointmoney\" style=\"display:none\">" + num12.ToString("F2") + "</span></div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\" style=\"display:none\"><input type=\"checkbox\" disabled /></div>"; } decimal availableAmount = 0M; if (d > base.CurrentMemberInfo.AvailableAmount) { availableAmount = base.CurrentMemberInfo.AvailableAmount; this.BalanceCanPayMoney.Value = base.CurrentMemberInfo.AvailableAmount.ToString("F2"); } else { availableAmount = d; this.BalanceCanPayMoney.Value = d.ToString("F2"); } if ((base.CurrentMemberInfo.AvailableAmount > 0M) && masterSettings.EnableBalancePayment) { this.litIsUseBalance.Text = "<div class=\"prompt-text pull-left\">余额支付 <span class=\"colorr\">\x00a5<span id=\"spCanpayMoney\">" + availableAmount.ToString("F2") + "</span></span>(可用 \x00a5<span id=\"spAvailableAmount\">" + base.CurrentMemberInfo.AvailableAmount.ToString("F2") + "</span>)</div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\"><input type=\"checkbox\" " + ((availableAmount > 0M) ? "" : " disabled") + " /></div></div>"; } else { this.litIsUseBalance.Text = "<div class=\"prompt-text pull-left\"" + (masterSettings.EnableBalancePayment ? "" : " style=\"display:none\"") + ">余额可用 <span class=\"colorr\">\x00a5<span id=\"spCanpayMoney\">0.00</span></span><span id=\"spAvailableAmount\" style=\"display:none\">0.00</span></div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\" style=\"display:none\"><input type=\"checkbox\" disabled /></div></div>"; } if (!masterSettings.PonitToCash_Enable) { this.litDisplayPoint.Text = " style=\"display:none;\""; } PageTitle.AddSiteNameTitle("订单确认"); } } }
protected override void AttachChildControls() { this.litProductTotalPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litProductTotalPrice"); this.litTotalTax = (System.Web.UI.WebControls.Literal) this.FindControl("litTotalTax"); this.listOrders = (EcShop.UI.SaleSystem.Tags.Common_CartSupplierProducts) this.FindControl("common_cartsupplierproducts"); this.listOrders.ItemDataBound += new EcShop.UI.SaleSystem.Tags.Common_CartSupplierProducts.DataBindEventHandler(this.listOrders_ItemDataBound); this.litTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litTotal"); #region 处理cookie中的购物车和收藏信息 Member curMember = HiContext.Current.User as Member; if (curMember != null && !curMember.IsAnonymous) { ShoppingCartInfo cookieShoppingCart = ShoppingCartProcessor.GetCookieShoppingCart(); if (cookieShoppingCart != null) { ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart); ShoppingCartProcessor.ClearCookieShoppingCart(); } System.Web.HttpCookie cookieFavorite = HiContext.Current.Context.Request.Cookies["Hid_Ecshop_Favorite_Data_New"]; if (cookieFavorite != null && !string.IsNullOrEmpty(cookieFavorite.Value)) { string[] favoriteProductIds = cookieFavorite.Value.Split('|'); int productId = 0; foreach (string fav in favoriteProductIds) { try { productId = int.Parse(fav); int favoriteId; ProductBrowser.AddProductToFavorite(productId, curMember.UserId, out favoriteId); } catch { continue; } } cookieFavorite.Expires = DateTime.Now.AddDays(-1); HttpContext.Current.Response.Cookies.Add(cookieFavorite); } } #endregion ShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetShoppingCart(); if (shoppingCart != null) { //foreach (ShoppingCartItemInfo item in shoppingCart.LineItems) //{ // item.TaxRate = Math.Round(item.TaxRate * 100, 0); //} IList <ShoppingCartItemInfo> list = shoppingCart.LineItems; IQueryable <ShoppingCartItemInfo> queryableList = new EnumerableQuery <ShoppingCartItemInfo>(list); var query = from q in queryableList group q by new { id = q.SupplierId } into q1 select new { SupplierId = q1.FirstOrDefault().SupplierId, //Amount = q1.Sum(x => x.SupplierId) SupplierName = q1.FirstOrDefault().SupplierName, SupplierLogo = q1.FirstOrDefault().Logo }; this.listOrders.DataSource = query; this.listOrders.DataBind(); this.litTotal.Text = shoppingCart.GetNewAmount().ToString("F2"); decimal totaltax = shoppingCart.CalTotalTax();// shoppingCart.CalTotalTax(); //this.litTotalTax.Text = (totaltax < 50 ? "0.00" : totaltax.ToString("F2")); if (totaltax <= 50) { this.litTotalTax.Text = string.Format("<span style='text-decoration: line-through;'>{0}</span>", totaltax.ToString("F2")); } else { this.litTotalTax.Text = string.Format("{0}", totaltax.ToString("F2")); } this.litProductTotalPrice.Text = shoppingCart.GetNewAmount().ToString("F2"); //shoppingCart.GetTotal().ToString("F2"); } HttpCookie httpCookieShoppingCart = new HttpCookie("cn"); string quantity = "0"; if (shoppingCart != null) { quantity = shoppingCart.GetQuantity().ToString(); } httpCookieShoppingCart.Value = quantity; httpCookieShoppingCart.Expires = System.DateTime.Now.AddYears(1); HttpContext.Current.Response.Cookies.Add(httpCookieShoppingCart); HttpCookie cookieSkuIds = this.Page.Request.Cookies["UserSession-SkuIds"]; if (cookieSkuIds != null) { cookieSkuIds.Expires = DateTime.Now.AddDays(-1); cookieSkuIds.Values.Clear(); HttpContext.Current.Response.AppendCookie(cookieSkuIds); } PageTitle.AddSiteNameTitle("购物车"); }
private void SelectItem(System.Web.HttpContext context) { string skuId = context.Request["skuId"]; string skuIds = context.Request["pids"]; int num = 1; int.TryParse(context.Request["quantity"], out num); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("{"); int skuStock = ShoppingCartProcessor.GetSkuStock(skuId); if (num > skuStock) { stringBuilder.AppendFormat("\"Status\":\"{0}\"", skuStock); num = skuStock; stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); context.Response.End(); } ShoppingCartProcessor.UpdateLineItemQuantity(skuId, (num > 0) ? num : 1); if (skuIds == null) { stringBuilder.Append("\"Success\":0"); stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); context.Response.End(); } ShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetPartShoppingCartInfo(skuIds); if (shoppingCart == null || shoppingCart.LineItems.Count == 0) { stringBuilder.Append("\"Success\":1,"); stringBuilder.Append("\"AmoutPrice\":\"0.00\","); stringBuilder.Append("\"ReducedPromotion\":\"0.00\","); stringBuilder.Append("\"ReducedPromotionName\":\"\","); stringBuilder.Append("\"Tax\":\"0.00\","); stringBuilder.Append("\"ActivityReduct\":\"0.00\","); stringBuilder.Append("\"TotalPrice\":\"0.00\""); stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); context.Response.End(); return; } HttpCookie cookie = new HttpCookie("UserSession-SkuIds"); cookie.Value = Globals.UrlEncode(skuIds); cookie.Expires = DateTime.Now.AddDays(1); context.Response.AppendCookie(cookie); stringBuilder.Append("\"Success\":1,"); stringBuilder.AppendFormat("\"AmoutPrice\":\"{0}\",", shoppingCart.GetNewAmount().ToString("F2")); stringBuilder.AppendFormat("\"ReducedPromotion\":\"{0}\",", shoppingCart.ReducedPromotionAmount.ToString("F2")); stringBuilder.AppendFormat("\"ReducedPromotionName\":\"{0}\",", shoppingCart.ReducedPromotionName); decimal tax = shoppingCart.CalTotalTax(); stringBuilder.AppendFormat("\"Tax\":\"{0}\",", tax.ToString("F2")); decimal activityReduct = shoppingCart.GetActivityPrice(); stringBuilder.AppendFormat("\"ActivityReduct\":\"{0}\",", activityReduct == 0 ? "0.00" : activityReduct.ToString("F2")); stringBuilder.AppendFormat("\"NavigateUrl\":\"{0}\",", Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails", new object[] { shoppingCart.ReducedPromotionId }).ClearForJson()); stringBuilder.AppendFormat("\"TotalPrice\":\"{0}\"", shoppingCart.GetNewTotalIncludeTax().ToString("F2")); stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); }
protected override void AttachChildControls() { if (!int.TryParse(base.GetParameter("productId", false), out this.productId)) { base.GotoResourceNotFound(); } this.hidSupName = (HtmlInputHidden)this.FindControl("hidSupName"); this.litSupplierName = (Literal)this.FindControl("litSupplierName"); this.hiddenpid = (HtmlInputHidden)this.FindControl("hiddenpid"); this.hidCartQuantity = (HtmlInputHidden)this.FindControl("txCartQuantity"); this.hiddenpid.Value = this.productId.ToString(); this.common_Location = (Common_Location)this.FindControl("common_Location"); this.litProductName = (Literal)this.FindControl("litProductName"); this.lblStock = (StockLabel)this.FindControl("lblStock"); this.litUnit = (Literal)this.FindControl("litUnit"); this.litSaleCounts = (Literal)this.FindControl("litSaleCounts"); this.lblMarkerPrice = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice"); this.lblBuyPrice = (Label)this.FindControl("lblBuyPrice"); this.lblTotalPrice = (TotalLabel)this.FindControl("lblTotalPrice"); this.lblSku = (SkuLabel)this.FindControl("lblSku"); this.litDescription = (Literal)this.FindControl("litDescription"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.btnBuy = (BuyButton)this.FindControl("btnBuy"); this.btnaddgouwu = (AddCartButton)this.FindControl("btnaddgouwu"); this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations"); this.ltlSaleCount = (Literal)this.FindControl("ltlSaleCount"); this.ltlReviewCount = (Literal)this.FindControl("ltlReviewCount"); this.litReviewCount = (Literal)this.FindControl("litReviewCount"); this.ltlConsultation = (Literal)this.FindControl("ltlConsultation"); this.images = (Common_ProductImages)this.FindControl("common_ProductImages"); this.rptExpandAttributes = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes"); this.rptOnlineService = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService"); this.skuSelector = (SKUSelector)this.FindControl("SKUSelector"); this.consultations = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations"); this.correlative = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative"); this.lbUserProductRefer = (UserProductReferLabel)this.FindControl("lbUserProductRefer"); this.hidden_skus = (HtmlInputHidden)this.FindControl("hidden_skus"); this.hidden_skuItem = (HtmlInputHidden)this.FindControl("hidden_skuItem"); this.hidIsOpenMultiStore = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore"); this.aCountDownUrl = (HyperLink)this.FindControl("aCountDownUrl"); this.imgQrCode = (Image)this.FindControl("imgQrCode"); this.phonePriceQrCode = (Image)this.FindControl("phonePriceQrCode"); this.liCode = (HtmlGenericControl)this.FindControl("liCode"); this.hidden_productId = (HtmlInputHidden)this.FindControl("hidden_productId"); this.hidHasStores = (HtmlInputHidden)this.FindControl("hidHasStores"); this.divGift = (HtmlGenericControl)this.FindControl("divGift"); this.ltlGiftName = (Literal)this.FindControl("ltlGiftName"); this.ltlGiftNum = (Literal)this.FindControl("ltlGiftNum"); this.aBrand = (HtmlAnchor)this.FindControl("aBrand"); this.imgBrand = (HiImage)this.FindControl("imgBrand"); this.imgpdorequest = (HtmlImage)this.FindControl("imgpdorequest"); this.imgTakeonstore = (HtmlImage)this.FindControl("imgTakeonstore"); this.imgCustomerService = (HtmlImage)this.FindControl("imgCustomerService"); this.ltlOrderPromotion = (Literal)this.FindControl("ltlOrderPromotion"); this.ltlOrderPromotion_free = (Literal)this.FindControl("ltlOrderPromotion_free"); this.divOrderPromotions = (HtmlGenericControl)this.FindControl("divOrderPromotions"); this.divOrderPromotions2 = (HtmlGenericControl)this.FindControl("divOrderPromotions2"); this.divOrderPromotions3 = (HtmlGenericControl)this.FindControl("divOrderPromotions3"); this.divPhonePrice = (HtmlGenericControl)this.FindControl("divPhonePrice"); this.litPhonePrice = (Literal)this.FindControl("litPhonePrice"); this.litPhonePriceEndDate = (Literal)this.FindControl("litPhonePriceEndDate"); this.divCuxiao = (HtmlGenericControl)this.FindControl("divCuxiao"); this.ltlUnit = (Literal)this.FindControl("ltlUnit"); this.divProductReferral = (HtmlGenericControl)this.FindControl("divProductReferral"); this.ltlProductSendGifts = (Literal)this.FindControl("ltlProductSendGifts"); this.setDeliverRegion = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion"); this.hidShowCombinationBuy = (HtmlInputHidden)this.FindControl("hidShowCombinationBuy"); this.hidCombinationId = (HtmlInputHidden)this.FindControl("hidCombinationId"); this.imgMainPic = (HtmlImage)this.FindControl("imgMainPic"); this.divqq = (HtmlGenericControl)this.FindControl("divqq"); HtmlAnchor htmlAnchor = (HtmlAnchor)this.FindControl("aMainName"); this.lblMainPrice = (Label)this.FindControl("lblMainPrice"); ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts"); this.spdiscount = (HtmlGenericControl)this.FindControl("spdiscount"); this.aCountDownUrl.Visible = false; this.buyProduct = (HtmlTableRow)this.FindControl("buyProduct"); this.serviceProduct = (HtmlTableRow)this.FindControl("serviceProduct"); if (this.Page.IsPostBack) { return; } SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (this.spdiscount != null && HiContext.Current.User.UserId > 0) { MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(HiContext.Current.User.GradeId); this.spdiscount.Visible = true; this.spdiscount.InnerHtml = "<strong class='vip_price'><img src='/templates/pccommon/images/vip_price.png' />" + memberGrade.Name + "价</strong>"; } if (this.imgQrCode != null) { string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png"; Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png); this.imgQrCode.ImageUrl = text; } if (this.phonePriceQrCode != null) { string text2 = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png"; Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text2, false, ImageFormats.Png); this.phonePriceQrCode.ImageUrl = text2; } if (this.liCode != null && HiContext.Current.SiteSettings.OpenAliho == 0 && HiContext.Current.SiteSettings.OpenVstore == 0 && HiContext.Current.SiteSettings.OpenWap == 0 && HiContext.Current.SiteSettings.OpenMobbile == 0) { this.liCode.Visible = false; } ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, 0); if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete) { this.Page.Response.Redirect("/ProductDelete.aspx"); return; } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale) { this.Page.Response.Redirect(base.GetRouteUrl("unproductdetails", new { ProductId = this.productId })); } if (productBrowseInfo.Product.SupplierId > 0 && productBrowseInfo.Product.AuditStatus != ProductAuditStatus.Pass) { this.Page.Response.Redirect(base.GetRouteUrl("unproductdetailsaudit", new { ProductId = this.productId })); } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库")); return; } this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId; this.setDeliverRegion.Volume = productBrowseInfo.Product.Weight; this.setDeliverRegion.Weight = productBrowseInfo.Product.Weight; this.ActivityBusiness(); if (this.hidCartQuantity != null) { this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId); } IEnumerable value = from item in productBrowseInfo.Product.Skus select item.Value; if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null) { this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs); } if (this.hidden_skus != null) { this.hidden_skus.Value = JsonConvert.SerializeObject(value); } this.hidden_productId.Value = this.productId.ToString(); this.LoadPageSearch(productBrowseInfo.Product); if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage) { this.lbUserProductRefer.product = productBrowseInfo.Product; } HyperLink hyperLink = this.hpkProductConsultations; int num = productBrowseInfo.ConsultationCount; hyperLink.Text = "查看全部" + num.ToString() + "条咨询"; Literal literal = this.ltlConsultation; num = productBrowseInfo.ConsultationCount; literal.Text = num.ToString(); Literal literal2 = this.ltlSaleCount; num = productBrowseInfo.SaleCount; literal2.Text = num.ToString(); Literal literal3 = this.ltlReviewCount; num = productBrowseInfo.ReviewCount; literal3.Text = num.ToString(); Literal literal4 = this.litReviewCount; num = productBrowseInfo.ReviewCount; literal4.Text = num.ToString(); this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}"; this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName); this.btnBuy.Stock = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock); this.ltlUnit.Text = productBrowseInfo.Product.Unit; this.divqq.Visible = (this.sitesettings.ServiceIsOpen == "1"); MemberInfo user = HiContext.Current.User; if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productBrowseInfo.Product.SubMemberDeduct.HasValue)) { if (!productBrowseInfo.Product.SubMemberDeduct.HasValue) { goto IL_0c9e; } decimal?subMemberDeduct = productBrowseInfo.Product.SubMemberDeduct; if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue) { goto IL_0c9e; } } goto IL_0cd8; IL_0cd9: int num2; if (num2 != 0) { this.divProductReferral.Visible = false; } this.btnaddgouwu.Stock = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock); BrowsedProductQueue.EnQueue(this.productId); this.images.ImageInfo = productBrowseInfo.Product; if (productBrowseInfo.DbAttribute != null) { this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute; this.rptExpandAttributes.DataBind(); } if (productBrowseInfo.DbSKUs != null) { this.skuSelector.ProductId = this.productId; this.skuSelector.DataSource = productBrowseInfo.DbSKUs; } int supplierId = productBrowseInfo.Product.SupplierId; if (supplierId > 0) { SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId); if (!string.IsNullOrEmpty(supplierById.Picture)) { this.imgBrand.ImageUrl = supplierById.Picture; } else if (productBrowseInfo.Product.BrandId.HasValue) { BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value); if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo)) { this.imgBrand.ImageUrl = brandCategory.Logo; this.aBrand.HRef = base.GetRouteUrl("branddetails", new { brandId = brandCategory.BrandId }); } } else { this.imgBrand.Visible = false; } this.litSupplierName.Text = "<a href=\"/SupplierAbout?SupplierId=" + supplierById.SupplierId + "\">" + supplierById.SupplierName + "</a>"; this.hidSupName.Value = supplierById.SupplierName; } else { this.litSupplierName.Visible = false; if (productBrowseInfo.Product.BrandId.HasValue) { BrandCategoryInfo brandCategory2 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value); if (brandCategory2 != null && !string.IsNullOrEmpty(brandCategory2.Logo)) { this.imgBrand.ImageUrl = brandCategory2.Logo; this.aBrand.HRef = base.GetRouteUrl("branddetails", new { brandId = brandCategory2.BrandId }); } } } if (SalesHelper.IsSupportPodrequest() && productBrowseInfo.Product.SupplierId == 0) { this.imgpdorequest.Visible = true; } if (masterSettings.OpenMultStore) { if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId)) { this.imgTakeonstore.Visible = true; } } else if (masterSettings.IsOpenPickeupInStore && productBrowseInfo.Product.SupplierId == 0) { this.imgTakeonstore.Visible = true; } if (productBrowseInfo.DBConsultations != null) { this.consultations.DataSource = productBrowseInfo.DBConsultations; this.consultations.DataBind(); } if (productBrowseInfo.DbCorrelatives != null) { this.correlative.DataSource = productBrowseInfo.DbCorrelatives; this.correlative.DataBind(); } this.BindOrderPromotions(); if (!this.divOrderPromotions.Visible && !this.divOrderPromotions2.Visible && !this.divOrderPromotions3.Visible && !this.divPhonePrice.Visible) { this.divCuxiao.Style.Add("display", "none"); } if (this.rptOnlineService != null) { IList <OnlineServiceInfo> allOnlineService = OnlineServiceHelper.GetAllOnlineService(0, 1); IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2); if (allOnlineService2 != null) { foreach (OnlineServiceInfo item in allOnlineService2) { allOnlineService.Add(item); } } this.rptOnlineService.DataSource = allOnlineService; this.rptOnlineService.DataBind(); } if (productBrowseInfo.Product.Stock > 0) { CombinationBuyInfo combinationBuyByMainProductId = CombinationBuyHelper.GetCombinationBuyByMainProductId(this.productId); if (combinationBuyByMainProductId != null) { List <CombinationBuyandProductUnionInfo> combinationProductListByProductId = CombinationBuyHelper.GetCombinationProductListByProductId(this.productId); CombinationBuyandProductUnionInfo combinationBuyandProductUnionInfo = combinationProductListByProductId.FirstOrDefault((CombinationBuyandProductUnionInfo c) => c.ProductId == this.productId); if (combinationBuyandProductUnionInfo != null) { HtmlInputHidden htmlInputHidden = this.hidCombinationId; num = combinationBuyandProductUnionInfo.CombinationId; htmlInputHidden.Value = num.ToString(); string value2 = string.IsNullOrEmpty(combinationBuyandProductUnionInfo.ThumbnailUrl100) ? this.sitesettings.DefaultProductThumbnail3 : combinationBuyandProductUnionInfo.ThumbnailUrl100; this.imgMainPic.Attributes["data-url"] = value2; htmlAnchor.InnerText = combinationBuyandProductUnionInfo.ProductName; this.lblMainPrice.Text = combinationBuyandProductUnionInfo.MinCombinationPrice.F2ToString("f2"); this.lblMainPrice.Attributes["salePrice"] = combinationBuyandProductUnionInfo.MinSalePrice.F2ToString("f2"); } combinationProductListByProductId.Remove(combinationBuyandProductUnionInfo); if (combinationProductListByProductId != null && combinationProductListByProductId.Count > 0) { for (int i = 0; i < combinationProductListByProductId.Count; i++) { string thumbnailUrl = string.IsNullOrEmpty(combinationProductListByProductId[i].ThumbnailUrl100) ? this.sitesettings.DefaultProductThumbnail3 : combinationProductListByProductId[i].ThumbnailUrl100; combinationProductListByProductId[i].ThumbnailUrl100 = thumbnailUrl; combinationProductListByProductId[i].Index = i + 1; } themedTemplatedRepeater.DataSource = combinationProductListByProductId; themedTemplatedRepeater.DataBind(); this.hidShowCombinationBuy.Value = "1"; } } } return; IL_0cd8: num2 = 1; goto IL_0cd9; IL_0c9e: if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null) { num2 = (user.Referral.IsRepeled ? 1 : 0); goto IL_0cd9; } goto IL_0cd8; }
private void shoppingCartProductList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { TextBox textBox = (TextBox)e.Item.FindControl("txtBuyNum"); Control control = e.Item.FindControl("spanStock"); Control control2 = e.Item.FindControl("divAmount"); Control control3 = e.Item.FindControl("divCheck"); Control control4 = e.Item.FindControl("divNoCheck"); Control control5 = e.Item.FindControl("divInValid"); Control control6 = e.Item.FindControl("divIsStock"); Control control7 = e.Item.FindControl("divValidInfo"); if (HiContext.Current.User.UserId == 0) { control5.Visible = false; control6.Visible = false; control4.Visible = false; control7.Visible = false; } else { Repeater repeater = e.Item.FindControl("rptPromotionGifts") as Repeater; ShoppingCartItemInfo shoppingCartItemInfo = e.Item.DataItem as ShoppingCartItemInfo; PromotionInfo productPromotionInfo = ProductBrowser.GetProductPromotionInfo(shoppingCartItemInfo.ProductId); if (productPromotionInfo != null && productPromotionInfo.PromoteType == PromoteType.SentGift) { IList <GiftInfo> list = (IList <GiftInfo>)(repeater.DataSource = ProductBrowser.GetGiftDetailsByGiftIds(productPromotionInfo.GiftIds)); repeater.DataBind(); } if (!shoppingCartItemInfo.IsValid) { control3.Visible = false; control5.Visible = true; control7.Visible = true; control6.Visible = false; control2.Visible = false; } else { control5.Visible = false; control7.Visible = false; control6.Visible = false; int num = default(int); int.TryParse(textBox.Text, out num); int skuStock = ShoppingCartProcessor.GetSkuStock(shoppingCartItemInfo.SkuId, 0); if (skuStock < num || skuStock <= 0) { control.Visible = true; control2.Visible = false; control3.Visible = false; control4.Visible = true; control6.Visible = true; this.btnCheckout.Style.Add(HtmlTextWriterStyle.Display, "none"); this.btnUnCheckout.Visible = true; } else { control4.Visible = false; } } } } }
protected void btnPay_Click(object sender, EventArgs e) { MemberInfo user = HiContext.Current.User; if (string.IsNullOrEmpty(user.TradePassword)) { this.Page.Response.Redirect("/user/OpenBalance.aspx"); } string empty = string.Empty; OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.orderId); int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems) { CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId); if (countDownInfo == null) { this.ShowMessage(empty, false, "", 1); return; } } } if (orderInfo.FightGroupId > 0) { foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems) { FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty); if (fightGroupActivityInfo == null) { this.ShowMessage(empty, false, "", 1); return; } } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { this.ShowMessage("当前的订单为团购订单,此团购活动已结束,所以不能支付", false, "", 1); return; } num2 = TradeHelper.GetOrderCount(orderInfo.GroupBuyId); num3 = orderInfo.GetGroupBuyOerderNumber(); num = groupBuy.MaxCount; if (num < num2 + num3) { this.ShowMessage("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false, "", 1); return; } } if (orderInfo.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo == null) { this.ShowMessage("预售活动不存在不能支付", false, "", 1); return; } if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now) { this.ShowMessage("您支付晚了,预售活动已经结束", false, "", 1); return; } if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { this.ShowMessage("尾款支付尚未开始", false, "", 1); return; } DateTime dateTime = productPreSaleInfo.PaymentEndDate; DateTime date = dateTime.Date; dateTime = DateTime.Now; if (date < dateTime.Date) { this.ShowMessage("尾款支付已结束", false, "", 1); return; } } } if (!orderInfo.CheckAction(OrderActions.BUYER_PAY)) { this.ShowMessage("当前的订单订单状态不是等待付款,所以不能支付", false, "", 1); } else if (HiContext.Current.UserId != orderInfo.UserId) { this.ShowMessage("预付款只能为自己下的订单付款,查一查该订单是不是你的", false, "", 1); } else if ((decimal)this.litUseableBalance.Money < orderInfo.GetTotal(false)) { this.ShowMessage("预付款余额不足,支付失败", false, "", 1); } else if (MemberProcessor.ValidTradePassword(this.txtPassword.Text)) { string str = ""; if (!TradeHelper.CheckOrderStock(orderInfo, out str)) { this.ShowMessage("订单中有商品(" + str + ")库存不足", false, "", 1); } else { Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems; foreach (LineItemInfo value in lineItems.Values) { int skuStock = ShoppingCartProcessor.GetSkuStock(value.SkuId, 0); if (skuStock < value.ShipmentQuantity) { this.ShowMessage("订单中商品库存不足,禁止支付!", false, "", 1); return; } } if (TradeHelper.UserPayOrder(orderInfo, true, false)) { if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { TradeHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } if (orderInfo.ParentOrderId == "-1") { OrderQuery orderQuery = new OrderQuery(); orderQuery.ParentOrderId = orderInfo.OrderId; IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery); foreach (OrderInfo item in listUserOrder) { OrderHelper.OrderConfirmPaySendMessage(item); } } else { OrderHelper.OrderConfirmPaySendMessage(orderInfo); } this.Page.Response.Redirect("/user/PaySucceed.aspx?orderId=" + this.orderId); } else { this.ShowMessage($"对订单{orderInfo.OrderId} 支付失败", false, "", 1); } } } else { this.ShowMessage("交易密码有误,请重试", false, "", 1); } }