protected async void ManageImputedDay(ReviewTimeLine from) { if (this.IsInternetAndCloseModal()) { try { var selectedDateTimesheet = TimeLineList.FirstOrDefault(x => x.Day == from.Day); if (selectedDateTimesheet.Day != null) { var navigationParameters = new NavigationParameters(); var timesheetForDay = new TimesheetForDay() { Day = selectedDateTimesheet.Day, Activities = selectedDateTimesheet.Activities, Projects = _currentReview?.Projects?.Values?.ToList() }; navigationParameters.Add(TimesheetForDay.Tag, timesheetForDay); navigationParameters.Add("IsVisibleButtonAdd", false); await BaseModule.NavigationService.NavigateAsync(PageRoutes.GetKey <ManageImputedDayPage>(), navigationParameters); } else { throw new ArgumentNullException(); } } catch (Exception) { BaseModule.DialogService.ShowToast("Fail load Detail. Try Again."); } } }
public TimesheetForDay GetTimesheetByDate(Timesheet currentTimesheet, DateTime dateTime) { var timesheetForDay = new TimesheetForDay(); timesheetForDay.Day = currentTimesheet.Days.FirstOrDefault(x => x.Date.Equals(dateTime)); timesheetForDay.Projects = currentTimesheet.Projects.Values.ToList(); timesheetForDay.Activities = TimesheetForDay.Map(currentTimesheet, dateTime).OrderBy(x => x.Id).ToList(); return(timesheetForDay); }
private void UpdateDayOfTimesheet(TimesheetForDay timesheet) { _currentTimesheetForDay = timesheet; Device.BeginInvokeOnMainThread(() => { Activities = new ObservableCollection <ActivityDay>(timesheet.Activities); ImputedTotal = Activities.Sum(x => x.Imputed); DeviationTotal = Activities.Sum(x => x.Deviation); IsEnabled = !_currentTimesheetForDay.Day.IsClosed; }); }