Esempio n. 1
0
 /// <summary>
 /// 更新商品信息
 /// </summary>
 /// <param name="model"></param>
 /// <param name="errMsg"></param>
 /// <returns></returns>
 public static bool Update(ProductInfo model, out string errMsg)
 {
     return(BaseBll <ProductInfo> .Update(model.SellerId, model, out errMsg));
 }
Esempio n. 2
0
        /// <summary>
        /// 插入商品信息Model,返回新增商品编号
        /// </summary>
        /// <param name="model"></param>
        /// <param name="productId"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public static bool Insert(ProductInfo model, out int productId, out string errMsg)
        {
            productId = BaseBll <ProductInfo> .InsertWithReturnId(model, out errMsg);

            return(productId > 0);
        }
Esempio n. 3
0
        /// <summary>
        /// 根据买家Id,商品类别,返回指定卖家上线商品信息列表
        /// BuyerProductView不是表记录,而是业务封装视图。
        /// gongjun@2016-12-05
        /// </summary>
        /// <param name="buyerId"></param>
        /// <param name="sellerId"></param>
        /// <returns></returns>
        public static List <BuyerProductView> GetBuyerProductView(int buyerId, int sellerId)
        {
            //xieguanheng 增加字段 SellerId 的返回  20161231
            var list = new List <BuyerProductView>();
            var sql  = "Select T1.[SellerId],T1.[ClassId], T1.ProductId,[ProductCode],[ProductFullName],[ProductShortName],ProductUnit"
                       + ",[Picture1],[Picture2],[Picture3],[Picture4],[Picture5],[Picture6]"
                       + ",T2.[Price1],T2.[MinOrder1],T2.[MaxOrder1],T2.IsNew,T2.IsPromotion,T3.[ProductQuantity]"
                       + " From [dbo].[ProductInfo] T1"
                       + " Left Join [SellerProductOnlineCustomerStrategy] T2"
                       + " On T1.[ProductId]= T2.[ProductId]"
                       + " Inner Join [BuyerShoppingCart] T3"
                       + " On T1.[ProductId]=T3.[ProductId]"
                       + string.Format("Where T1.[SellerId]= {0}  And T2.BuyerId = {1}"
                                       , sellerId, buyerId)
                       + " And [SaleStartDate]<GETDATE() And[SaleEndDate]>GETDATE()";
            var dt = BaseBll <object> .ExecuteDataTable(sql, GetConnectionString(sellerId));

            if (dt.Rows.Count == 0)
            {
                sql = "Select T1.[SellerId],T1.[ClassId], T1.ProductId,[ProductCode],[ProductFullName],[ProductShortName],ProductUnit"
                      + ",[Picture1],[Picture2],[Picture3],[Picture4],[Picture5],[Picture6]"
                      + ",T2.[Price1],T2.[MinOrder1],T2.[MaxOrder1],T2.IsNew,T2.IsPromotion,T3.[ProductQuantity]"
                      + " From [dbo].[ProductInfo] T1"
                      + " Left Join [SellerProductOnline] T2"
                      + " On T1.[ProductId]= T2.[ProductId]"
                      + " Inner Join [BuyerShoppingCart] T3"
                      + " On T1.[ProductId]=T3.[ProductId]"
                      + string.Format("Where T1.[SellerId]= {0} And T2.SaleState=1"
                                      , sellerId)
                      + " And [SaleStartDate]<GETDATE() And[SaleEndDate]>GETDATE()";
                dt = BaseBll <object> .ExecuteDataTable(sql, GetConnectionString(sellerId));
            }
            foreach (DataRow row in dt.Rows)
            {
                var view = new BuyerProductView();
                view.SellerId         = Convert.ToInt32(row["SellerId"]);
                view.ClassId          = Convert.ToInt32(row["ClassId"]);
                view.ProductId        = Convert.ToInt32(row["ProductId"]);
                view.ProductCode      = row["ProductCode"].ToString();
                view.ProductFullName  = row["ProductFullName"].ToString();
                view.ProductShortName = row["ProductShortName"].ToString();
                view.ProductUnit      = row["ProductUnit"].ToString();
                view.Picture1         = Convert.ToInt32(row["Picture1"]);
                view.Picture2         = Convert.ToInt32(row["Picture2"]);
                view.Picture3         = Convert.ToInt32(row["Picture3"]);
                view.Picture4         = Convert.ToInt32(row["Picture4"]);
                view.Picture5         = Convert.ToInt32(row["Picture5"]);
                view.Price1           = Convert.ToSingle(row["Price1"]);
                view.MinOrder1        = Convert.ToInt16(row["MinOrder1"]);
                view.MaxOrder1        = Convert.ToInt32(row["MaxOrder1"]);
                view.IsNew            = Convert.ToBoolean(row["IsNew"]);
                view.IsPromotion      = Convert.ToBoolean(row["IsPromotion"]);
                try
                {
                    view.ProductQuantity = Convert.ToInt32(row["ProductQuantity"]);
                }
                catch (Exception ex)
                {
                    view.ProductQuantity = 0;
                }
                list.Add(view);
            }
            return(list);
        }
Esempio n. 4
0
        public static List <BuyerShoppingCartViewModel> GetBuyerShoppingCartViewModels(int buyerId, out string msg)
        {
            string sql = "select c.*,s.CompanyName as SellerName,p.ProductFullName as ProductName,p.ProductUnit as ProductUnit,p.Price1 as Price from BuyerShoppingCart c ,SellerInfo s,ProductInfo p where c.SellerId=s.SellerId and c.ProductId =p.ProductId and c.BuyerId =" + buyerId;

            return(BaseBll <BuyerShoppingCartViewModel> .GetList(sql, GetConnectionString(buyerId), out msg).ToList());
        }
Esempio n. 5
0
        /// <summary>
        /// 返回指定买家关联卖家的Id列表
        /// xieguanheng@2016-12-29
        /// </summary>
        /// <param name="buyerId"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public static List <SellerInfo> GetSellerList(int buyerId, out string errMsg)
        {
            var sql = string.Format("Select a.* From [SellerInfo] a,  [SellerCustomerInfo] b    Where a.SellerId=b.SellerId and [BuyerId]={0}", buyerId);

            return(BaseBll <SellerInfo> .GetList(sql, GetConnectionString(buyerId), out errMsg));
        }