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; } }