private void ShowInfo(int id) { Maticsoft.BLL.fenzu bll = new Maticsoft.BLL.fenzu(); Maticsoft.Model.fenzu model = bll.GetModel(id); this.lblid.Text = model.id.ToString(); this.lblqishu.Text = model.qishu; this.lblzushu.Text = model.zushu.ToString(); this.lblzuming.Text = model.zuming; }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtqishu.Text.Trim().Length == 0) { strErr += "qishu不能为空!\\n"; } if (!PageValidate.IsNumber(txtzushu.Text)) { strErr += "zushu格式错误!\\n"; } if (this.txtzuming.Text.Trim().Length == 0) { strErr += "zuming不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int id = int.Parse(this.lblid.Text); string qishu = this.txtqishu.Text; int zushu = int.Parse(this.txtzushu.Text); string zuming = this.txtzuming.Text; Maticsoft.Model.fenzu model = new Maticsoft.Model.fenzu(); model.id = id; model.qishu = qishu; model.zushu = zushu; model.zuming = zuming; Maticsoft.BLL.fenzu bll = new Maticsoft.BLL.fenzu(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; //if(this.txtqishu.Text.Trim().Length==0) //{ // strErr+="qishu不能为空!\\n"; //} //if(!PageValidate.IsNumber(txtzushu.Text)) //{ // strErr+="zushu格式错误!\\n"; //} if (this.txtzuming.Text.Trim().Length == 0) { strErr += "zuming不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } //string qishu = this.DropDownList2.SelectedValue; int zushu = int.Parse(this.DropDownList1.SelectedValue); string zuming = this.txtzuming.Text; Maticsoft.Model.fenzu model = new Maticsoft.Model.fenzu(); model.qishu = Label2.Text.ToString().Trim(); model.zushu = zushu; model.zuming = zuming; Maticsoft.BLL.fenzu bll = new Maticsoft.BLL.fenzu(); bll.Add(model); string add_str = "add.aspx?qishu=" + Label2.Text + "&name=" + Label1.Text; Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", add_str); }