public SearchTimesheetViewModel() { FillMonths(); FillYears(); SearchTimesheetCommand = new Command(SearchTimesheet); tsService = new TSService(); }
private async void ConfirmTimesheet() { try { tsService = new TSService(); var confirmTimesheet = await Application.Current.MainPage.DisplayActionSheet("Confirm timesheet?", "Cancel", null, "Yes", "No"); if (worklog.Activity.Project == null || worklog.Activity.Project.Organization == null) { Popup.ShowPopupError("Please fill in all fields"); } else if (confirmTimesheet == "Yes") { worklog.Confirmed = true; if (tsService.UpdateWorklog(worklog, worklog.LoggedMinutes, string.Format("{0:yyyy-MM-dd}", worklog.Day), worklog.Activity.Project.Organization, worklog.Activity.Project, worklog.Activity)) { Popup.ShowPopupSuccess("Worklog confirmed"); } await Application.Current.MainPage.Navigation.PopAsync(); } } catch (Exception ex) { Popup.ShowPopupError(ex.Message); } }
public TSOverviewViewModel(DateTime date, OrganizationResponse organisation) { this.date = date; tsService = new TSService(); this.organisation = organisation; FillWorklogList(); ViewDetailCommand = new Command(ViewDetail); }
public TimesheetViewModel() { tsService = new TSService(); userService = new UserService(); date = DateTime.Today; Hours = DefaultHours(); PostTimesheetCommand = new Command(PostTimesheet); post = true; }
public TimesheetViewModel(WorklogResponse worklog) { tsService = new TSService(); userService = new UserService(); date = worklog.Day; hours = Math.Round(Convert.ToDecimal(worklog.LoggedMinutes) / 60, 2); UpdateTimesheetCommand = new Command(UpdateTimesheet); update = true; if (worklog.Activity.Project != null && worklog.Activity.Project.Organization != null) { selectedOrganization = worklog.Activity.Project.Organization; selectedProject = worklog.Activity.Project; selectedActivity = worklog.Activity; } this.worklog = worklog; }