コード例 #1
0
        private void txtNameNewTask_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                Task task = new Task();
                task.TaskName  = txtNameNewTask.Text;
                task.StartDate = dtpStartDateNewTask.Value;
                task.EndDate   = dtpEndDateNewTask.Value;
                //task.IDProject = 0;
                task.IDTask = -1;
                if (cbProject.SelectedIndex == -1)
                {
                    MessageBox.Show("Chưa chọn dự án");
                    return;
                }
                task.IDProject = TaskController.GetListProject()[cbProject.SelectedIndex].IDProject;
                ActiveControl  = null;
                TaskController.AddNewTask(task, Employee, this);
                txtNameNewTask.Clear();
                txtNameNewTask.Text = "Thêm công việc mới";

                dtpStartDateNewTask.Visible = false;
                dtpEndDateNewTask.Visible   = false;
                label52.Visible             = false;
                cbProject.Visible           = false;
                cbProject.Items.Clear();
                cbProject.Text  = "Project";
                label53.Visible = false;
            }
        }
コード例 #2
0
        public void Add_Task()
        {
            // Act
            Tasks testTask        = new Tasks(m_ParentBoardID, m_ParentColumnID, m_ColumnName, "New testTask content");
            int   initalTaskCount = m_ScrumToolDBContext.Tasks.Count();

            // Arrange
            m_TaskController.AddNewTask(testTask);
            // Assert
            m_ScrumToolDBContext.Tasks.Should().NotBeNullOrEmpty()
            .And.HaveCount(initalTaskCount + 1, "Number of inital coloumns + 1");
            m_ScrumToolDBContext.Tasks.Last().ShouldBeEquivalentTo(testTask, options =>
                                                                   options.Excluding(t => t.ID)
                                                                   .Excluding(t => t.DueDate), "The last Task object in the table should be the testTask");
        }
コード例 #3
0
 private void txtTaskName_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == Convert.ToChar(Keys.Enter))
     {
         if (IsNew)
         {
             ProjectController.Add(Project, _frmList);
             IsNew   = false;
             Project = ProjectController._project;
         }
         Task task = new Task();
         task.TaskName  = txtTaskName.Text;
         task.StartDate = dtpTaskStartDate.Value;
         task.EndDate   = dtpTaskEndDate.Value;
         task.IDProject = Project.IDProject;
         TaskController.AddNewTask(task, this);
         txtTaskName.Text = "Thêm công việc";
     }
 }