protected void btnAdd_Click(object sender, EventArgs e) { string strErr=""; if(this.txtProductName.Text =="") { strErr+="ProductName����Ϊ�գ�\\n"; } if(this.txtSmallIamge.Text =="") { strErr+="SmallIamge����Ϊ�գ�\\n"; } if(this.txtMediumImage.Text =="") { strErr+="MediumImage����Ϊ�գ�\\n"; } if(this.txtOutLinkUrl.Text =="") { strErr+="OutLinkUrl����Ϊ�գ�\\n"; } if(!PageValidate.IsDecimal(txtStartPrice.Text)) { strErr+="StartPrice�������֣�\\n"; } if(!PageValidate.IsDecimal(txtAddPrices.Text)) { strErr+="AddPrices�������֣�\\n"; } if(!PageValidate.IsDecimal(txtCurPrice.Text)) { strErr+="CurPrice�������֣�\\n"; } if(this.txtBrief.Text =="") { strErr+="Brief����Ϊ�գ�\\n"; } if(!PageValidate.IsDateTime(txtStartTime.Text)) { strErr+="StartTime����ʱ���ʽ��\\n"; } if(!PageValidate.IsDateTime(txtEndTime.Text)) { strErr+="EndTime����ʱ���ʽ��\\n"; } if(!PageValidate.IsNumber(txtStatus.Text)) { strErr+="Status�������֣�\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } string ProductName=this.txtProductName.Text; string SmallIamge=this.txtSmallIamge.Text; string MediumImage=this.txtMediumImage.Text; string OutLinkUrl=this.txtOutLinkUrl.Text; decimal StartPrice=decimal.Parse(this.txtStartPrice.Text); decimal AddPrices=decimal.Parse(this.txtAddPrices.Text); decimal CurPrice=decimal.Parse(this.txtCurPrice.Text); string Brief=this.txtBrief.Text; DateTime StartTime=DateTime.Parse(this.txtStartTime.Text); DateTime EndTime=DateTime.Parse(this.txtEndTime.Text); int Status=int.Parse(this.txtStatus.Text); NoName.NetShop.Model.ActionProductModel model=new NoName.NetShop.Model.ActionProductModel(); model.ProductName=ProductName; model.SmallIamge=SmallIamge; model.MediumImage=MediumImage; model.OutLinkUrl=OutLinkUrl; model.StartPrice=StartPrice; model.AddPrices=AddPrices; model.CurPrice=CurPrice; model.Brief=Brief; model.StartTime=StartTime; model.EndTime=EndTime; model.Status=Status; NoName.NetShop.BLL.ActionProductModelBll bll=new NoName.NetShop.BLL.ActionProductModelBll(); bll.Add(model); }
/// <summary> /// ����ʵ������� /// </summary> public NoName.NetShop.Model.ActionProductModel ReaderBind(IDataReader dataReader) { NoName.NetShop.Model.ActionProductModel model=new NoName.NetShop.Model.ActionProductModel(); object ojb; ojb = dataReader["AuctionId"]; if(ojb != null && ojb != DBNull.Value) { model.AuctionId=(int)ojb; } model.ProductName=dataReader["ProductName"].ToString(); model.SmallIamge=dataReader["SmallIamge"].ToString(); model.MediumImage=dataReader["MediumImage"].ToString(); model.OutLinkUrl=dataReader["OutLinkUrl"].ToString(); ojb = dataReader["StartPrice"]; if(ojb != null && ojb != DBNull.Value) { model.StartPrice=(decimal)ojb; } ojb = dataReader["AddPrices"]; if(ojb != null && ojb != DBNull.Value) { model.AddPrices=(decimal)ojb; } ojb = dataReader["CurPrice"]; if(ojb != null && ojb != DBNull.Value) { model.CurPrice=(decimal)ojb; } model.Brief=dataReader["Brief"].ToString(); ojb = dataReader["StartTime"]; if(ojb != null && ojb != DBNull.Value) { model.StartTime=(DateTime)ojb; } ojb = dataReader["EndTime"]; if(ojb != null && ojb != DBNull.Value) { model.EndTime=(DateTime)ojb; } ojb = dataReader["Status"]; if(ojb != null && ojb != DBNull.Value) { model.Status=(int)ojb; } return model; }