Beispiel #1
0
        private void tbNewTask_Click(object sender, EventArgs e)
        {
            taskForm taskForm = new taskForm(this);

            if (taskForm.ShowDialog() == DialogResult.OK)
            {
                var  newTask = taskForm.taskInfo;
                bool b       = TaskMngBLL.GetInstance().AddNewTask(newTask);
                if (!b)
                {
                    MessageBox.Show("保存任务失败了");
                    return;
                }
                FillTaksInfo(newTask);
            }
        }
Beispiel #2
0
 private void taskDataView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (taskDataView.SelectedCells.Count != 0)
     {
         int taskid   = Convert.ToInt16(taskDataView.CurrentRow.Cells[0].Value);
         var taskInfo = TaskMngBLL.GetInstance().GetTask(taskid);
         if (taskInfo.RunState == ERunState.Running)
         {
             MessageBox.Show("任务运行中,不能进行编辑");
             return;
         }
         taskForm taskForm = new taskForm(this);
         taskForm.Set(taskInfo);
         if (taskForm.ShowDialog() == DialogResult.OK)
         {
             if (!TaskMngBLL.GetInstance().UpdateTask(taskForm.taskInfo))
             {
                 MessageBox.Show("保存任务失败了");
                 return;
             }
         }
         RefreshDataGridView(taskInfo);
     }
 }