/// <summary> /// 对象实体绑定数据 /// </summary> public NoName.NetShop.Model.SalesInfoModel ReaderBind(IDataReader dataReader) { NoName.NetShop.Model.SalesInfoModel model = new NoName.NetShop.Model.SalesInfoModel(); object ojb; ojb = dataReader["SalesType"]; if (ojb != null && ojb != DBNull.Value) { model.SalesType = (int)ojb; } ojb = dataReader["ProductId"]; if (ojb != null && ojb != DBNull.Value) { model.ProductId = (int)ojb; } ojb = dataReader["RuleType"]; if (ojb != null && ojb != DBNull.Value) { model.RuleType = (int)ojb; } ojb = dataReader["SortValue"]; if (ojb != null && ojb != DBNull.Value) { model.SortValue = (int)ojb; } return(model); }
private void ShowInfo(int SalesType, int ProductId, int RuleType) { NoName.NetShop.BLL.SalesInfoModelBll bll = new NoName.NetShop.BLL.SalesInfoModelBll(); NoName.NetShop.Model.SalesInfoModel model = bll.GetModel(SalesType, ProductId, RuleType); this.lblSalesType.Text = model.SalesType.ToString(); this.lblProductId.Text = model.ProductId.ToString(); this.lblRuleType.Text = model.RuleType.ToString(); this.txtSortValue.Text = model.SortValue.ToString(); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(NoName.NetShop.Model.SalesInfoModel model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("UP_pdSalesInfo_Update"); db.AddInParameter(dbCommand, "SalesType", DbType.Byte, model.SalesType); db.AddInParameter(dbCommand, "ProductId", DbType.Int32, model.ProductId); db.AddInParameter(dbCommand, "RuleType", DbType.Byte, model.RuleType); db.AddInParameter(dbCommand, "SortValue", DbType.Int32, model.SortValue); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 得到一个对象实体 /// </summary> public NoName.NetShop.Model.SalesInfoModel GetModel(int SalesType, int ProductId, int RuleType) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("UP_pdSalesInfo_GetModel"); db.AddInParameter(dbCommand, "SalesType", DbType.Byte, SalesType); db.AddInParameter(dbCommand, "ProductId", DbType.Int32, ProductId); db.AddInParameter(dbCommand, "RuleType", DbType.Byte, RuleType); NoName.NetShop.Model.SalesInfoModel model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsNumber(txtSortValue.Text)) { strErr+="SortValue�������֣�\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int SortValue=int.Parse(this.txtSortValue.Text); NoName.NetShop.Model.SalesInfoModel model=new NoName.NetShop.Model.SalesInfoModel(); model.SortValue=SortValue; NoName.NetShop.BLL.SalesInfoModelBll bll=new NoName.NetShop.BLL.SalesInfoModelBll(); bll.Update(model); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtSortValue.Text)) { strErr += "SortValue不是数字!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int SortValue = int.Parse(this.txtSortValue.Text); NoName.NetShop.Model.SalesInfoModel model = new NoName.NetShop.Model.SalesInfoModel(); model.SortValue = SortValue; NoName.NetShop.BLL.SalesInfoModelBll bll = new NoName.NetShop.BLL.SalesInfoModelBll(); bll.Add(model); }