private CommOrderProduct BuildModel(IDataReader reader)
 {
     CommOrderProduct op = new CommOrderProduct();
     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;
 }
        private CommOrderProduct BuildModel(IDataReader reader)
        {
            CommOrderProduct op = new CommOrderProduct();

            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);
        }
Esempio n. 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);
        }
        public override OrderProduct CreateOrderProduct(int productId, int quantity, OrderType opType, System.Collections.Specialized.NameValueCollection paras)
        {
            CommOrderProduct op   = null;
            string           sql  = "Product_GetOrderProduct_Common";
            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;
 }