Esempio n. 1
0
        private void OnSubmitTaskTimeCommandHandler()
        {
            EmployeeTimeRecord employeeTimeRecord = new EmployeeTimeRecord();

            employeeTimeRecord.Date       = SelectedDate;
            employeeTimeRecord.Comments   = Comments;
            employeeTimeRecord.EmployeeID = _employee.ID;
            employeeTimeRecord.Task       = TaskName;

            var projectTasks = _timeTrackerRepository.GetProjectTasks(_employee.Project.ID);

            bool containsSelectedTask = false;

            foreach (var item in projectTasks)
            {
                if (item.Name.Equals(TaskName))
                {
                    containsSelectedTask = true;
                    break;
                }
            }
            if (!containsSelectedTask)
            {
                ProjectTask projectTask = new ProjectTask();
                projectTask.Name    = TaskName;
                projectTask.Project = _timeTrackerRepository.GetProject(_employee.Project.ID);
                _timeTrackerRepository.PostProjectTasks(projectTask);
            }

            int startTimeValueMinutes = 0;

            if (int.TryParse(StartTimeValue, out startTimeValueMinutes))
            {
                employeeTimeRecord.StartTimeMinutes = startTimeValueMinutes;
            }

            int endTimeValueMinutes = 0;

            if (int.TryParse(EndTimeValue, out endTimeValueMinutes))
            {
                employeeTimeRecord.EndTimeMinutes = endTimeValueMinutes;
            }

            _timeTrackerRepository.PostEmployeeTimeRecord(employeeTimeRecord);

            RecordedList.Clear();
            TaskList.Clear();
            RecordedList = ConvertRecords(_timeTrackerRepository.GetEmployeeTimeRecords(_employee.ID, SelectedDate));
            TaskList     = new ObservableCollection <string>(_timeTrackerRepository.GetProjectTasks(_employee.Project.ID).Select(pt => pt.Name));
        }
Esempio n. 2
0
 private void OnPreviousDateCommandHandler()
 {
     SelectedDate = SelectedDate.AddDays(-1);
     RecordedList.Clear();
     RecordedList = ConvertRecords(_timeTrackerRepository.GetEmployeeTimeRecords(_employee.ID, SelectedDate));
 }
Esempio n. 3
0
 private void OnTodayCommandHandler()
 {
     SelectedDate = DateTime.Today;
     RecordedList.Clear();
     RecordedList = ConvertRecords(_timeTrackerRepository.GetEmployeeTimeRecords(_employee.ID, SelectedDate));
 }