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)); }
private void OnPreviousDateCommandHandler() { SelectedDate = SelectedDate.AddDays(-1); RecordedList.Clear(); RecordedList = ConvertRecords(_timeTrackerRepository.GetEmployeeTimeRecords(_employee.ID, SelectedDate)); }
private void OnTodayCommandHandler() { SelectedDate = DateTime.Today; RecordedList.Clear(); RecordedList = ConvertRecords(_timeTrackerRepository.GetEmployeeTimeRecords(_employee.ID, SelectedDate)); }