Ejemplo n.º 1
0
        /// <summary>
        /// 收藏夹批量添加购物车
        /// </summary>
        public void LikeToBasket()
        {
            string ids = RequestTool.RequestSafeString("id");
            string mes = "";

            if (ids == "")
            {
                Response.Write("{\"msg\":\"" + Tag("请先选择商品") + "\"}");
                return;
            }
            else
            {
                List <Lebi_User_Product> models = B_Lebi_User_Product.GetList("(Type_id_UserProductType=141 or Type_id_UserProductType=144) and User_id=" + CurrentUser.id + " and id in (lbsql{" + ids + "})", "");
                foreach (Lebi_User_Product model in models)
                {
                    //<-{ 判断收藏夹商品是否为上架状态 by lebi.kingdge 2015-02-10
                    Lebi_Product Product = B_Lebi_Product.GetModel("id = " + model.Product_id + " and Type_id_ProductStatus = 101");
                    if (Product == null)
                    {
                        Response.Write("{\"msg\":\"" + Lang(Product.Name) + " " + Tag("该商品已经下架") + "\"}");
                        return;
                    }
                    //}->
                    int num        = model.count;
                    int levelcount = ProductLevelCount(Product);
                    if (num < levelcount)
                    {
                        num = levelcount;
                    }
                    Lebi_User_Product updatemodel = B_Lebi_User_Product.GetModel("User_id=" + CurrentUser.id + " and product_id=" + model.Product_id + " and type_id_UserProductType=142");
                    if (updatemodel != null)
                    {
                        if (updatemodel.count < num)
                        {
                            updatemodel.count = model.count;
                            B_Lebi_User_Product.Update(updatemodel);
                        }
                    }
                    else
                    {
                        model.Type_id_UserProductType = 142;
                        model.count = num;
                        B_Lebi_User_Product.Add(model);
                    }
                }
                mes = Tag("商品已加入购物车") + "<div>" + Tag("数量") + " <span>" + Basket_Product_Count() + "</span> " + Tag("件") + " <span>" + FormatMoney(Basket_Product_Price()) + "</span></div><div><a href='" + URL("P_Basket", "") + "' class='btn btn-7'><s></s>" + Tag("查看购物车") + "</a>&nbsp;&nbsp;<a href='javascript:void(0)' onclick='cloesedialog();' class='btn btn-11'><s></s>" + Tag("关闭") + "</a></div>";
            }
            Response.Write("{\"msg\":\"OK\",\"count\":\"" + Basket_Product_Count() + "\",\"amount\":\"" + FormatMoney(Basket_Product_Price()) + "\",\"mes\":\"" + mes + "\",\"url\":\"" + URL("P_AddToBasket", "") + "\"}");
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_User_Product model)
 {
     return(D_Lebi_User_Product.Instance.Add(model));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_User_Product model)
 {
     D_Lebi_User_Product.Instance.Update(model);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_User_Product SafeBindForm(Lebi_User_Product model)
 {
     return(D_Lebi_User_Product.Instance.SafeBindForm(model));
 }