public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsNumber(txtsender_id.Text)) { strErr+="送礼人格式错误!\\n"; } if(!PageValidate.IsNumber(txtaccepter_id.Text)) { strErr+="接受人格式错误!\\n"; } if(!PageValidate.IsDateTime(txtsend_time.Text)) { strErr+="送礼时间格式错误!\\n"; } if(this.txtsendgift_comment.Text.Trim().Length==0) { strErr+="送礼说明不能为空!\\n"; } if(this.txtsendgift_msg.Text.Trim().Length==0) { strErr+="送礼留言不能为空!\\n"; } if(!PageValidate.IsNumber(txtsendgift_count.Text)) { strErr+="送礼数量格式错误!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int sendgift_ID=int.Parse(this.lblsendgift_ID.Text); int virtualgoods_ID=int.Parse(this.lblvirtualgoods_ID.Text); int sender_id=int.Parse(this.txtsender_id.Text); int accepter_id=int.Parse(this.txtaccepter_id.Text); DateTime send_time=DateTime.Parse(this.txtsend_time.Text); string sendgift_comment=this.txtsendgift_comment.Text; string sendgift_msg=this.txtsendgift_msg.Text; int sendgift_count=int.Parse(this.txtsendgift_count.Text); la.Model.sendgift model=new la.Model.sendgift(); model.sendgift_ID=sendgift_ID; model.virtualgoods_ID=virtualgoods_ID; model.sender_id=sender_id; model.accepter_id=accepter_id; model.send_time=send_time; model.sendgift_comment=sendgift_comment; model.sendgift_msg=sendgift_msg; model.sendgift_count=sendgift_count; la.BLL.sendgift bll=new la.BLL.sendgift(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }
private void ShowInfo(int sendgift_ID,int virtualgoods_ID) { la.BLL.sendgift bll=new la.BLL.sendgift(); la.Model.sendgift model=bll.GetModel(sendgift_ID,virtualgoods_ID); this.lblsendgift_ID.Text=model.sendgift_ID.ToString(); this.lblvirtualgoods_ID.Text=model.virtualgoods_ID.ToString(); this.lblsender_id.Text=model.sender_id.ToString(); this.lblaccepter_id.Text=model.accepter_id.ToString(); this.lblsend_time.Text=model.send_time.ToString(); this.lblsendgift_comment.Text=model.sendgift_comment; this.lblsendgift_msg.Text=model.sendgift_msg; this.lblsendgift_count.Text=model.sendgift_count.ToString(); }