コード例 #1
0
        private PetProfileViewModel ExtractExistingPetProfileInformation(PetListItem item, out bool extractedOk)
        {
            extractedOk = false;
            var pv = new PetProfileViewModel();

            pv.PetDetails = new PetProfile()
            {
                ProfileDocument         = new Profile(),
                GroomingProfileDocument = new GroomingProfile()
            };

            extractedOk = ObjectExtensions.TryPopuateObject(item.profileJsonString, pv.PetDetails.ProfileDocument);
            if (extractedOk)
            {
                pv.Id           = item.id;
                pv.PetOwnerName = item.petOwnerName != null &&
                                  item.petOwnerName.Equals(App.MobileSession.AccountName) ? item.petOwnerName :
                                  App.MobileSession.AccountName;
                pv.PetOwnerId = item.petOwnerId;
                if (!item.groomingProfileJsonString.IsNullEmptyOrWhiteSpace())
                {
                    pv.PetDetails.GroomingProfileDocument.otherConditions.Clear();
                    ObjectExtensions.TryPopuateObject(item.groomingProfileJsonString, pv.PetDetails.GroomingProfileDocument);
                }
                pv.IsNew = false;
            }

            return(pv);
        }
コード例 #2
0
 private async Task ShowProfileScreen(PetProfileViewModel item, bool dataExtractedOk)
 {
     if (dataExtractedOk)
     {
         var page = ViewFactory.CreatePage <PetProfileViewModel, PetProfilePage> ((v, p) =>
         {
             if (item != null)
             {
                 v.IsNew        = false;
                 v.PetOwnerName = item.PetOwnerName;
                 v.PetOwnerId   = App.MobileSession.Id;
                 v.Id           = item.Id;
                 v.PetDetails   = item.PetDetails;
             }
             else
             {
                 v.IsNew      = true;
                 v.PetDetails = new PetProfile()
                 {
                     ProfileDocument         = new Profile(),
                     GroomingProfileDocument = new GroomingProfile()
                 };
                 v.Id           = "";
                 v.PetOwnerName = App.MobileSession.AccountName;
                 v.PetOwnerId   = App.MobileSession.Id;
             }
         }) as PetProfilePage;
         await Navigation.PushAsync(page, true);
     }
     else
     {
         await DisplayAlert(AppSettings.Constants.DisplayGeneralErrorDlgTitle, AppSettings.Constants.DisplayGeneralErrorDlgMessage, "OK");
     }
 }
コード例 #3
0
        private bool OnPetSelected(PetProfileViewModel selectedPet)
        {
            Navigation.PopModalAsync(true);
            var page = ViewFactory.CreatePage <PetGroomingConfirmationViewModel, PetGroomingConfirmationPage> ((v, p) =>
            {
                v.PetName                = selectedPet.PetDetails.ProfileDocument.name;
                v.GroomingDateTime       = viewModel.SelectedGroomingDate + " @ " + selectedGroomingListItem.GroomingTimeSlotText;
                v.SelectedPetForGrooming = selectedPet;
                v.GroomingDate           = viewModel.SelectedGroomingDate;
                v.GroomingTime           = selectedGroomingListItem.GroomingTimeSlotText;
            });

            Navigation.PushModalAsync(page as PetGroomingConfirmationPage);
            return(false);
        }