private async Task <DataServiceResponse <ConfirmationResponse> > ConfirmAppointmentAsync()
        {
            ScheduleDataSource  ds      = new ScheduleDataSource();
            Appointment         a       = ApplicationData.Current.NewAppointment;
            ConfirmationRequest request = new ConfirmationRequest()
            {
                AppointmentType       = a.AppointmentType.Value,
                AppointmentReason     = a.AppointmentSubType.Value,
                AppointmentSource     = Appointment.MOBILE_APP_SOURCE,
                AdvisorEmailAddress   = a.AdvisorEmail,
                AppointmentLanguage   = a.AppointmentLanguage,
                BranchNumber          = a.BranchNumber,
                ClientNumber          = ApplicationData.Current.Client.CustomerNumber,
                SendEmailConfirmation = true,
                StartTimeUtc          = a.StartDate.ToUniversalTime().ToString("o"),
                EndTimeUtc            = a.EndDate.ToUniversalTime().ToString("o"),
                IncludeIcsFile        = true,
                UiLanguageCode        = 1033,
                PreferredDateUtc      = a.StartDate.Date,
                AdvisorComments       = string.Empty,
                ClientComments        = string.Empty
            };
            DataServiceResponse <ConfirmationResponse> response = await ds.ConfirmAppointmentAsync(request);

            return(response);
        }
Esempio n. 2
0
        private async void UpdateSchedule(object sender, RoutedEventArgs e)
        {
            await ScheduleDataSource.RefreshAsync();

            if (!Frame.Navigate(typeof(PivotPage), e))
            {
                throw new Exception(this.resourceLoader.GetString("NavigationFailedExceptionMessage"));
            }
        }
        /// <summary>
        /// Invoked when an item within a section is clicked.
        /// </summary>
        private void scheduleByHourItem_Click(object sender, ItemClickEventArgs e)
        {
            var hour     = ((IndexValue)e.ClickedItem);
            var schedule = ScheduleDataSource.GetScheduleOfHourAsync(hour.Key, hour.Value);

            if (!Frame.Navigate(typeof(SchedulePage), schedule))
            {
                throw new Exception(this.resourceLoader.GetString("NavigationFailedExceptionMessage"));
            }
        }
Esempio n. 4
0
        private async Task <DataServiceResponse <CheckInResponse> > CheckInAsync()
        {
            ScheduleDataSource ds = new ScheduleDataSource();
            DataServiceResponse <CheckInResponse> response = await ds.CheckInAsync(Appointment.ConfirmationNumber);

            if (response.Success)
            {
                //refresh the appointments
                await ApplicationData.Current.RefreshAppointmentsAsync();
            }
            return(response);
        }
Esempio n. 5
0
        private async Task <DataServiceResponse <CancelAppointmentResponse> > CancelAppointmentAsync()
        {
            CancelAppointmentRequest request = new CancelAppointmentRequest()
            {
                ConfirmationNumber = Appointment.ConfirmationNumber,
                UiLanguageCode     = 1033,
                IsRequestFromCrm   = false
            };
            ScheduleDataSource ds = new ScheduleDataSource();
            DataServiceResponse <CancelAppointmentResponse> response = await ds.CancelAppointmentAsync(request);

            if (response.Success)
            {
                //refresh the appointments
                await ApplicationData.Current.RefreshAppointmentsAsync();
            }
            return(response);
        }
Esempio n. 6
0
        private async void ThirdPivot_Loaded(object sender, RoutedEventArgs e)
        {
            var sampleDataGroup = await ScheduleDataSource.GetScheduleAsync(ThirdGroupName);

            this.DefaultViewModel[ThirdGroupName] = sampleDataGroup;
        }
Esempio n. 7
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var sampleDataGroup = await ScheduleDataSource.GetScheduleAsync(FirstGroupName);

            this.DefaultViewModel[FirstGroupName] = sampleDataGroup;
        }
Esempio n. 8
0
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var slot = await ScheduleDataSource.GetSlotAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Slot"] = slot;
        }
Esempio n. 9
0
        /// <summary>
        /// Loads the content for the third pivot item when it is scrolled into view.
        /// </summary>
        private async void ThirdPivot_Loaded(object sender, RoutedEventArgs e)
        {
            var index = await ScheduleDataSource.GetRoomsIndex("friday");

            this.DefaultViewModel[ThirdGroupName] = index;
        }
Esempio n. 10
0
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session. The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var index = await ScheduleDataSource.GetRoomsIndex("wednesday");

            this.DefaultViewModel[FirstGroupName] = index;
        }
Esempio n. 11
0
        private async Task LoadScheduleAsync()
        {
            if (Schedule == null)
            {
                DataSource = new ScheduleDataSource();
                Appointment a = ApplicationData.Current.NewAppointment;
                DataServiceResponse <ScheduleResults> response = await DataSource.GetAvailableTimes(StartDate,
                                                                                                    EndDate, a.BranchNumber,
                                                                                                    a.AppointmentType.Value,
                                                                                                    a.AppointmentSubType.Value,
                                                                                                    a.AppointmentLanguage);

                if (response.Success)
                {
                    if (string.IsNullOrEmpty(response.Data.ErrorMessage))
                    {
                        Schedule = response.Data;
                        foreach (ScheduleResult r in Schedule.ScheduleDays)
                        {
                            if (r.ScheduleDate.Date.Equals(SelectedDay.Date))
                            {
                                ReloadTable(new TimeSlotSource(r.TimeSlots));
                                break;
                            }
                        }
                        InvokeOnMainThread(() =>
                        {
                            ProgressRing.StopAnimating();
                        });
                    }
                    else
                    {
                        //scheduling system error
                        InvokeOnMainThread(() =>
                        {
                            ProgressRing.StopAnimating();
                            var alert = UIAlertController.Create("Schedule Engine Error", $"{response.Data.ErrorMessage}", UIAlertControllerStyle.Alert);
                            alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                            PresentViewController(alert, true, null);
                        });
                    }
                }
                else
                {
                    //error
                    InvokeOnMainThread(() =>
                    {
                        ProgressRing.StopAnimating();
                        var alert = UIAlertController.Create("Error", $"Load Error: {response.ErrorMessage}", UIAlertControllerStyle.Alert);
                        alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                        PresentViewController(alert, true, null);
                    });
                }
            }
            else
            {
                foreach (ScheduleResult r in Schedule.ScheduleDays)
                {
                    if (r.ScheduleDate.Date.Equals(SelectedDay.Date))
                    {
                        ReloadTable(new TimeSlotSource(r.TimeSlots));
                        break;
                    }
                }
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Loads the content for the second pivot item when it is scrolled into view.
        /// </summary>
        private async void SecondPivot_Loaded(object sender, RoutedEventArgs e)
        {
            var index = await ScheduleDataSource.GetHoursIndex("thursday");

            this.DefaultViewModel[SecondGroupName] = index;
        }