public List <TaskItemViewmodel> ExtractEmptyItemTaskitems(List <TimeEntry> localtimeEntriesForThisWeek, DateTime startDate) { var rows = new List <TaskItemViewmodel>(); foreach (var task in localtimeEntriesForThisWeek.Select(x => x.Task).Distinct()) { var timeEntryType = _timeEntryTypeRepository.GetByCompany(task.Project.Company) .FirstOrDefault(tt => tt.IsDefault); var isBillable = false; if (timeEntryType != null) { isBillable = timeEntryType.IsBillableByDefault; } rows.Add(new TaskItemViewmodel(task, new List <TimeEntry>(), startDate, isBillable)); } return(rows); }
private void LoadTimeEntryTypes() { List <TimeEntryType> timeEntryTypes; if (_timeEntry.Task == null) { TimeEntryTypes = null; timeEntryTypes = _timeEntryTypeRepository.GetGlobal(); } else { var selectedCompany = _timeEntry.Task.Project.Company; timeEntryTypes = _timeEntryTypeRepository.GetByCompany(selectedCompany); } TimeEntryTypes = new ObservableCollection <TimeEntryType>(timeEntryTypes); SetSelectedTimeEntryType(); }