Esempio n. 1
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.strType      = WebUtils.GetQueryString("type");
     this.proInit      = Product.GetDataById(base.OpID);
     this.guige        = GoodsSpecify.GetDataById(base.OpID);
     this.decBasePrice = WebUtils.GetQueryDecimal("price");
     if (!base.IsPostBack)
     {
         this.BindData();
     }
 }
Esempio n. 2
0
        private void GetGoodsAttr()
        {
            GoodsSpecifyInfo goodsSpecifyInfo = GoodsSpecify.Get(WebUtils.GetQueryInt("proid"), WebUtils.GetQueryString("attrpath"));

            if (goodsSpecifyInfo != null)
            {
                base.Response.Write(JsonUtils.ObjectToJson <GoodsSpecifyInfo>(goodsSpecifyInfo));
            }
            else
            {
                base.Response.Write("{\"ret\":\"fail\",\"status\":0,\"msg\":\"Chúng tôi không tìm thấy bất kỳ dữ liệu\"}");
            }
        }
Esempio n. 3
0
        public static int Add(GoodsSpecifyInfo entity)
        {
            int result;

            if (entity == null)
            {
                result = 0;
            }
            else
            {
                result = BizBase.dbo.InsertModel <GoodsSpecifyInfo>(entity);
            }
            return(result);
        }
Esempio n. 4
0
        public static GoodsSpecifyInfo Get(int guigeID)
        {
            GoodsSpecifyInfo dataById = GoodsSpecify.GetDataById(guigeID);
            GoodsSpecifyInfo result;

            if (dataById != null)
            {
                result = GoodsSpecify.Get(GoodsSpecify.GetDataById(guigeID));
            }
            else
            {
                result = null;
            }
            return(result);
        }
Esempio n. 5
0
 public static void ReBackStock(ProductInfo pro, GoodsSpecifyInfo goodsattr, int intQuantity)
 {
     if (pro != null)
     {
         if (goodsattr != null)
         {
             goodsattr.Stock += intQuantity;
             GoodsSpecify.Update(goodsattr);
         }
         pro.Stock += intQuantity;
         BizBase.dbo.UpdateTable(string.Concat(new object[]
         {
             " update shop_Product set Stock=Stock+",
             intQuantity,
             " where AutoID= ",
             pro.AutoID
         }));
     }
 }
Esempio n. 6
0
        private static GoodsSpecifyInfo Get(GoodsSpecifyInfo guige)
        {
            UserInfo user = User.GetLoginUser();

            if (user != null)
            {
                guige.MemberPriceSets = MemberPriceSet.GetList(guige.MemberPriceSet, guige.SellPrice);
                MemberPriceSetInfo memberPriceSetInfo = (from p in guige.MemberPriceSets
                                                         where p.UserLevelID.Equals(user.LevelID)
                                                         select p).FirstOrDefault <MemberPriceSetInfo>();
                if (memberPriceSetInfo != null)
                {
                    guige.MemberPrice = ((memberPriceSetInfo.Price > 0m) ? memberPriceSetInfo.Price : memberPriceSetInfo.DiscoutPrice);
                    if (guige.MemberPrice == 0m)
                    {
                        guige.MemberPrice = guige.SellPrice;
                    }
                }
            }
            return(guige);
        }
Esempio n. 7
0
        public static GoodsSpecifyInfo Get(int proID, string strGuiGe)
        {
            GoodsSpecifyInfo model = BizBase.dbo.GetModel <GoodsSpecifyInfo>(string.Concat(new object[]
            {
                " select top 1 * from shop_GoodsSpecify where ProID=",
                proID,
                " and Specification='",
                StringUtils.ChkSQL(strGuiGe),
                "' "
            }));
            GoodsSpecifyInfo result;

            if (model != null)
            {
                result = GoodsSpecify.Get(model);
            }
            else
            {
                result = null;
            }
            return(result);
        }
Esempio n. 8
0
 public static bool Update(GoodsSpecifyInfo entity)
 {
     return(entity != null && BizBase.dbo.UpdateModel <GoodsSpecifyInfo>(entity));
 }
Esempio n. 9
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.strCartID = this.shop.GetCartID();
     this.strAction = WebUtils.GetQueryString("action").ToLower();
     this.strIds    = WebUtils.GetQueryString("ids");
     if (!string.IsNullOrEmpty(this.strAction))
     {
         string text = this.strAction;
         if (text != null)
         {
             if (!(text == "del"))
             {
                 if (!(text == "clear"))
                 {
                     if (!(text == "plus"))
                     {
                         if (!(text == "minus"))
                         {
                             if (text == "quantity")
                             {
                                 int      queryInt = WebUtils.GetQueryInt("num", 1);
                                 CartInfo cart     = Cart.GetCart(WebUtils.GetInt(this.strIds));
                                 if (cart != null)
                                 {
                                     GoodsSpecifyInfo dataById = GoodsSpecify.GetDataById(cart.GoodsAttr);
                                     int stock = cart.Product.Stock;
                                     if (dataById != null)
                                     {
                                         stock = dataById.Stock;
                                     }
                                     if (queryInt > stock)
                                     {
                                         cart.Quantity = stock;
                                     }
                                     else if (queryInt < 1)
                                     {
                                         cart.Quantity = 1;
                                     }
                                     else
                                     {
                                         cart.Quantity = queryInt;
                                     }
                                     cart.SubTotal = cart.Price * cart.Quantity;
                                     Cart.Update(cart);
                                 }
                             }
                         }
                         else
                         {
                             CartInfo cart2 = Cart.GetCart(WebUtils.GetInt(this.strIds));
                             if (cart2 != null)
                             {
                                 if (cart2.Quantity > 1)
                                 {
                                     cart2.Quantity--;
                                 }
                                 cart2.SubTotal = cart2.Price * cart2.Quantity;
                                 Cart.Update(cart2);
                             }
                         }
                     }
                     else
                     {
                         CartInfo cart3 = Cart.GetCart(WebUtils.GetInt(this.strIds));
                         if (cart3 != null)
                         {
                             GoodsSpecifyInfo dataById = GoodsSpecify.GetDataById(cart3.GoodsAttr);
                             int stock = cart3.Product.Stock;
                             if (dataById != null)
                             {
                                 stock = dataById.Stock;
                             }
                             if (cart3.Quantity < stock)
                             {
                                 cart3.Quantity++;
                             }
                             cart3.SubTotal = cart3.Price * cart3.Quantity;
                             Cart.Update(cart3);
                         }
                     }
                 }
                 else
                 {
                     Cart.ClearByCartID(this.strCartID);
                 }
             }
             else if (!string.IsNullOrEmpty(this.strIds))
             {
                 Cart.Delete(this.strIds);
             }
         }
         base.Response.Redirect(UrlRewrite.Get("cart_url"));
     }
     else
     {
         System.Collections.Generic.IList <CartInfo> listByCartNo = Cart.GetListByCartNo(this.strCartID);
         foreach (CartInfo current in listByCartNo)
         {
             this.decTotalMoney += current.Quantity * current.Price;
         }
         base.Put("totalamount", this.decTotalMoney);
         base.UsingClient("购物车.html");
     }
 }