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; } if (picBxTree.Image == null) { MessageBox.Show("事件序列图不能为空!"); return; } if (picBxGrid.Image == null) { MessageBox.Show("事件代号不能为空!"); return; } DateTime now = DateTime.Now; BLL.failure_tree ftBll = new BLL.failure_tree(); Model.failure_tree addFhModel = new Model.failure_tree(); addFhModel.ft_addtime = now; addFhModel.ft_adduser = constants.currentUser.user_id; addFhModel.ft_caseid = ftBll.createCaseID(ftBll.getMaxCaseID()); addFhModel.ft_keywd = txtKeyWds.Text.Trim(); addFhModel.ft_pic = getImgToByte(picBxTree.Image); addFhModel.ft_grid = getImgToByte(picBxGrid.Image); addFhModel.ptype_id = plnTypIdLst[cmbPlaneType.SelectedIndex]; addFhModel.system_id = flSysIdLst[cmbFailSystem.SelectedIndex]; addFhModel.tpoint_id = tmPntIdLst[cmbTimePoint.SelectedIndex]; if (rchTxtExperience.Text == "添加时删除此说明:请用换行符分隔多个经验内容。") { addFhModel.experience = ""; } else { addFhModel.experience = rchTxtExperience.Text.Trim(); } ftBll.Add(addFhModel); MessageBox.Show("添加成功!"); BLL.v_failure_tree vftBll = new BLL.v_failure_tree(); father.vftList = vftBll.GetModelList("ft_addtime='" + now.ToString("yyyy-MM-dd HH:mm:ss") + "'"); 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.failure_tree ftBll = new BLL.failure_tree(); Model.failure_tree editFtModel = new Model.failure_tree(); editFtModel.ft_id = editModel.ft_id; editFtModel.ft_adduser = editModel.ft_adduser; editFtModel.ft_caseid = editModel.ft_caseid; editFtModel.ft_addtime = editModel.ft_addtime; editFtModel.ft_keywd = txtKeyWds.Text.Trim(); editFtModel.ptype_id = plnTypIdLst[cmbPlaneType.SelectedIndex]; editFtModel.system_id = flSysIdLst[cmbFailSystem.SelectedIndex]; editFtModel.tpoint_id = tmPntIdLst[cmbTimePoint.SelectedIndex]; editFtModel.experience = rchTxtExperience.Text; if (picTreeChanged) { editFtModel.ft_pic = getImgToByte(picBxTree.Image); } else { editFtModel.ft_pic = editModel.ft_pic; } if (picGridChanged) { editFtModel.ft_grid = getImgToByte(picBxGrid.Image); } else { editFtModel.ft_grid = editModel.ft_grid; } ftBll.Update(editFtModel); MessageBox.Show("修改成功!"); BLL.v_failure_tree vftBll = new BLL.v_failure_tree(); father.vftList = vftBll.GetModelList("ft_id=" + editFtModel.ft_id); father.ListViewLoadData(); this.Close(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(fds.Model.failure_tree model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(fds.Model.failure_tree model) { return(dal.Add(model)); }