private void ShowInfo() { NoName.NetShop.BLL.AuctionLogModelBll bll = new NoName.NetShop.BLL.AuctionLogModelBll(); NoName.NetShop.Model.AuctionLogModel model = bll.GetModel(); this.txtAuctionId.Text = model.AuctionId.ToString(); this.txtUserName.Text = model.UserName; this.txtAuctionTime.Text = model.AuctionTime.ToString(); this.txtAutionPrice.Text = model.AutionPrice.ToString(); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(NoName.NetShop.Model.AuctionLogModel model) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("UP_auAuctionLog_Update"); db.AddInParameter(dbCommand, "AuctionId", DbType.Int32, model.AuctionId); db.AddInParameter(dbCommand, "UserName", DbType.AnsiString, model.UserName); db.AddInParameter(dbCommand, "AuctionTime", DbType.DateTime, model.AuctionTime); db.AddInParameter(dbCommand, "AutionPrice", DbType.Decimal, model.AutionPrice); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 得到一个对象实体 /// </summary> public NoName.NetShop.Model.AuctionLogModel GetModel() { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("UP_auAuctionLog_GetModel"); NoName.NetShop.Model.AuctionLogModel 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(txtAuctionId.Text)) { strErr += "AuctionId不是数字!\\n"; } if (this.txtUserName.Text == "") { strErr += "UserName不能为空!\\n"; } if (!PageValidate.IsDateTime(txtAuctionTime.Text)) { strErr += "AuctionTime不是时间格式!\\n"; } if (!PageValidate.IsDecimal(txtAutionPrice.Text)) { strErr += "AutionPrice不是数字!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int AuctionId = int.Parse(this.txtAuctionId.Text); string UserName = this.txtUserName.Text; DateTime AuctionTime = DateTime.Parse(this.txtAuctionTime.Text); decimal AutionPrice = decimal.Parse(this.txtAutionPrice.Text); NoName.NetShop.Model.AuctionLogModel model = new NoName.NetShop.Model.AuctionLogModel(); model.AuctionId = AuctionId; model.UserName = UserName; model.AuctionTime = AuctionTime; model.AutionPrice = AutionPrice; NoName.NetShop.BLL.AuctionLogModelBll bll = new NoName.NetShop.BLL.AuctionLogModelBll(); bll.Update(model); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsNumber(txtAuctionId.Text)) { strErr+="AuctionId�������֣�\\n"; } if(this.txtUserName.Text =="") { strErr+="UserName����Ϊ�գ�\\n"; } if(!PageValidate.IsDateTime(txtAuctionTime.Text)) { strErr+="AuctionTime����ʱ���ʽ��\\n"; } if(!PageValidate.IsDecimal(txtAutionPrice.Text)) { strErr+="AutionPrice�������֣�\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int AuctionId=int.Parse(this.txtAuctionId.Text); string UserName=this.txtUserName.Text; DateTime AuctionTime=DateTime.Parse(this.txtAuctionTime.Text); decimal AutionPrice=decimal.Parse(this.txtAutionPrice.Text); NoName.NetShop.Model.AuctionLogModel model=new NoName.NetShop.Model.AuctionLogModel(); model.AuctionId=AuctionId; model.UserName=UserName; model.AuctionTime=AuctionTime; model.AutionPrice=AutionPrice; NoName.NetShop.BLL.AuctionLogModelBll bll=new NoName.NetShop.BLL.AuctionLogModelBll(); bll.Update(model); }
/// <summary> /// 对象实体绑定数据 /// </summary> public NoName.NetShop.Model.AuctionLogModel ReaderBind(IDataReader dataReader) { NoName.NetShop.Model.AuctionLogModel model = new NoName.NetShop.Model.AuctionLogModel(); object ojb; ojb = dataReader["AuctionId"]; if (ojb != null && ojb != DBNull.Value) { model.AuctionId = (int)ojb; } model.UserName = dataReader["UserName"].ToString(); ojb = dataReader["AuctionTime"]; if (ojb != null && ojb != DBNull.Value) { model.AuctionTime = (DateTime)ojb; } ojb = dataReader["AutionPrice"]; if (ojb != null && ojb != DBNull.Value) { model.AutionPrice = (decimal)ojb; } return(model); }
/// <summary> /// ����ʵ������� /// </summary> public NoName.NetShop.Model.AuctionLogModel ReaderBind(IDataReader dataReader) { NoName.NetShop.Model.AuctionLogModel model=new NoName.NetShop.Model.AuctionLogModel(); object ojb; ojb = dataReader["AuctionId"]; if(ojb != null && ojb != DBNull.Value) { model.AuctionId=(int)ojb; } model.UserName=dataReader["UserName"].ToString(); ojb = dataReader["AuctionTime"]; if(ojb != null && ojb != DBNull.Value) { model.AuctionTime=(DateTime)ojb; } ojb = dataReader["AutionPrice"]; if(ojb != null && ojb != DBNull.Value) { model.AutionPrice=(decimal)ojb; } return model; }