Beispiel #1
0
        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();
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 private void btnDelAll_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("该操作将清空所有事件序列图数据,是否继续?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         if (MessageBox.Show("真的要继续吗?该操作将清空所有事件序列图数据!", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             BLL.failure_tree ftBll = new BLL.failure_tree();
             if (ftBll.DeleteAll())
             {
                 MessageBox.Show("删除成功!");
                 btnSearch_Click(sender, e);
             }
             else
             {
                 MessageBox.Show("操作失败!");
             }
         }
     }
 }
Beispiel #4
0
 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.failure_tree ftBll = new BLL.failure_tree();
             if (ftBll.Delete(delID))
             {
                 MessageBox.Show("删除成功!");
                 btnSearch_Click(sender, e);
             }
             else
             {
                 MessageBox.Show("操作失败!");
             }
         }
     }
 }