protected void Page_Load(object sender, EventArgs e) { this.id = AXRequest.GetQueryInt("id"); this.title = AXRequest.GetQueryString("title"); quantity = AXRequest.GetQueryInt("quantity"); price = AXRequest.GetQueryFloat("price", 0); if (!Page.IsPostBack) { BLL.shop_log bll = new BLL.shop_log(); string _strWhere = " user_id=" + userModel.id; string _orderby = ""; this.rptList.DataSource = bll.GetShopList(_strWhere, _orderby); this.rptList.DataBind(); } }
protected void Getstr() { int tolcount = 0; List <Model.shop_log> list = new List <Model.shop_log>(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); // int state = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidState")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { Model.shop_log shop = new Model.shop_log(); Model.users userModel = new Web.UI.BasePage().GetUserInfo(); shop.user_id = userModel.id; int count; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtQuantity")).Text.Trim(), out count)) { count = 0; } shop.quantity = count; shop.goods_id = this.id; shop.shop_id = id; list.Add(shop); tolcount = tolcount + count; } } string message = ""; if (quantity == tolcount) { BLL.shop_log shop = new BLL.shop_log(); shop.AddList(list); message = "true"; } else { message = "错误:请与加入购物车数量保持一致"; ClientScript.RegisterStartupScript(page.GetType(), "message", "<script language='javascript' defer>alert('" + message + "');</script>"); return; } ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>setData(" + message + "," + quantity + "," + quantity * price + "," + this.id + ");</script>");//后台调用前台JS }
public static Model.cart_total GetTotalNew(int user_id) { Model.cart_total model = new Model.cart_total(); BLL.shop_log shop = new BLL.shop_log(); DataSet ds = shop.GetDList(" s.user_id=" + user_id, ""); if (ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0) { foreach (DataRow dr in ds.Tables[0].Rows) { model.order_quantity++; model.total_quantity += Convert.ToInt16(dr["quantity"]); model.real_amount += Convert.ToInt16(dr["price"]); } } return(model); }
public static bool Delete(int id) { BLL.shop_log shop = new BLL.shop_log(); return(shop.Delete(id)); }
/// <summary> /// 更新购物车数量 /// </summary> public static bool UpdateNew(int id, int Quantity) { BLL.shop_log shop = new BLL.shop_log(); return(shop.Update(id, Quantity)); }
protected DataSet get_cart_listNew() { Model.users userModel = GetUserInfo(); BLL.shop_log shop = new BLL.shop_log(); return(shop.GetList("a.user_id=" + userModel.id, "shop_id")); }