protected void btnSave_Click(object sender, EventArgs e) { string err = gridview_err(); string str = ""; int wuzi_id = 0; AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); string fengongsi = currentUser.TrueName; int num = 0; int peixunbanid = Convert.ToInt16(qishu.SelectedValue); int style = Convert.ToInt16(RadioButtonList1.SelectedValue); DateTime dtime = DateTime.Now; string beizhu = ""; if (err == "") { int i = 0; foreach (GridViewRow row in GridView1.Rows) { num = Convert.ToInt16(((TextBox)row.FindControl("num")).Text); if (num != 0) { beizhu = ((TextBox)row.FindControl("beizhu")).Text; wuzi_id = Convert.ToInt16(((Label)row.FindControl("id")).Text); Maticsoft.Model.wuzi_diaoyong model = new Maticsoft.Model.wuzi_diaoyong(); model.wuzi_id = wuzi_id; model.fengongsi = fengongsi; model.num = num; model.peixunbanid = peixunbanid; model.style = style; model.time = dtime; model.beizhu = beizhu; Maticsoft.BLL.wuzi_diaoyong bll = new Maticsoft.BLL.wuzi_diaoyong(); if (bll.Add(model) > 0) { i++; } ; } } if (i > 0) { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "共调用了" + i + "项物品", "list.aspx"); } } else { MessageBox.Show(this, err); return; } }
private void ShowInfo(int id) { Maticsoft.BLL.wuzi_diaoyong bll = new Maticsoft.BLL.wuzi_diaoyong(); Maticsoft.Model.wuzi_diaoyong model = bll.GetModel(id); this.lblid.Text = model.id.ToString(); this.txtwuzi_id.Text = model.wuzi_id.ToString(); this.txtfengongsi.Text = model.fengongsi; this.txtnum.Text = model.num.ToString(); this.txtpeixunbanid.Text = model.peixunbanid.ToString(); this.txtstyle.Text = model.style.ToString(); this.txttime.Text = model.time.ToString(); this.txtbeizhu.Text = model.beizhu; this.txtbeizhu2.Text = model.beizhu2; }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtwuzi_id.Text)) { strErr += "wuzi_id格式错误!\\n"; } if (this.txtfengongsi.Text.Trim().Length == 0) { strErr += "fengongsi不能为空!\\n"; } if (!PageValidate.IsNumber(txtnum.Text)) { strErr += "num格式错误!\\n"; } if (!PageValidate.IsNumber(txtpeixunbanid.Text)) { strErr += "peixunbanid格式错误!\\n"; } if (!PageValidate.IsNumber(txtstyle.Text)) { strErr += "style格式错误!\\n"; } if (!PageValidate.IsDateTime(txttime.Text)) { strErr += "time格式错误!\\n"; } if (this.txtbeizhu.Text.Trim().Length == 0) { strErr += "beizhu不能为空!\\n"; } if (this.txtbeizhu2.Text.Trim().Length == 0) { strErr += "beizhu2不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int id = int.Parse(this.lblid.Text); int wuzi_id = int.Parse(this.txtwuzi_id.Text); string fengongsi = this.txtfengongsi.Text; int num = int.Parse(this.txtnum.Text); int peixunbanid = int.Parse(this.txtpeixunbanid.Text); int style = int.Parse(this.txtstyle.Text); DateTime time = DateTime.Parse(this.txttime.Text); string beizhu = this.txtbeizhu.Text; string beizhu2 = this.txtbeizhu2.Text; Maticsoft.Model.wuzi_diaoyong model = new Maticsoft.Model.wuzi_diaoyong(); model.id = id; model.wuzi_id = wuzi_id; model.fengongsi = fengongsi; model.num = num; model.peixunbanid = peixunbanid; model.style = style; model.time = time; model.beizhu = beizhu; model.beizhu2 = beizhu2; Maticsoft.BLL.wuzi_diaoyong bll = new Maticsoft.BLL.wuzi_diaoyong(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }