public FailSystemEditFrm(Model.fail_system EditModel) { InitializeComponent(); this.EditModel = EditModel; txtName.Text = EditModel.system_name; rchTxtRemark.Text = EditModel.system_remark; }
private void btnEdit_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { MessageBox.Show("请选择要修改的项!"); } else { Model.fail_system editModel = new Model.fail_system(); editModel = modelList[listView1.SelectedIndices[0]]; FailSystemEditFrm EditFrm = new FailSystemEditFrm(editModel); EditFrm.ShowDialog(); getAllList(); } }
private void initFailSystem() { progressBar1.Value = 50; DataSet ds = LoadDataFromExcel(fileName, "涉及的系统"); BLL.fail_system bll = new BLL.fail_system(); Model.fail_system model = new Model.fail_system(); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["涉及的系统"].ToString() == "") { return; } model.system_name = dr["涉及的系统"].ToString(); bll.Add(model); } }
private void btnSubmit_Click(object sender, EventArgs e) { if (txtName.Text.Trim() == "") { MessageBox.Show("故障系统不能为空!"); return; } BLL.fail_system Bll = new BLL.fail_system(); if (Bll.GetModel(txtName.Text.Trim()) != null) { MessageBox.Show("故障系统已存在!"); return; } Model.fail_system addModel = new Model.fail_system(); addModel.system_name = txtName.Text.Trim(); addModel.system_remark = rchTxtRemark.Text; Bll.Add(addModel); this.Close(); }
private void btnSubmit_Click(object sender, EventArgs e) { if (txtName.Text.Trim() == "") { MessageBox.Show("故障系统不能为空!"); return; } BLL.fail_system Bll = new BLL.fail_system(); Model.fail_system Model = Bll.GetModel(txtName.Text.Trim()); if (Model != null && Model.system_id != this.EditModel.system_id) { MessageBox.Show("故障系统已存在!"); return; } EditModel.system_name = txtName.Text.Trim(); EditModel.system_remark = rchTxtRemark.Text; Bll.Update(EditModel); MessageBox.Show("修改成功!"); this.Close(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(fds.Model.fail_system model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(fds.Model.fail_system model) { return(dal.Add(model)); }