Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        M_UserInfo mu = GetLogin();

        if (!IsPostBack)
        {
            ProModel model = new ProModel()
            {
                ProID = DataConvert.CLng(Request["ID"]), Pronum = DataConvert.CLng(Request["Pronum"])
            };
            model.Pronum = model.Pronum < 1 ? 1 : model.Pronum;
            if (model.ProID > 0)//将商品加入购物车
            {
                M_Product proMod = proBll.GetproductByid(model.ProID);
                OrderCommon.ProductCheck(proMod);
                //-----------------检测完成加入购物车
                M_Cart cartMod = new M_Cart();
                cartMod.Cartid    = CartCookID;
                cartMod.StoreID   = proMod.UserShopID;
                cartMod.ProID     = model.ProID;
                cartMod.Pronum    = model.Pronum;
                cartMod.userid    = mu.UserID;
                cartMod.Username  = mu.UserName;
                cartMod.Getip     = EnviorHelper.GetUserIP();
                cartMod.Addtime   = DateTime.Now;
                cartMod.FarePrice = proMod.LinPrice.ToString();
                cartMod.Proname   = proMod.Proname;
                int id = cartBll.AddModel(cartMod);
                ImportExtField(id, Request.Form["ext_hid"]);//模型字段
                Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass);
            }
            MyBind();
        }
    }
Exemplo n.º 2
0
        //根据传参将商品加入购物车后跳转(支持按商品ID,套装ID购买)
        private void AddToCart(M_UserInfo mu, M_Product proMod, int pronum)
        {
            if (pronum < 1)
            {
                pronum = 1;
            }
            if (proMod == null || proMod.ID < 1)
            {
            }                                        //商品不存在
            if (proMod.ProClass == (int)M_Product.ClassType.IDC)
            {
                Response.Redirect("/Cart/FillIDCInfo?proid=" + proMod.ID);
            }
            OrderCommon.ProductCheck(proMod);
            //-----------------检测完成加入购物车
            M_Cart cartMod = new M_Cart();

            cartMod.Cartid    = CartCookID;
            cartMod.StoreID   = proMod.UserShopID;
            cartMod.ProID     = proMod.ID;
            cartMod.Pronum    = pronum;
            cartMod.userid    = mu.UserID;
            cartMod.Username  = mu.UserName;
            cartMod.FarePrice = proMod.LinPrice.ToString();
            cartMod.ProAttr   = GetParam("attr");
            cartMod.Proname   = proMod.Proname;
            int id = cartBll.AddModel(cartMod);
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            M_UserInfo mu = GetLogin();

            if (!IsPostBack)
            {
                ProModel model = new ProModel()
                {
                    ProID = DataConvert.CLng(Request["ID"]), Pronum = DataConvert.CLng(Request["Pronum"])
                };
                model.Pronum = model.Pronum < 1 ? 1 : model.Pronum;
                if (model.ProID > 0)//将商品加入购物车
                {
                    M_Product proMod = proBll.GetproductByid(model.ProID);
                    if (proMod == null || proMod.ID < 1)
                    {
                        function.WriteErrMsg("商品不存在");
                    }
                    if (proMod.ProClass == (int)M_Product.ClassType.IDC)
                    {
                        Response.Redirect("/Cart/FillIDCInfo.aspx?proid=" + proMod.ID);
                    }
                    OrderCommon.ProductCheck(proMod);
                    #region 特选商品逻辑 [delete]
                    if (proMod.Largess == 1)
                    {
                        B_User_BindPro ubpBll = new B_User_BindPro();
                        M_User_BindPro ubpMod = null;
                        if (mu.IsNull)
                        {
                            return;
                        }
                        ubpMod = ubpBll.SelModelByUid(mu.UserID);
                        if (ubpMod == null || !ubpMod.ProIDS.Contains("," + proMod.ID + ","))
                        {
                            Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); return;
                        }
                    }
                    #endregion
                    //-----------------检测完成加入购物车
                    M_Cart cartMod = new M_Cart();
                    cartMod.Cartid    = CartCookID;
                    cartMod.StoreID   = proMod.UserShopID;
                    cartMod.ProID     = model.ProID;
                    cartMod.Pronum    = model.Pronum;
                    cartMod.userid    = mu.UserID;
                    cartMod.Username  = mu.UserName;
                    cartMod.FarePrice = proMod.LinPrice.ToString();
                    cartMod.ProAttr   = DataConvert.CStr(Request["attr"]);
                    cartMod.Proname   = proMod.Proname;
                    int id = cartBll.AddModel(cartMod);
                    //ImportExtField(id, Request.Form["ext_hid"]);//模型字段
                    Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass);
                }
                MyBind();
            }
        }
Exemplo n.º 4
0
 //根据传参将商品加入购物车后跳转(支持按商品ID,套装ID购买)
 private void AddToCart(M_UserInfo mu, M_Product proMod, int pronum)
 {
     if (pronum < 1)
     {
         pronum = 1;
     }
     if (proMod == null || proMod.ID < 1)
     {
         return;
     }                                               //商品不存在
     if (proMod.ProClass == (int)M_Product.ClassType.IDC)
     {
         Response.Redirect("/Cart/FillIDCInfo.aspx?proid=" + proMod.ID);
     }
     OrderCommon.ProductCheck(proMod);
     #region 特选商品逻辑 [delete]
     if (proMod.Largess == 1)
     {
         B_User_BindPro ubpBll = new B_User_BindPro();
         M_User_BindPro ubpMod = null;
         if (mu.IsNull)
         {
             return;
         }
         ubpMod = ubpBll.SelModelByUid(mu.UserID);
         if (ubpMod == null || !ubpMod.ProIDS.Contains("," + proMod.ID + ","))
         {
             Response.Redirect(Request.Url.AbsolutePath + "?ProClass=" + proMod.ProClass); return;
         }
     }
     #endregion
     //-----------------检测完成加入购物车
     M_Cart cartMod = new M_Cart();
     cartMod.Cartid    = CartCookID;
     cartMod.StoreID   = proMod.UserShopID;
     cartMod.ProID     = proMod.ID;
     cartMod.Pronum    = pronum;
     cartMod.userid    = mu.UserID;
     cartMod.Username  = mu.UserName;
     cartMod.FarePrice = proMod.LinPrice.ToString();
     cartMod.ProAttr   = DataConvert.CStr(Request["attr"]);
     cartMod.Proname   = proMod.Proname;
     int id = cartBll.AddModel(cartMod);
 }