/// <summary> /// 返回购物车商品总数 /// </summary> /// <returns>Int</returns> protected int get_cart_quantity() { int group_id = 0; Hoto.Model.users userModel = GetUserInfo(); if (userModel != null) { group_id = userModel.group_id; } Hoto.Model.cart_total cartModel = Web.UI.ShopCart.GetTotal(group_id); return(cartModel.total_quantity); }
/// <summary> /// 将在Init事件执行 /// </summary> protected void shopping_Init(object sender, EventArgs e) { int group_id = 0; userModel = GetUserInfo(); if (userModel != null) { group_id = userModel.group_id; } if (action == "confirm" && userModel == null) { //自动跳转URL HttpContext.Current.Response.Redirect(linkurl("login")); } cartModel = Web.UI.ShopCart.GetTotal(group_id); }
public static Hoto.Model.cart_total GetTotal(int group_id) { Hoto.Model.cart_total model = new Hoto.Model.cart_total(); IList <Hoto.Model.cart_items> iList = GetList(group_id); if (iList != null) { foreach (Hoto.Model.cart_items modelt in iList) { model.total_num++; model.total_quantity += modelt.quantity; model.payable_amount += modelt.price * modelt.quantity; model.real_amount += modelt.user_price * modelt.quantity; model.total_point += modelt.point * modelt.quantity; } } return(model); }
public static Hoto.Model.cart_total GetTotal(int group_id) { Hoto.Model.cart_total model = new Hoto.Model.cart_total(); IList<Hoto.Model.cart_items> iList = GetList(group_id); if (iList != null) { foreach (Hoto.Model.cart_items modelt in iList) { model.total_num++; model.total_quantity += modelt.quantity; model.payable_amount += modelt.price * modelt.quantity; model.real_amount += modelt.user_price * modelt.quantity; model.total_point += modelt.point * modelt.quantity; } } return model; }