예제 #1
0
        public void CreateEntry()
        {
            var projectLogic = new ProjectLogic();
            var project      = projectLogic.GetProjectById(project_id);

            projectLogic.Dispose();
            var subtaskLogic = new SubtaskLogic();
            var subtask      = subtaskLogic.GetById(this.SelectedSubtask.Id);

            ChangeParentAssignmentToInProgress(subtask);

            var entryCreateViewModel = new EntryCreateViewModel
            {
                Comment         = this.tb_Description.Text,
                Date            = DateTime.Now,
                Name            = this.tb_Name.Text,
                Project         = project,
                Subtask         = subtask,
                DurationAsTicks = this.DurationElapsed.Ticks,
                Ended           = this.stopped,
                Started         = this.started
            };

            subtaskLogic.AddEntry(this.SelectedSubtask.Id, entryCreateViewModel, this.chebo_FinishesSubtask.IsChecked.Value);
            subtaskLogic.Dispose();

            this.Close();
        }
예제 #2
0
 private void cb_Subtask_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0 && e.AddedItems[0] != null)
     {
         this.SelectedSubtask = e.AddedItems[0] as SubtaskComboBoxViewModel;
         this.tb_Name.Text    = this.SelectedSubtask.Name;
         var subtaskLogic = new SubtaskLogic();
         var subtask      = subtaskLogic.GetById(this.SelectedSubtask.Id);
         this.timekeeperMax = new TimeSpan(subtask.Assignment.GetDifferenceOfPlannedAndElapsedTicks().GetValueOrDefault());
         subtaskLogic.Dispose();
     }
 }
예제 #3
0
        public void GetById_Test()
        {
            // ARRANGE
            CreateSubtask();
            var subtaskLogic = new SubtaskLogic();

            // ACT
            var subtask = subtaskLogic.GetById(1);

            subtaskLogic.Dispose();

            // ASSERT
            Assert.IsNotNull(subtask);
        }
        /// <summary>
        /// For existing subtasks for existing assignments
        /// </summary>
        /// <param name="subtaskId"></param>
        public AddSubtask(int subtask_id, int assignment_id)
        {
            InitializeComponent();
            var subtaskLogic    = new SubtaskLogic();
            var assignmentLogic = new AssignmentLogic();
            var subtask         = subtaskLogic.GetById(subtask_id);

            this.EditMode        = true;
            this.EditableSubtask = subtask;
            this.cb_PrioritySelect.SelectedItem = GetItemByPriority(subtask.Priority);
            this.tb_SubtaskDescription.Text     = subtask.Description;
            this.tb_SubtaskName.Text            = subtask.Name;
            this.Assignment = assignmentLogic.GetAssignmentById(assignment_id);

            assignmentLogic.Dispose();
            subtaskLogic.Dispose();
        }