public void CalculateTotalRecordData() { TotalRecord = new ObservableCollection <TimeSheetTransposed> { new TimeSheetTransposed { Task = new TaskModel { Name = "Total", Id = 0 }, Monday = TimeSheetDataList == null || !TimeSheetDataList.Any()?0: TimeSheetDataList.Sum(e => e.Monday), Tuesday = TimeSheetDataList == null || !TimeSheetDataList.Any()?0: TimeSheetDataList.Sum(e => e.Tuesday), Wednesday = TimeSheetDataList == null || !TimeSheetDataList.Any()?0: TimeSheetDataList.Sum(e => e.Wednesday), Thursday = TimeSheetDataList == null || !TimeSheetDataList.Any()?0: TimeSheetDataList.Sum(e => e.Thursday), Friday = TimeSheetDataList == null || !TimeSheetDataList.Any()? 0:TimeSheetDataList.Sum(e => e.Friday), Saturday = TimeSheetDataList == null || !TimeSheetDataList.Any()? 0:TimeSheetDataList.Sum(e => e.Saturday), Sunday = TimeSheetDataList == null || !TimeSheetDataList.Any()? 0:TimeSheetDataList.Sum(e => e.Sunday), } }; }
private List <TimeSheetRecord> ConvertBackTransposedData() { List <TimeSheetRecord> timeSheetRecords = new List <TimeSheetRecord>(); if (TimeSheetDataList == null || !TimeSheetDataList.Any()) { return(timeSheetRecords); } foreach (var item in TimeSheetDataList) { var task = item.Task; timeSheetRecords.Add(new TimeSheetRecord { EmployeeCode = SelectedEmployee.Code, TaskId = task.Id, TaskHours = item.Sunday, RecordDate = GetDate("Sunday") }); timeSheetRecords.Add(new TimeSheetRecord { EmployeeCode = SelectedEmployee.Code, TaskId = task.Id, TaskHours = item.Monday, RecordDate = GetDate("Monday") }); timeSheetRecords.Add(new TimeSheetRecord { EmployeeCode = SelectedEmployee.Code, TaskId = task.Id, TaskHours = item.Tuesday, RecordDate = GetDate("Tuesday") }); timeSheetRecords.Add(new TimeSheetRecord { EmployeeCode = SelectedEmployee.Code, TaskId = task.Id, TaskHours = item.Wednesday, RecordDate = GetDate("Wednesday") }); timeSheetRecords.Add(new TimeSheetRecord { EmployeeCode = SelectedEmployee.Code, TaskId = task.Id, TaskHours = item.Thursday, RecordDate = GetDate("Thursday") }); timeSheetRecords.Add(new TimeSheetRecord { EmployeeCode = SelectedEmployee.Code, TaskId = task.Id, TaskHours = item.Friday, RecordDate = GetDate("Friday") }); timeSheetRecords.Add(new TimeSheetRecord { EmployeeCode = SelectedEmployee.Code, TaskId = task.Id, TaskHours = item.Saturday, RecordDate = GetDate("Saturday") }); } return(timeSheetRecords); }