private SuitOrderProduct BuildModel(IDataReader reader)
 {
     SuitOrderProduct op = new SuitOrderProduct();
     op.ProductID = Convert.ToInt32(reader["productId"]);
     op.ProductName = reader["productName"].ToString();
     op.ProductUrl = reader["producturl"].ToString();
     op.ProductImg = reader["productimg"].ToString();
     op.CatePath = reader["CatePath"].ToString();
     op.TradePrice = Convert.ToDecimal(reader["TradePrice"]);
     op.MerchantPrice = Convert.ToDecimal(reader["MerchantPrice"]);
     op.Stock = Convert.ToInt32(reader["Stock"]);
     op.ReducePrice = Convert.ToDecimal(reader["ReducePrice"]);
     op.Score = Convert.ToInt32(reader["Score"]);
     op.Weight = reader["weight"]==DBNull.Value? 0 : Convert.ToDecimal(reader["weight"]);
     return op;
 }
Пример #2
0
        private SuitOrderProduct BuildModel(IDataReader reader)
        {
            SuitOrderProduct op = new SuitOrderProduct();

            op.ProductID     = Convert.ToInt32(reader["productId"]);
            op.ProductName   = reader["productName"].ToString();
            op.ProductUrl    = reader["producturl"].ToString();
            op.ProductImg    = reader["productimg"].ToString();
            op.CatePath      = reader["CatePath"].ToString();
            op.TradePrice    = Convert.ToDecimal(reader["TradePrice"]);
            op.MerchantPrice = Convert.ToDecimal(reader["MerchantPrice"]);
            op.Stock         = Convert.ToInt32(reader["Stock"]);
            op.ReducePrice   = Convert.ToDecimal(reader["ReducePrice"]);
            op.Score         = Convert.ToInt32(reader["Score"]);
            op.Weight        = reader["weight"] == DBNull.Value? 0 : Convert.ToDecimal(reader["weight"]);
            return(op);
        }
Пример #3
0
        private OrderProduct GetOrderProductBll(OrderType opType)
        {
            OrderProduct bll = null;

            switch (opType)
            {
            case OrderType.Common:
                bll = new CommOrderProduct();
                break;

            case OrderType.Gift:
                bll = new GiftOrderProduct();
                break;

            case OrderType.Suit:
                bll = new SuitOrderProduct();
                break;
            }
            return(bll);
        }
Пример #4
0
        public override OrderProduct CreateOrderProduct(int productId, int quantity, OrderType opType, System.Collections.Specialized.NameValueCollection paras)
        {
            SuitOrderProduct op   = null;
            string           sql  = "Product_GetOrderProduct_Suit";
            DbCommand        comm = CommDataAccess.DbReader.GetStoredProcCommand(sql);

            CommDataAccess.DbReader.AddInParameter(comm, "ProductId", DbType.Int32, productId);
            using (IDataReader reader = CommDataAccess.DbReader.ExecuteReader(comm))
            {
                if (reader.Read())
                {
                    op = BuildModel(reader);
                    op.SetQuantiy(quantity);
                    op.ProductType = opType;
                    int typecode;
                    if (int.TryParse(paras["typecode"], out typecode))
                    {
                        typecode = 0;
                    }
                    op.TypeCode = typecode;
                }
            }
            return(op);
        }
 private OrderProduct GetOrderProductBll(OrderType opType)
 {
     OrderProduct bll = null;
     switch (opType)
     {
         case OrderType.Common:
             bll = new CommOrderProduct();
             break;
         case OrderType.Gift:
             bll = new GiftOrderProduct();
             break;
         case OrderType.Suit:
             bll = new SuitOrderProduct();
             break;
     }
     return bll;
 }