/// <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; }
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); }
/// <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); }
/// <summary> /// ����һ������ /// </summary> public void Save(SolutionProductModel model) { dal.Save(model); }