コード例 #1
0
 public SearchTimesheetViewModel()
 {
     FillMonths();
     FillYears();
     SearchTimesheetCommand = new Command(SearchTimesheet);
     tsService = new TSService();
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 public TSOverviewViewModel(DateTime date, OrganizationResponse organisation)
 {
     this.date         = date;
     tsService         = new TSService();
     this.organisation = organisation;
     FillWorklogList();
     ViewDetailCommand = new Command(ViewDetail);
 }
コード例 #4
0
 public TimesheetViewModel()
 {
     tsService            = new TSService();
     userService          = new UserService();
     date                 = DateTime.Today;
     Hours                = DefaultHours();
     PostTimesheetCommand = new Command(PostTimesheet);
     post                 = true;
 }
コード例 #5
0
 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;
 }