コード例 #1
0
        private async Task <ApiResponse> InvokeSaveGroomingAppointment()
        {
            var groomingApptDoc = new PetServiceScheduleDocument();
            var response        = new ApiResponse();

            try
            {
                groomingApptDoc.companyRenderingService = CompanyInformation.GetDefault().CompanyName;
                groomingApptDoc.petOwnerName            = SelectedPetForGrooming.PetOwnerName;
                groomingApptDoc.createdAt                  = DateTime.Now;
                groomingApptDoc.updatedAt                  = DateTime.Now;
                groomingApptDoc.petId                      = SelectedPetForGrooming.Id;
                groomingApptDoc.petOwnerId                 = SelectedPetForGrooming.PetOwnerId;
                groomingApptDoc.servicesRendered           = new PetServiceRendered();
                groomingApptDoc.servicesRendered.groomings = new List <PetGroomingItem> ();
                groomingApptDoc.petName                    = SelectedPetForGrooming.PetDetails.ProfileDocument.name;
                groomingApptDoc.ownerContactEmail          = OwnerContactEmail;
                var groomingItem = new PetGroomingItem()
                {
                    agreementInitials    = App.MobileSession.UserName,
                    cancelled            = false,
                    priorGrooming        = true,
                    notes                = Notes,
                    charge               = 0.00M,
                    groomingScheduleItem = new GroomingScheduleItem()
                    {
                        date = DateTime.Parse(GroomingDate, CultureInfo.CurrentCulture),
                        time = DateTime.ParseExact(GroomingTime, "h:mm tt", CultureInfo.CurrentCulture).TimeOfDay
                    }
                };

                groomingApptDoc.servicesRendered.groomings.Add(groomingItem);
            } catch (Exception ex)
            {
                                #if DEBUG
                Debug.WriteLine(ex.Message);
                                #endif
                response.IsSuccessStatusCode = false;
                return(response);
            }

            response = await Api.PostAsync("petservices/schedule/grooming", groomingApptDoc);

            return(response);
        }
コード例 #2
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            this.viewModel = this.BindingContext as PetServicesViewModel;
            IProgressDialog l = App.GetLoadingDialog(AppSettings.Constants.LoaderText);

            l.Show();
            try
            {
                await viewModel.LoadContents();

                l.Hide();
            } catch (Exception)
            {
                l.Hide();
                await DisplayAlert(AppSettings.Constants.DisplayGeneralErrorDlgTitle, AppSettings.Constants.DisplayGeneralErrorDlgMessage, "OK");
            }

            company = CompanyInformation.GetDefault();
            this.PetServicesList.ItemsSource = viewModel.PetServices;
        }