private void btnSubmit_Click(object sender, EventArgs e) { if (txtName.Text.Trim() == "") { MessageBox.Show("故障时机不能为空!"); return; } BLL.time_point Bll = new BLL.time_point(); if (Bll.GetModel(txtName.Text.Trim()) != null) { MessageBox.Show("故障时机已存在!"); return; } Model.time_point addModel = new Model.time_point(); addModel.tpoint_value = txtName.Text.Trim(); addModel.tpoint_remark = rchTxtRemark.Text; Bll.Add(addModel); this.Close(); }
private void btnSubmit_Click(object sender, EventArgs e) { if (txtName.Text.Trim() == "") { MessageBox.Show("故障时机不能为空!"); return; } BLL.time_point Bll = new BLL.time_point(); Model.time_point Model = Bll.GetModel(txtName.Text.Trim()); if (Model != null && Model.tpoint_id != this.EditModel.tpoint_id) { MessageBox.Show("型号已存在!"); return; } EditModel.tpoint_value = txtName.Text.Trim(); EditModel.tpoint_remark = rchTxtRemark.Text; Bll.Update(EditModel); MessageBox.Show("修改成功!"); this.Close(); }
private void initFaultHistory() { progressBar1.Value = 90; DataSet ds = LoadDataFromExcel(fileName, "故障案例库信息"); BLL.fault_history bll = new BLL.fault_history(); Model.fault_history model = new Model.fault_history(); BLL.time_point tpBll = new BLL.time_point(); BLL.fail_system fsBll = new BLL.fail_system(); BLL.plane_type ptBll = new BLL.plane_type(); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["案例编号"].ToString() == "") { return; } model.fh_addtime = DateTime.Now; model.fh_adduser = constants.currentUser.user_id; model.fh_caseid = dr["案例编号"].ToString(); model.fh_cause = dr["故障原因"].ToString(); model.fh_description = dr["相关描述"].ToString(); model.fh_experience = dr["经验教训"].ToString(); model.fh_explain = dr["解释"].ToString(); model.fh_keywd = dr["关键词"].ToString(); model.fh_phenomenon = dr["故障现象"].ToString(); model.fh_reference = dr["参考资料"].ToString(); model.fh_suggest = dr["维修建议"].ToString(); model.fh_title = dr["案例标题"].ToString(); model.ptype_id = ptBll.GetModel(dr["飞机型号"].ToString()).ptype_id; model.system_id = fsBll.GetModel(dr["故障系统"].ToString()).system_id; model.tpoint_id = tpBll.GetModel(dr["发生时机"].ToString()).tpoint_id; bll.Add(model); } }