public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtTitle.Text.Trim().Length == 0) { strErr += "名称不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int ID = int.Parse(this.lblID.Text); string Title = this.txtTitle.Text; int No = int.Parse(this.lblNo.Text); Maticsoft.Model.WorksItem model = new Maticsoft.Model.WorksItem(); model.ID = ID; model.Title = Title; model.No = No; Maticsoft.BLL.WorksItem bll = new Maticsoft.BLL.WorksItem(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtTitle.Text.Trim().Length == 0) { strErr += "名称不能为空!\\n"; } if (!PageValidate.IsNumber(txtNo.Text)) { strErr += "No格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string Title = this.txtTitle.Text; int No = int.Parse(this.txtNo.Text); Maticsoft.Model.WorksItem model = new Maticsoft.Model.WorksItem(); model.Title = Title; model.No = No; Maticsoft.BLL.WorksItem bll = new Maticsoft.BLL.WorksItem(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void ShowInfo(int ID) { Maticsoft.BLL.WorksItem bll = new Maticsoft.BLL.WorksItem(); Maticsoft.Model.WorksItem model = bll.GetModel(ID); this.lblID.Text = model.ID.ToString(); this.txtTitle.Text = model.Title; this.lblNo.Text = model.No.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Maticsoft.BLL.WorksItem bll = new Maticsoft.BLL.WorksItem(); if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { int ID = (Convert.ToInt32(Request.Params["id"])); bll.Delete(ID); } } }