/// <summary> /// 从组合产品中获取所有小产品 /// </summary> /// <param name="groupItemId"></param> /// <returns></returns> //public List<Other.OrderProduct> GetSamllItemList(string groupItemId) //{ // List<Other.OrderProduct> list = new List<DAL.Other.OrderProduct>(); // SqlParameter[] para = // { // new SqlParameter("@list", groupItemId), // }; // SqlDataReader reader = DBHelper.ExecuteReader("GetSmallProduct",para,CommandType.StoredProcedure); // while (reader.Read()) // { // Other.OrderProduct opt = new DAL.Other.OrderProduct(); // opt.id = Convert.ToInt32(reader["productid"]); // list.Add(opt); // } // return list; //} /// <summary> /// 从组合产品中获取所有小产品 /// </summary> /// <param name="groupItemId"></param> /// <returns></returns> public List <OrderProduct3> GetSamllItemList(string combineProductID) { List <OrderProduct3> list = new List <OrderProduct3>(); string sql = @" select a.productid as productid,a.PreferentialPrice as PreferentialPrice,a.PreferentialPv as PreferentialPv,b.Quantity as smallCount from product a,dbo.ProductCombineDetail b where a.productid=b.SubProductID and b.CombineProductID =@combineProductID"; SqlParameter[] para = { new SqlParameter("@combineProductID", combineProductID), }; SqlDataReader reader = DBHelper.ExecuteReader(sql, para, CommandType.Text); while (reader.Read()) { OrderProduct3 opt = new OrderProduct3(); opt.Id = Convert.ToInt32(reader["productid"]); opt.Price = Convert.ToDouble(reader["PreferentialPrice"]); opt.Pv = Convert.ToDouble(reader["PreferentialPv"]); opt.Count = Convert.ToInt32(reader["smallCount"]); list.Add(opt); } reader.Close(); return(list); }
public void AddNewSmallItemInStock(string storeId, OrderProduct3 opt, SqlTransaction tran) { string sql = @"declare @count22 int select @count22=count(*) from stock where storeId=@storeId and productId=@productId if(@count22=0) insert into stock( StoreID, ProductID, TotalIn, TotalOut,groupSmallStorage,ActualStorage, HasOrderCount) values('xiaoxiao',@productId,0,0,@smallItemCount,-@act,0)"; SqlParameter[] para = { new SqlParameter("@productId", opt.Id), new SqlParameter("@smallItemCount", opt.Count), new SqlParameter("@storeId", storeId), new SqlParameter("@act", opt.Count), }; DBHelper.ExecuteNonQuery(tran, sql, para, CommandType.Text); }