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(); }