private void ShowInfo(int ProductId, int SaleType, int SiteId) { NoName.NetShop.BLL.SalesProductModelBll bll = new NoName.NetShop.BLL.SalesProductModelBll(); NoName.NetShop.Model.SalesProductModel model = bll.GetModel(ProductId, SaleType, SiteId); this.lblProductId.Text = model.ProductId.ToString(); this.lblSaleType.Text = model.SaleType.ToString(); this.lblSiteId.Text = model.SiteId.ToString(); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(NoName.NetShop.Model.SalesProductModel model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("UP_pdSalesProduct_Update"); db.AddInParameter(dbCommand, "ProductId", DbType.Int32, model.ProductId); db.AddInParameter(dbCommand, "SaleType", DbType.Byte, model.SaleType); db.AddInParameter(dbCommand, "SiteId", DbType.Int32, model.SiteId); db.ExecuteNonQuery(dbCommand); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr=""; if(strErr!="") { MessageBox.Show(this,strErr); return; } NoName.NetShop.Model.SalesProductModel model=new NoName.NetShop.Model.SalesProductModel(); NoName.NetShop.BLL.SalesProductModelBll bll=new NoName.NetShop.BLL.SalesProductModelBll(); bll.Update(model); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; if (strErr != "") { MessageBox.Show(this, strErr); return; } NoName.NetShop.Model.SalesProductModel model = new NoName.NetShop.Model.SalesProductModel(); NoName.NetShop.BLL.SalesProductModelBll bll = new NoName.NetShop.BLL.SalesProductModelBll(); bll.Add(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public NoName.NetShop.Model.SalesProductModel GetModel(int ProductId, int SaleType, int SiteId) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("UP_pdSalesProduct_GetModel"); db.AddInParameter(dbCommand, "ProductId", DbType.Int32, ProductId); db.AddInParameter(dbCommand, "SaleType", DbType.Byte, SaleType); db.AddInParameter(dbCommand, "SiteId", DbType.Int32, SiteId); NoName.NetShop.Model.SalesProductModel model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }
/// <summary> /// 对象实体绑定数据 /// </summary> public NoName.NetShop.Model.SalesProductModel ReaderBind(IDataReader dataReader) { NoName.NetShop.Model.SalesProductModel model = new NoName.NetShop.Model.SalesProductModel(); object ojb; ojb = dataReader["ProductId"]; if (ojb != null && ojb != DBNull.Value) { model.ProductId = (int)ojb; } ojb = dataReader["SaleType"]; if (ojb != null && ojb != DBNull.Value) { model.SaleType = (int)ojb; } ojb = dataReader["SiteId"]; if (ojb != null && ojb != DBNull.Value) { model.SiteId = (int)ojb; } return(model); }
/// <summary> /// ����ʵ������� /// </summary> public NoName.NetShop.Model.SalesProductModel ReaderBind(IDataReader dataReader) { NoName.NetShop.Model.SalesProductModel model=new NoName.NetShop.Model.SalesProductModel(); object ojb; ojb = dataReader["ProductId"]; if(ojb != null && ojb != DBNull.Value) { model.ProductId=(int)ojb; } ojb = dataReader["SaleType"]; if(ojb != null && ojb != DBNull.Value) { model.SaleType=(int)ojb; } ojb = dataReader["SiteId"]; if(ojb != null && ojb != DBNull.Value) { model.SiteId=(int)ojb; } return model; }
private void ShowInfo(int ProductId, int SaleType, int SiteId) { NoName.NetShop.BLL.SalesProductModelBll bll = new NoName.NetShop.BLL.SalesProductModelBll(); NoName.NetShop.Model.SalesProductModel model = bll.GetModel(ProductId, SaleType, SiteId); }