Пример #1
0
 private void btn_pass_Click(object sender, EventArgs e)
 {
     if (MessageBoxEx.Show("确定审批通过?", "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
     {
         TaskCache.updateTaskState(taskInfoId, (int)TaskStateEnum.Passed);
         MainFormAdapter.reloadTaskApproval();
         this.Close();
     }
 }
Пример #2
0
 private void ben_close_Click(object sender, EventArgs e)
 {
     if (MessageBoxEx.Show("您确定要关闭此测试任务?" + Environment.NewLine + "任务关闭后将无法对剩余的指标进行测试。", "操作警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         TaskCache.updateTaskState(taskInfoId, (int)TaskStateEnum.Closed);
         MainFormAdapter.reloadTaskMainPanel();
         this.Close();
     }
 }
Пример #3
0
 private void btn_login_Click(object sender, EventArgs e)
 {
     if (login())
     {
         MainForm mainForm = new AviationSafetyExperiment.MainForm();
         MainFormAdapter.setMainForm(mainForm);
         mainForm.Show();
         this.Hide();
     }
 }
Пример #4
0
        private void btn_reject_Click(object sender, EventArgs e)
        {
            TaskReject tr = new AviationSafetyExperiment.TaskReject();

            if (tr.ShowDialog() == DialogResult.OK)
            {
                string remark = tr.rejectReason;
                TaskCache.updateTaskState(taskInfoId, (int)TaskStateEnum.Rejected, remark);
                MainFormAdapter.reloadTaskApproval();
                this.Close();
            }
        }
Пример #5
0
 private void btn_done_Click(object sender, EventArgs e)
 {
     if (checkCanDone() == false)
     {
         MessageBoxEx.Show("您尚有未填写的指标测试结果,无法完成任务。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         TaskCache.updateTaskState(taskInfoId, (int)TaskStateEnum.Completed);
         MainFormAdapter.reloadTaskMainPanel();
         MessageBoxEx.Show("任务已设置为【完成】状态");
         this.Close();
     }
 }
Пример #6
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            List <Tb_taskResult> resultList = new List <Db.Entity.Tb_taskResult>();

            //int oldRound = -1;
            if (currentRound != maxRound)
            {
                MessageBoxEx.Show("当前轮次不是最大轮次,无法保存", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //foreach (DataGridViewRow dr in trp.dgv.Rows)
            //{
            //    if (dr.Cells["taskRecord"].Value == null)
            //    {
            //        dr.Cells["taskRecord"].Value = "";
            //    }
            //    if (dr.Cells["taskRemark"].Value == null)
            //    {
            //        dr.Cells["taskRemark"].Value = "";
            //    }
            //    if (dr.Cells["attachment"].Value == null)
            //    {
            //        dr.Cells["attachment"].Value = "";
            //    }
            //    //如果修改过测试结果,或是测试结果内有内容(无论是否本次输入),都保存
            //    if (dr.Cells["taskResult"].Style.BackColor == Color.LightSeaGreen
            //        || dr.Cells["taskRecord"].Style.BackColor == Color.LightSeaGreen
            //        || dr.Cells["taskRemark"].Style.BackColor == Color.LightSeaGreen
            //        || dr.Cells["attachmentCount"].Style.BackColor == Color.LightSeaGreen
            //        || dr.Cells["taskResult"].Value.ToString() != "0"
            //        || dr.Cells["taskRecord"].Value.ToString() != string.Empty
            //        || dr.Cells["taskRemark"].Value.ToString() != string.Empty
            //        || dr.Cells["attachment"].Value.ToString() != string.Empty)
            //    {
            //        Tb_taskResult result = new Tb_taskResult();
            //        result.indicatorId = (int)dr.Cells["indicatorId"].Value;
            //        result.modelId = (int)dr.Cells["modelId"].Value;
            //        result.taskDateTime = DateTime.Now;
            //        result.taskExecutor = User.currentUser.name;
            //        result.taskId = taskInfoId;
            //        result.taskRecord = dr.Cells["taskRecord"].Value == null ? "" : dr.Cells["taskRecord"].Value.ToString();
            //        result.taskRemark = dr.Cells["taskRemark"].Value.ToString();
            //        result.taskResult = (int)dr.Cells["taskResult"].Value;
            //        result.attachment = dr.Cells["attachment"].Value.ToString();
            //        result.supplement = dr.Cells["supplement"].Value == null ? "" : dr.Cells["supplement"].Value.ToString();
            //        result.taskStep = maxTaskStep + 1;
            //        result.taskRound = currentRound;
            //        //result.taskRound = int.Parse(labelItem2.Text);
            //        resultList.Add(result);

            //        //保存任务之时,判断当前项是否填写完整,如果填写完整,则修改该控件下的isFillFinish值
            //        if (result.taskResult != 0 && result.taskRecord != "")
            //        {
            //            dr.Cells["isFill"].Value = 1;
            //        }
            //    }
            //}
            foreach (var item in trp.allResultModelList)
            {
                if (item.isHaveModi == 1)
                {
                    Tb_taskResult result = new Tb_taskResult();
                    result.indicatorId = item.indicatorId;
                    result.modelId     = item.modelId;
                    DateTime taskDateTime;
                    result.taskDateTime = DateTime.TryParse(item.taskDateTime, out taskDateTime) ? taskDateTime : DateTime.Now;
                    //result.taskDateTime = DateTime.TryParse(dr.Cells["taskDateTime"].Value.ToString(), out taskDateTime) ? taskDateTime : DateTime.Now;//DateTime.Now;
                    result.taskExecutor = User.currentUser.name;
                    result.taskId       = taskInfoId;
                    result.taskRecord   = item.taskRecord;
                    result.taskRemark   = item.taskRemark;
                    result.taskResult   = item.taskResult;
                    result.attachment   = item.attachment;
                    result.supplement   = item.supplement;
                    result.taskStep     = maxTaskStep + 1;
                    result.taskRound    = currentRound;
                    //result.taskRound = int.Parse(labelItem2.Text);
                    resultList.Add(result);

                    if (result.taskResult != 0 && result.taskRecord != "")
                    {
                        item.isFillFinish = 1;
                    }
                }
            }
            if (resultList.Count > 0)
            {
                TaskResultCache.addCache(resultList);                         //添加测试记录
                var taskInfo            = TaskCache.getCacheById(taskInfoId); //更新任务进度字段
                var taskResultMainCount = trp.getAllResultModelCount();
                taskInfo.percent = resultList.Count * 100 / taskResultMainCount;
                TaskCache.addCache(taskInfo);
                //刷新单元格背景色为白色
                foreach (DataGridViewRow dr in trp.dgv.Rows)
                {
                    dr.Cells["taskResult"].Style.BackColor      = Color.White;
                    dr.Cells["taskRecord"].Style.BackColor      = Color.White;
                    dr.Cells["taskRemark"].Style.BackColor      = Color.White;
                    dr.Cells["attachmentCount"].Style.BackColor = Color.White;
                    dr.Cells["taskStep"].Value = int.Parse(dr.Cells["taskStep"].Value.ToString()) + 1;
                }
                MainFormAdapter.reloadTaskMainPanel();
                maxTaskStep++;//最大步骤编号,每次保存,都加1,如果切换轮次,需重新获取该轮次的最大步骤编号
                trp.maxResultStep     = maxTaskStep;
                trp.currentResultStep = maxTaskStep;
            }
        }