private void btnDelAll_Click(object sender, EventArgs e) { if (MessageBox.Show("该操作将清空所有故障案例,是否继续?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (MessageBox.Show("真的要继续吗?该操作将清空所有故障案例!", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { BLL.fault_history fhBll = new BLL.fault_history(); if (fhBll.DeleteAll()) { MessageBox.Show("删除成功!"); btnSearch_Click(sender, e); } else { MessageBox.Show("操作失败!"); } } } }
private void btnOK_Click(object sender, EventArgs e) { if (cmbPlaneType.SelectedIndex == -1) { MessageBox.Show("请选择飞机型号!"); return; } if (cmbFailSystem.SelectedIndex == -1) { MessageBox.Show("请选择故障系统!"); return; } if (cmbTimePoint.SelectedIndex == -1) { MessageBox.Show("请选择故障时机!"); return; } BLL.fault_history fhBll = new BLL.fault_history(); Model.fault_history editFhModel = new Model.fault_history(); editFhModel.fh_id = editModel.fh_id; editFhModel.fh_adduser = editModel.fh_adduser; editFhModel.fh_addtime = editModel.fh_addtime; editFhModel.fh_caseid = editModel.fh_caseid; editFhModel.fh_cause = rchCause.Text; editFhModel.fh_description = rchtxtDescription.Text; editFhModel.fh_experience = rchTxtExperiance.Text; editFhModel.fh_explain = rchTxtExplain.Text; editFhModel.fh_keywd = txtKeyWds.Text.Trim(); editFhModel.fh_phenomenon = rchTxtPhnmn.Text; editFhModel.fh_reference = rchTxtReferance.Text; editFhModel.fh_suggest = rchTxtSuggest.Text; editFhModel.fh_title = txtTtl.Text; editFhModel.ptype_id = plnTypIdLst[cmbPlaneType.SelectedIndex]; editFhModel.system_id = flSysIdLst[cmbFailSystem.SelectedIndex]; editFhModel.tpoint_id = tmPntIdLst[cmbTimePoint.SelectedIndex]; fhBll.Update(editFhModel); MessageBox.Show("修改成功!"); BLL.v_fail_history vfhBll = new BLL.v_fail_history(); father.vfhList = vfhBll.GetModelList("fh_id=" + editFhModel.fh_id); father.ListViewLoadData(); this.Close(); }
private void btnOK_Click(object sender, EventArgs e) { if (cmbPlaneType.SelectedIndex == -1) { MessageBox.Show("请选择飞机型号!"); return; } if (cmbFailSystem.SelectedIndex == -1) { MessageBox.Show("请选择故障系统!"); return; } if (cmbTimePoint.SelectedIndex == -1) { MessageBox.Show("请选择故障时机!"); return; } BLL.fault_history fhBll = new BLL.fault_history(); Model.fault_history addFhModel = new Model.fault_history(); addFhModel.fh_addtime = DateTime.Now; addFhModel.fh_adduser = constants.currentUser.user_id; addFhModel.fh_caseid = fhBll.createCaseID(fhBll.getMaxCaseID()); addFhModel.fh_cause = rchCause.Text; addFhModel.fh_description = rchtxtDescription.Text; addFhModel.fh_experience = rchTxtExperiance.Text; addFhModel.fh_explain = rchTxtExplain.Text; addFhModel.fh_keywd = txtKeyWds.Text.Trim(); addFhModel.fh_phenomenon = rchTxtPhnmn.Text; addFhModel.fh_reference = rchTxtReferance.Text; addFhModel.fh_suggest = rchTxtSuggest.Text; addFhModel.fh_title = txtTtl.Text; addFhModel.ptype_id = plnTypIdLst[cmbPlaneType.SelectedIndex]; addFhModel.system_id = flSysIdLst[cmbFailSystem.SelectedIndex]; addFhModel.tpoint_id = tmPntIdLst[cmbTimePoint.SelectedIndex]; fhBll.Add(addFhModel); MessageBox.Show("添加成功!"); BLL.v_fail_history vfhBll = new BLL.v_fail_history(); father.vfhList = vfhBll.GetModelList("fh_phenomenon='" + addFhModel.fh_phenomenon + "' and fh_caseid='" + addFhModel.fh_caseid + "'"); father.ListViewLoadData(); this.Close(); }
private void btnDelete_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { MessageBox.Show("请选择要删除的项!"); } else { if (MessageBox.Show("是否删除?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { int delID = (int)listView1.SelectedItems[0].Tag; BLL.fault_history fhBll = new BLL.fault_history(); if (fhBll.Delete(delID)) { MessageBox.Show("删除成功!"); btnSearch_Click(sender, e); } else { MessageBox.Show("操作失败!"); } } } }
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); } }