public void createTask() { indicatorIdList = its.getSelectedIndicatorIdList(); if (indicatorIdList.Count == 0) { MessageBoxEx.Show("请选择指标模板,并从中选取要测试的指标", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } Tb_taskInfo task = new Db.Entity.Tb_taskInfo(); task.percent = 0; task.taskRound = 1; task.taskClass = (int)cbb_taskClass.SelectedValue; task.taskCode = txt_taskCode.Text.Trim(); task.taskExecutor = ccb_taskExecutor.Text;//txt_taskExecutor.Text.Trim(); task.taskName = txt_taskName.Text.Trim(); task.taskType = taskType; task.taskState = (int)TaskStateEnum.Created; task.createTime = DateTime.Now; try { TaskCache.createTask(task, indicatorIdList, brandModelIdDic); MessageBox.Show("任务创建成功", "操作成功", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Parent.Controls.Remove(this); } catch (Exception ex) { MessageBox.Show("任务创建失败,原因是:" + ex.Message, "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }