public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtpic_cate_ID.Text)) { strErr += "pic_cate_ID格式错误!\\n"; } if (!PageValidate.IsDateTime(txtpic_date.Text)) { strErr += "pic_date格式错误!\\n"; } if (this.txtpic_name.Text.Trim().Length == 0) { strErr += "pic_name不能为空!\\n"; } if (this.txtpic_valid.Text.Trim().Length == 0) { strErr += "pic_valid不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int pic_cate_ID = int.Parse(this.txtpic_cate_ID.Text); int pic_ID = int.Parse(this.lblpic_ID.Text); DateTime pic_date = DateTime.Parse(this.txtpic_date.Text); string pic_name = this.txtpic_name.Text; string pic_valid = this.txtpic_valid.Text; WalleProject.Model.t_picture model = new WalleProject.Model.t_picture(); model.pic_cate_ID = pic_cate_ID; model.pic_ID = pic_ID; model.pic_date = pic_date; model.pic_name = pic_name; model.pic_valid = pic_valid; WalleProject.BLL.t_picture bll = new WalleProject.BLL.t_picture(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
protected void edit_save_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(ddl_edit.SelectedValue)) { strErr += "格式错误!\\n"; } if (!PageValidate.IsDateTime(edit_date.Text)) { strErr += "时间格式错误!\\n"; } if (this.edit_name.Text.Trim().Length == 0) { strErr += " 不能为空!\\n"; } if (this.edit_path.Text.Trim().Length == 0) { strErr += " 不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int pic_cate_ID = int.Parse(this.ddl_edit.SelectedValue); DateTime pic_date = DateTime.Parse(this.edit_date.Text); string pic_name = this.edit_name.Text; string pic_valid = this.edit_path.Text; WalleProject.Model.t_picture model = new WalleProject.Model.t_picture(); model.pic_cate_ID = pic_cate_ID; model.pic_date = pic_date; model.pic_name = pic_name; model.pic_valid = pic_valid; model.pic_ID = Convert.ToInt32(Request.Params["id"]); WalleProject.BLL.t_picture bll = new WalleProject.BLL.t_picture(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "ImageView.aspx"); }