private void MyBind() { M_UserInfo mu = buser.GetLogin(); B_Cart.UpdateUidByCartID(CartCookID, mu); CartDT = cartBll.SelByCartID(CartCookID, mu.UserID, ProClass); //从数据库中获取 if (StoreID != -100) //仅显示指定商铺的商品 { CartDT.DefaultView.RowFilter = "StoreID=" + StoreID; CartDT = CartDT.DefaultView.ToTable(); } RPT.DataSource = orderCom.SelStoreDT(CartDT); RPT.DataBind(); totalmoney.InnerText = TotalPrice.ToString("f2"); }
public IActionResult Cart() { if (!mu.IsNull && mu.Status != 0) { return(WriteErr("你的帐户未通过验证或被锁定")); } int proid = DataConvert.CLng(GetParam("id")); if (proid < 1) { proid = DataConvert.CLng(GetParam("proid")); } //int suitid = DataConvert.CLng(GetParam("suitid")); int pronum = DataConvert.CLng(GetParam("pronum"), 1); int pclass = -1;//非-1则为添加了商品,需要跳转 if (proid > 0) { M_Product proMod = proBll.GetproductByid(proid); if (proMod == null) { return(WriteErr("商品不存在")); } AddToCart(mu, proMod, pronum); pclass = proMod.ProClass; } if (Request.IsAjaxRequest()) { return(Content(Success.ToString())); } //ajax下不需要数据绑定与跳转 //通过页面访问 if (pclass > -1) { Response.Redirect("Cart?ProClass=" + pclass); } B_Cart.UpdateUidByCartID(CartCookID, mu); VM_Cart model = new VM_Cart(HttpContext, mu); model.CartDT = cartBll.SelByCartID(CartCookID, mu.UserID, ProClass); //从数据库中获取 if (StoreID != -100) //仅显示指定商铺的商品 { model.CartDT.DefaultView.RowFilter = "StoreID=" + StoreID; model.CartDT = model.CartDT.DefaultView.ToTable(); } model.StoreDT = orderCom.SelStoreDT(model.CartDT); //totalmoney.InnerText = TotalPrice.ToString("f2"); return(View(model)); }
private void MyBind() { M_UserInfo mu = buser.GetLogin(); CartDT = cartBll.SelByCartID(CartCookID, mu.UserID, ProClass);//从数据库中获取 RPT.DataSource = orderCom.SelStoreDT(CartDT); RPT.DataBind(); totalmoney.InnerText = TotalPrice.ToString("f2"); }
public void MyBind() { StringWriter sw = new StringWriter(); M_UserInfo mu = buser.GetLogin(false); CartDT = cartBll.SelByCartID(B_Cart.GetCartID(), mu.UserID, ProClass, ids); CartDT.DefaultView.RowFilter = "StoreID=" + StoreID; CartDT = CartDT.DefaultView.ToTable(); if (CartDT.Rows.Count < 1) { function.WriteErrMsg("你尚未选择商品,<a href='/Extend/Mobile/UserOrder.aspx'>查看我的订单</a>"); } //------核算费用 allmoney = UpdateCartAllMoney(CartDT); //------费用统计 itemnum_span.InnerText = CartDT.Rows.Count.ToString(); totalmoney_span1.InnerText = allmoney.ToString("f2"); //------店铺 Store_RPT.DataSource = orderCom.SelStoreDT(CartDT); Store_RPT.DataBind(); //------发票绑定 Server.Execute("/Cart/Comp/Invoice.aspx", sw); sw = new StringWriter(); //------积分抵扣 //{ // int usepoint = Point_CanBeUse(allmoney); // if (usepoint > 0) // { // point_body.Visible = true; // Point_L.Text = mu.UserExp.ToString(); // //int usepoint = (int)(allmoney * (SiteConfig.ShopConfig.PointRatiot * 0.01)); // function.Script(this, "SumByPoint(" + usepoint + ");"); // PointRate_Hid.Value = SiteConfig.ShopConfig.PointRate.ToString("F2"); // } // else // { // point_tips.Visible = true; // } //} //------优惠券 Server.Execute("/Cart/Comp/ArriveList.aspx?allmoney=" + allmoney + "&ids=" + ids, sw); Arrive_Lit.Text = sw.ToString(); }
protected void Page_Load(object sender, EventArgs e) { M_UserInfo mu = buser.GetLogin(); double allmoney = DataConvert.CDouble(Request["allmoney"]); string ids = DataConvert.CStr(Request.QueryString["ids"]); //------用户有哪些未使用的优惠券 DataTable avdt = avBll.U_Sel(mu.UserID, -100, 1); DataTable cartdt = null; if (avdt.Rows.Count < 1) { arrive_empty_div.Visible = true; return; } else { arrive_div.Style.Add("display", "block"); arrive_data_div.Visible = true; avdt.Columns.Add("enable", typeof(int)); //优惠券是否有效 1:有效 avdt.Columns.Add("err", typeof(string)); //不能使用的原因 cartdt = cartBll.SelByCartID(B_Cart.GetCartID(), mu.UserID, -100, ids); } //---------------------------------------Logical for (int i = 0; i < avdt.Rows.Count; i++) { DataRow dr = avdt.Rows[i]; M_Arrive avMod = new M_Arrive().GetModelFromReader(dr); double money = allmoney; M_Arrive_Result retMod = avBll.U_CheckArrive(avMod, mu.UserID, cartdt, money); dr["enable"] = retMod.enabled ? 1 : 0; dr["err"] = retMod.err; } avdt.DefaultView.RowFilter = "enable='1'"; Arrive_Active_RPT.DataSource = avdt.DefaultView.ToTable(); Arrive_Active_RPT.DataBind(); avdt.DefaultView.RowFilter = "enable='0'"; Arrive_Disable_RPT.DataSource = avdt.DefaultView.ToTable(); Arrive_Disable_RPT.DataBind(); }
public void MyBind() { M_UserInfo mu = buser.GetLogin(); CartDT = cartBll.SelByCartID(B_Cart.GetCartID(), mu.UserID, ProClass, ids); if (CartDT.Rows.Count < 1) { function.WriteErrMsg("你尚未选择商品,<a href='/User/Order/OrderList'>查看我的订单</a>"); } //旅游,酒店等不需要检测地址栏 switch (DataConvert.CLng(CartDT.Rows[0]["ProClass"])) { case (int)M_Product.ClassType.LY: { userli.Visible = true; M_Cart_Travel model = JsonConvert.DeserializeObject <M_Cart_Travel>(CartDT.Rows[0]["Additional"].ToString()); model.Guest.AddRange(model.Contract); UserRPT.DataSource = model.Guest; UserRPT.DataBind(); } break; case (int)M_Product.ClassType.JD: { userli.Visible = true; M_Cart_Hotel model = JsonConvert.DeserializeObject <M_Cart_Hotel>(CartDT.Rows[0]["Additional"].ToString()); model.Guest.AddRange(model.Contract); UserRPT.DataSource = model.Guest; UserRPT.DataBind(); } break; default: //------地址 DataTable addressDT = receBll.SelByUID(buser.GetLogin().UserID); AddressRPT.DataSource = addressDT; AddressRPT.DataBind(); EmptyDiv.Visible = addressDT.Rows.Count < 1; //地址为空提醒 break; } //------核算费用 allmoney = UpdateCartAllMoney(CartDT); //------费用统计 itemnum_span.InnerText = CartDT.Rows.Count.ToString(); totalmoney_span1.InnerText = allmoney.ToString("f2"); //------店铺 Store_RPT.DataSource = orderCom.SelStoreDT(CartDT); Store_RPT.DataBind(); //------发票绑定 DataTable invoceDT = new DataTable();//orderBll.SelInvoByUser(buser.GetLogin().UserID); if (invoceDT.Rows.Count > 0) { Invoice_RPT.DataSource = invoceDT; Invoice_RPT.DataBind(); } else { Invoice_RPT.Visible = false; } //------积分抵扣 if (SiteConfig.ShopConfig.PointRatiot > 0 && SiteConfig.ShopConfig.PointRatiot < 100 && SiteConfig.ShopConfig.PointRate > 0) { point_body.Visible = true; M_UserInfo usermod = buser.GetLogin(); Point_L.Text = usermod.UserExp.ToString(); int usepoint = (int)(allmoney * (SiteConfig.ShopConfig.PointRatiot * 0.01) / SiteConfig.ShopConfig.PointRate); function.Script(this, "SumByPoint(" + usepoint + ");"); PointRate_Hid.Value = SiteConfig.ShopConfig.PointRate.ToString(); } else { point_tips.Visible = true; } //------用户有哪些优惠券 DataTable avdt = avBll.U_Sel(mu.UserID, -100, 1); if (avdt.Rows.Count > 0) { arrive_div.Style.Add("display", "block"); arrive_data_div.Visible = true; avdt.Columns.Add("enable", typeof(int)); avdt.Columns.Add("err", typeof(string)); for (int i = 0; i < avdt.Rows.Count; i++) { DataRow dr = avdt.Rows[i]; double money = allmoney; string err = ""; dr["enable"] = avBll.U_CheckArrive(new M_Arrive().GetModelFromReader(dr), mu.UserID, ref money, ref err) ? 1 : 0; dr["err"] = err; } avdt.DefaultView.RowFilter = "enable='1'"; //function.WriteErrMsg(avdt.DefaultView.ToTable().Rows.Count.ToString()); Arrive_Active_RPT.DataSource = avdt.DefaultView.ToTable(); Arrive_Active_RPT.DataBind(); avdt.DefaultView.RowFilter = "enable='0'"; Arrive_Disable_RPT.DataSource = avdt.DefaultView.ToTable(); Arrive_Disable_RPT.DataBind(); } else { arrive_empty_div.Visible = true; } }
public void MyBind() { StringWriter sw = new StringWriter(); M_UserInfo mu = buser.GetLogin(false); CartDT = cartBll.SelByCartID(B_Cart.GetCartID(), mu.UserID, ProClass, ids); if (CartDT.Rows.Count < 1) { function.WriteErrMsg("你尚未选择商品,<a href='/User/Order/OrderList'>查看我的订单</a>"); } #region 旅游,酒店等不需要检测地址栏 switch (DataConvert.CLng(CartDT.Rows[0]["ProClass"])) { case (int)M_Product.ClassType.LY: { userli.Visible = true; M_Cart_Travel model = JsonConvert.DeserializeObject <M_Cart_Travel>(CartDT.Rows[0]["Additional"].ToString()); model.Guest.AddRange(model.Contract); UserRPT.DataSource = model.Guest; UserRPT.DataBind(); } break; case (int)M_Product.ClassType.JD: { userli.Visible = true; M_Cart_Hotel model = JsonConvert.DeserializeObject <M_Cart_Hotel>(CartDT.Rows[0]["Additional"].ToString()); model.Guest.AddRange(model.Contract); UserRPT.DataSource = model.Guest; UserRPT.DataBind(); } break; default: //------地址 break; } #endregion //------核算费用 allmoney = UpdateCartAllMoney(CartDT); //------费用统计 itemnum_span.InnerText = CartDT.Rows.Count.ToString(); totalmoney_span1.InnerText = allmoney.ToString("f2"); //------店铺 Store_RPT.DataSource = orderCom.SelStoreDT(CartDT); Store_RPT.DataBind(); //------发票绑定 Server.Execute("/Cart/Comp/Invoice.aspx", sw); Invoice_Lit.Text = sw.ToString(); sw = new StringWriter(); //------积分抵扣 { int usepoint = Point_CanBeUse(allmoney); if (usepoint > 0) { point_body.Visible = true; Point_L.Text = mu.UserExp.ToString(); //int usepoint = (int)(allmoney * (SiteConfig.ShopConfig.PointRatiot * 0.01)); function.Script(this, "SumByPoint(" + usepoint + ");"); PointRate_Hid.Value = SiteConfig.ShopConfig.PointRate.ToString("F2"); } else { point_tips.Visible = true; } } //------优惠券 Server.Execute("/Cart/Comp/ArriveList.aspx?allmoney=" + allmoney + "&ids=" + ids, sw); Arrive_Lit.Text = sw.ToString(); }