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.litTotalPoint = (Literal)this.FindControl("litTotalPoint"); this.litStoreMoney = (Literal)this.FindControl("litStoreMoney"); this.litExemption = (Literal)this.FindControl("litExemption"); this.litcount = (Literal)this.FindControl("litcount"); this.divShowTotal = (HtmlGenericControl)this.FindControl("divShowTotal"); this.aLink = (HtmlAnchor)this.FindControl("aLink"); this.Page.Session["stylestatus"] = "0"; this.litExemption.Text = "0.00"; this.cart = ShoppingCartProcessor.GetShoppingCartAviti(0); this.cartPoint = ShoppingCartProcessor.GetShoppingCartAviti(1); if (this.cart != null) { this.rptCartProducts.DataSource = this.cart; this.rptCartProducts.DataBind(); int num = 0; for (int i = 0; i < this.cart.Count; i++) { num += this.cart[i].LineItems.Count; } this.litcount.Text = num.ToString(); } if (this.cartPoint != null) { this.rptCartPointProducts.DataSource = this.cartPoint; this.rptCartPointProducts.DataBind(); } if ((this.cart != null) || (this.cartPoint != null)) { this.aLink.HRef = "/Vshop/SubmmitOrder.aspx"; } else { this.aLink.Attributes.Add("onclick", "alert_h('购物车中没有需要结算的商品!');"); } decimal num3 = 0M; if (this.cart != null) { foreach (ShoppingCartInfo info in this.cart) { num3 += info.GetAmount(); } } int num4 = 0; if (this.cartPoint != null) { foreach (ShoppingCartInfo info2 in this.cartPoint) { num4 += info2.GetTotalPoint(); } } PageTitle.AddSiteNameTitle("购物车"); this.litStoreMoney.Text = "¥" + num3.ToString("0.00"); this.litTotal.Text = "¥" + ((num3 - this.ReductionMoneyALL)).ToString("0.00"); this.litTotalPoint.Text = num4.ToString(); }
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; if (num3 > 0M) { str = "¥" + num3.ToString("F2"); } if (num2 > 0) { str = str + "+" + num2.ToString() + "积分"; } this.litTotal.Text = str; }
public int managerId; //当前pc端点餐管理员id protected override void AttachChildControls() { if (!Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.AnonymousOrder) { GotoResourceNotFound("pc点餐功能暂未开启!"); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["Id"])) { System.Web.HttpCookie cookie = new System.Web.HttpCookie("Vshop-Manager") { Value = this.Page.Request.QueryString["Id"].ToString(), Expires = System.DateTime.Now.AddDays(1.0) }; System.Web.HttpContext.Current.Response.Cookies.Add(cookie); } int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId); this.keyWord = this.Page.Request.QueryString["keyWord"]; this.imgUrl = (HiImage)this.FindControl("imgUrl"); this.litContent = (Literal)this.FindControl("litContent"); this.rptProducts = (VshopTemplatedRepeater)this.FindControl("rptProducts"); this.rptCategories = (VshopTemplatedRepeater)this.FindControl("rptCategories"); this.litCategoryId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litCategoryId"); this.txtTotal = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtTotal"); this.defaultShippingtype = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("defaultShippingtype"); this.txtStoreId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtStoreId"); this.txtThirdWayDiscountInfo = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtThirdWayDiscountInfo"); this.litBuyToGive = (Literal)this.FindControl("litBuyToGive"); this.litHalf = (Literal)this.FindControl("litHalf");//第二杯半价 this.litOrderList = (Literal)this.FindControl("litOrderList"); this.litCategoryId.SetWhenIsNotNull(this.categoryId.ToString()); this.Page.Session["stylestatus"] = "4"; this.litStoreName = (Literal)this.FindControl("litStoreName"); //获取所有活动列表 //this.dtpromotion = ProductBrowser.GetAllFull(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); this.txtThirdWayDiscountInfo.Value = masterSettings.thirdWayDiscountInfo; //获取当前点餐门店信息 ManagerInfo currentManager = ManagerHelper.GetCurrentManager(); storeId = currentManager.ClientUserId; litStoreName.Text = ManagerHelper.GetStoreName(storeId); this.txtStoreId.Value = this.storeId.ToString(); switch (Hidistro.Core.SettingsManager.GetMasterSettings(true).VTheme.ToLower()) { case "common": case "hotel": //this.rptProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptProducts_ItemDataBound); DataTable dtProducts = new DataTable(); //商品dt DataTable dt = CategoryBrowser.GetCategoriesByRange(rangeId); //CategoryBrowser.GetCategoriesRange(ProductInfo.ProductRanage.All); int total = 0; int num; int num2; if (!int.TryParse(this.Page.Request.QueryString["page"], out num)) { num = 1; } if (!int.TryParse(this.Page.Request.QueryString["size"], out num2)) { num2 = 16; } if (categoryId == 0) { if (dt.Rows.Count > 0) { //获取第一个分类id int FirstCategoryID = Convert.ToInt32(dt.Rows[0]["categoryId"]); this.litCategoryId.SetWhenIsNotNull(FirstCategoryID.ToString()); //匿名点餐情况下,商品为总店的所有商品,用户则是匿名用户(无需登录) dtProducts = ProductBrowser.GetProducts(MemberProcessor.GetAnonymousMember(this.Page.Request.QueryString["type"].ToString()), null, 0, FirstCategoryID, this.keyWord, num, num2, out total, "ShowSaleCounts", "desc", "", rangeId, storeId); } } else { dtProducts = ProductBrowser.GetProducts(MemberProcessor.GetAnonymousMember(this.Page.Request.QueryString["type"].ToString()), null, 0, categoryId, this.keyWord, num, num2, out total, "ShowSaleCounts", "desc", "", rangeId, storeId); } //绑定购物车的信息 this.cart = ShoppingCartProcessor.GetShoppingCartAviti(Globals.GetCurrentManagerUserId()); //根据商品id判断是否包含其余规格,如果有,则新增一个字段存入规格号 dtProducts.Columns.Add("skuCounts"); foreach (DataRow row in dtProducts.Rows) { DataTable skus = ProductBrowser.GetSkus(Convert.ToInt32(row["ProductId"])); row["skuCounts"] = skus.Rows.Count; } this.rptProducts.DataSource = dtProducts; this.rptProducts.DataBind(); if (!dt.Columns.Contains("PType")) { dt.Columns.Add("PType", typeof(string)); } foreach (DataRow dr in dt.Rows) { dr["PType"] = this.Page.Request.QueryString["type"]; } this.rptCategories.DataSource = dt; this.rptCategories.DataBind(); if (cart != null) { this.litOrderList.Text = ""; //根据购物车的信息绑定左侧点单列表的信息 foreach (ShoppingCartInfo cartInfo in cart) { foreach (ShoppingCartItemInfo info in cartInfo.LineItems) { this.litOrderList.Text += string.Format(@"<li><span>{4}</span><div class='guige'><d type='skuName'>{8}</d><b style='display:none'>{3}</b>{7}</div> <span> <a id='spSub_{0}' class='shopcart-minus'>-</a> <input type='tel' id='buyNum_{0}' class='form-control' value='{2}' disabled='disabled' /> <input type='hidden' id='skuid_{1}' value='{1}'/> <a id='spAdd_{0}' class='shopcart-add'>+</a> <input type='hidden' id='giveNum' value='{5}'/> <input type='hidden' id='halfNum' value='{6}'/> </span></li> ", info.ProductId, info.SkuId, info.Quantity, info.AdjustedPrice.ToString("F2"), info.Name, info.GiveQuantity, info.HalfPriceQuantity, info.GiveQuantity <= 0 ? (info.HalfPriceQuantity <= 0 ? "" : "(半价" + info.HalfPriceQuantity + ")") : "(送" + info.GiveQuantity + ")", skuContentFormat(info.SkuContent)); } } } this.txtTotal.SetWhenIsNotNull(total.ToString()); break; default: this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound); if (this.Page.Request.QueryString["TypeId"] != null) { this.rptCategories.DataSource = CategoryBrowser.GetCategoriesByPruductType(100, Convert.ToInt32(this.Page.Request.QueryString["TypeId"])); this.rptCategories.DataBind(); } else { IList <CategoryInfo> maxSubCategories = CategoryBrowser.GetMaxSubCategoriesRange(this.categoryId, 0x3e8, DistributorsBrower.GetCurrStoreProductRange()); this.rptCategories.DataSource = maxSubCategories; this.rptCategories.DataBind(); } PageTitle.AddSiteNameTitle("电脑点餐"); break; } if (masterSettings.BuyOrGive) { this.litBuyToGive.Text = "<a id=\"btnGiveBuy\" class=\"account-all\" onclick=\"BuyGive()\">买一送一</a>"; } if (masterSettings.BuyOrHalf) { this.litHalf.Text = "<a id=\"btnHalf\" class=\"account-all\" onclick=\"BuyHalf()\">第二杯半价</a>"; } IList <ShippingModeInfo> shippingmodesList = SalesHelper.GetShippingModes(); this.defaultShippingtype.Value = shippingmodesList[0].ModeId.ToString(); }
protected override void AttachChildControls() { this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts"); this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound); this.litTotal = (Literal)this.FindControl("litTotal"); this.littext = (Literal)this.FindControl("littext"); this.litStoreMoney = (Literal)this.FindControl("litStoreMoney"); this.litExemption = (Literal)this.FindControl("litExemption"); this.litcount = (Literal)this.FindControl("litcount"); this.divShowTotal = (HtmlGenericControl)this.FindControl("divShowTotal"); this.aLink = (HtmlAnchor)this.FindControl("aLink"); this.Page.Session["stylestatus"] = "0"; this.litExemption.Text = "0.00"; this.cart = ShoppingCartProcessor.GetShoppingCartAviti(); if (this.cart != null) { this.rptCartProducts.DataSource = this.cart; this.rptCartProducts.DataBind(); int num = 0; for (int i = 0; i < this.cart.Count; i++) { num += this.cart[i].LineItems.Count; } this.litcount.Text = num.ToString(); } decimal num3 = 0M; if (this.cart != null) { foreach (ShoppingCartInfo info in this.cart) { num3 += info.GetAmount(); } } PageTitle.AddSiteNameTitle("购物车"); DataTable allFull = ProductBrowser.GetAllFull(0); if (allFull.Rows.Count > 0) { decimal num4 = 0M; decimal num5 = 0M; string str = ""; string str2 = ""; string str3 = ""; for (int j = 0; j < allFull.Rows.Count; j++) { if (num3 >= decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString())) { str = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesName"].ToString(); num5 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString()); num4 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["ReductionMoney"].ToString()); str3 = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesType"].ToString(); str2 = allFull.Rows[allFull.Rows.Count - 1]["ActivitiesId"].ToString(); break; } if (num3 <= decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString())) { str = allFull.Rows[0]["ActivitiesName"].ToString(); num5 = decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString()); num4 = decimal.Parse(allFull.Rows[0]["ReductionMoney"].ToString()); str3 = allFull.Rows[0]["ActivitiesType"].ToString(); str2 = allFull.Rows[0]["ActivitiesId"].ToString(); break; } if (num3 >= decimal.Parse(allFull.Rows[j]["MeetMoney"].ToString())) { str = allFull.Rows[j]["ActivitiesName"].ToString(); num5 = decimal.Parse(allFull.Rows[j]["MeetMoney"].ToString()); num4 = decimal.Parse(allFull.Rows[j]["ReductionMoney"].ToString()); str3 = allFull.Rows[j]["ActivitiesType"].ToString(); str2 = allFull.Rows[j]["ActivitiesId"].ToString(); } } this.littext.Text = ""; if (num3 >= num5) { string text = this.littext.Text; this.littext.Text = text + "<div id=\"cartProducts\" class=\"well shopcart\"><div class=\"price-sale\"><span class=\"title\">促销活动:</span><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=" + str2 + "&CategoryId=" + str3 + "\">" + str + "</a></span><span>已满" + num5.ToString("0") + "已减" + num4.ToString("0") + "</span></div></div>"; this.ReductionMoneyALL += num4; } else { string str5 = this.littext.Text; this.littext.Text = str5 + "<div id=\"cartProducts\" class=\"well shopcart\"><div class=\"price-sale\"><span class=\"title\">促销活动:</span><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=" + str2 + "&CategoryId=" + str3 + "\">" + str + "</a></span><span>满" + num5.ToString("0") + "减" + num4.ToString("0") + "</span></div></div>"; } this.litExemption.Text = this.ReductionMoneyALL.ToString("0.00"); if (num3 == 0M) { this.littext.Text = ""; } } this.litStoreMoney.Text = "¥" + num3.ToString("0.00"); this.litTotal.Text = "¥" + ((num3 - this.ReductionMoneyALL)).ToString("0.00"); }
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() { 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; }