コード例 #1
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public SolutionProductModel ReaderBind(IDataReader dataReader)
        {
            SolutionProductModel model = new SolutionProductModel();
            object ojb;

            ojb = dataReader["SuiteId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SuiteId = (int)ojb;
            }
            ojb = dataReader["ProductId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ProductId = (int)ojb;
            }
            ojb = dataReader["Price"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Price = (decimal)ojb;
            }
            ojb = dataReader["Quantity"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Quantity = (int)ojb;
            }
            model.ProductName = dataReader["ProductName"].ToString();
            return(model);
        }
コード例 #2
0
        protected void btnAddProduct_Click(object sender, EventArgs e)
        {
            int productId = int.Parse(txtProductId.Text);
            int quantity  = int.Parse(txtQuantity.Text);
            int suiteId   = int.Parse(lblSuiteId.Text);

            NoName.NetShop.Product.BLL.ProductModelBll pbll = new NoName.NetShop.Product.BLL.ProductModelBll();
            SolutionProductBll spbll = new SolutionProductBll();

            NoName.NetShop.Product.Model.ProductModel pmodel = pbll.GetModel(productId);

            SuiteBll sbll = new SuiteBll();

            if (pmodel != null)
            {
                NoName.NetShop.Solution.Model.SolutionProductModel spmodel = new SolutionProductModel();
                spmodel.Price     = pmodel.MerchantPrice;
                spmodel.ProductId = pmodel.ProductId;
                spmodel.Quantity  = quantity;
                spmodel.SuiteId   = suiteId;
                spbll.Save(spmodel);
                sbll.SetPriceFromRefrence(suiteId);
            }
            ShowInfo(suiteId);
        }
コード例 #3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public void Save(SolutionProductModel model)
        {
            DbCommand dbCommand = dbw.GetStoredProcCommand("UP_slProduct_Save");

            dbw.AddInParameter(dbCommand, "SuiteId", DbType.Int32, model.SuiteId);
            dbw.AddInParameter(dbCommand, "ProductId", DbType.Int32, model.ProductId);
            dbw.AddInParameter(dbCommand, "Price", DbType.Decimal, model.Price);
            dbw.AddInParameter(dbCommand, "Quantity", DbType.Int32, model.Quantity);
            dbw.ExecuteNonQuery(dbCommand);
        }
コード例 #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Save(SolutionProductModel model)
 {
     dal.Save(model);
 }