/// <summary> /// 对象实体绑定数据 /// </summary> public NoName.NetShop.Model.CommendModel ReaderBind(IDataReader dataReader) { NoName.NetShop.Model.CommendModel model = new NoName.NetShop.Model.CommendModel(); object ojb; ojb = dataReader["SchemeId"]; if (ojb != null && ojb != DBNull.Value) { model.SchemeId = (int)ojb; } ojb = dataReader["CateId"]; if (ojb != null && ojb != DBNull.Value) { model.CateId = (int)ojb; } ojb = dataReader["ProductId"]; if (ojb != null && ojb != DBNull.Value) { model.ProductId = (int)ojb; } ojb = dataReader["Quantity"]; if (ojb != null && ojb != DBNull.Value) { model.Quantity = (int)ojb; } return(model); }
private void ShowInfo(int SchemeId, int CateId, int ProductId) { NoName.NetShop.BLL.CommendModelBll bll = new NoName.NetShop.BLL.CommendModelBll(); NoName.NetShop.Model.CommendModel model = bll.GetModel(SchemeId, CateId, ProductId); this.lblSchemeId.Text = model.SchemeId.ToString(); this.lblCateId.Text = model.CateId.ToString(); this.lblProductId.Text = model.ProductId.ToString(); this.txtQuantity.Text = model.Quantity.ToString(); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(NoName.NetShop.Model.CommendModel model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("UP_ssCommend_Update"); db.AddInParameter(dbCommand, "SchemeId", DbType.Int32, model.SchemeId); db.AddInParameter(dbCommand, "CateId", DbType.Int32, model.CateId); db.AddInParameter(dbCommand, "ProductId", DbType.Int32, model.ProductId); db.AddInParameter(dbCommand, "Quantity", DbType.Int32, model.Quantity); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 得到一个对象实体 /// </summary> public NoName.NetShop.Model.CommendModel GetModel(int SchemeId, int CateId, int ProductId) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("UP_ssCommend_GetModel"); db.AddInParameter(dbCommand, "SchemeId", DbType.Int32, SchemeId); db.AddInParameter(dbCommand, "CateId", DbType.Int32, CateId); db.AddInParameter(dbCommand, "ProductId", DbType.Int32, ProductId); NoName.NetShop.Model.CommendModel 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(txtQuantity.Text)) { strErr+="Quantity�������֣�\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int Quantity=int.Parse(this.txtQuantity.Text); NoName.NetShop.Model.CommendModel model=new NoName.NetShop.Model.CommendModel(); model.Quantity=Quantity; NoName.NetShop.BLL.CommendModelBll bll=new NoName.NetShop.BLL.CommendModelBll(); bll.Add(model); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtQuantity.Text)) { strErr += "Quantity不是数字!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int Quantity = int.Parse(this.txtQuantity.Text); NoName.NetShop.Model.CommendModel model = new NoName.NetShop.Model.CommendModel(); model.Quantity = Quantity; NoName.NetShop.BLL.CommendModelBll bll = new NoName.NetShop.BLL.CommendModelBll(); bll.Add(model); }
/// <summary> /// ����ʵ������� /// </summary> public NoName.NetShop.Model.CommendModel ReaderBind(IDataReader dataReader) { NoName.NetShop.Model.CommendModel model=new NoName.NetShop.Model.CommendModel(); object ojb; ojb = dataReader["SchemeId"]; if(ojb != null && ojb != DBNull.Value) { model.SchemeId=(int)ojb; } ojb = dataReader["CateId"]; if(ojb != null && ojb != DBNull.Value) { model.CateId=(int)ojb; } ojb = dataReader["ProductId"]; if(ojb != null && ojb != DBNull.Value) { model.ProductId=(int)ojb; } ojb = dataReader["Quantity"]; if(ojb != null && ojb != DBNull.Value) { model.Quantity=(int)ojb; } return model; }