public ActionResult StepFour(StepThreeViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("StepOne"));
            }

            var selectedMedicalCenterId = viewModel.SelectedMedicalCenter;
            var selectedDoctorId        = viewModel.SelectedDoctor;

            var allSchedules = db.AppointmentSchedules.ToList();

            var unavailableSchedules = from a in db.Appointments
                                       where a.DoctorId == selectedDoctorId
                                       &&
                                       a.MedicalCenterId == selectedMedicalCenterId
                                       &&
                                       a.Date == DateTime.Today
                                       select a;

            var availableSchedules = db.AppointmentSchedules.Where(s => !unavailableSchedules.Any(p => p.AppointmentScheduleId == s.Id));

            var nextViewModel = new StepFourViewModel
            {
                SelectedMedicalCenter = selectedMedicalCenterId,
                SelectedDoctor        = selectedDoctorId,
                AppointmentSchedules  = availableSchedules
            };

            return(View("StepFour", nextViewModel));
        }
        public ActionResult stepThree()
        {
            if (HttpContext.Session.GetInt32("articleId") != null)
            {
                int id = (int)HttpContext.Session.GetInt32("articleId");

                TempArticle        tempArticle = dbContext.tempArticles.SingleOrDefault(ta => ta.Id == id);
                StepThreeViewModel model       = _mapper.Map <TempArticle, StepThreeViewModel>(tempArticle);
                model.AllFields            = generatingData.populateFields();
                model.AllSubjectCategories = generatingData.populateSubjectCategories();

                model.FieldsIds            = decodeStringToList(tempArticle.FieldsIds);
                model.SubjectCategoriesIds = decodeStringToList(tempArticle.SubjectCategoriesIds);


                return(View(model));
            }

            StepThreeViewModel stepThree = new StepThreeViewModel()
            {
                AllFields            = generatingData.populateFields(),
                AllSubjectCategories = generatingData.populateSubjectCategories()
            };

            return(View(stepThree));
        }
        public ActionResult StepThree(StepTwoViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("StepOne"));
            }

            var selectedSpecialtyId     = viewModel.SelectedSpecialty;
            var selectedMedicalCenterId = viewModel.SelectedMedicalCenter;

            var possibleAssignments = from a in db.DoctorAssignments
                                      where a.MedicalCenterId == selectedMedicalCenterId
                                      select a.DoctorId;

            var possibleSpecialDoctors = from d in db.Doctors
                                         where d.SpecialtyId == selectedSpecialtyId
                                         select d;

            var availableDoctors = possibleSpecialDoctors.Where(x => possibleAssignments.Contains(x.Id)).ToList();

            var nextViewModel = new StepThreeViewModel
            {
                SelectedMedicalCenter = selectedMedicalCenterId,
                Doctors = availableDoctors
            };

            return(View("StepThree", nextViewModel));
        }
Exemplo n.º 4
0
        private void AddTripButton_Click(object sender, RoutedEventArgs e)
        {
            bool AddOk = StepThreeViewModel.isAddOk();

            if (AddOk)
            {
                HomeScreen.RestoreNavigationItem();
                HomeScreen.GetHomeScreenInstance().setVisibilityAddButton(Visibility.Visible);
            }
        }
Exemplo n.º 5
0
        public void ShouldMainContainerBeVerticalWhenDeviceOrientationIsInPortraitMode()
        {
            //arrange
            viewModel = new StepThreeViewModel();

            //act
            DeviceManager.Orientation = Devices.Portrait.ToString();

            //assert
            viewModel.MainContainerOrientation.ShouldBe(StackOrientation.Vertical);
        }
Exemplo n.º 6
0
        public void ShouldMainContainerBeHorizontalWhenDeviceOrientationIsInLandscapeMode()
        {
            //arrange
            viewModel = new StepThreeViewModel();

            //act
            DeviceManager.Orientation = Devices.Landscape.ToString();

            //assert
            viewModel.MainContainerOrientation.ShouldBe(StackOrientation.Horizontal);
        }
Exemplo n.º 7
0
        public void ShouldRefreshOrientationChangeTheOrientationOfTheMainContainer()
        {
            //arrange
            viewModel = new StepThreeViewModel();

            //act
            DeviceManager.Orientation = Devices.Portrait.ToString();

            //assert
            viewModel.MainContainerOrientation.ShouldBe(StackOrientation.Vertical);
            DeviceManager.Orientation = Devices.Landscape.ToString();
            viewModel.RefreshOrientation();
            viewModel.MainContainerOrientation.ShouldBe(StackOrientation.Horizontal);
        }
        public ActionResult stepThree(StepThreeViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.AllFields            = generatingData.populateFields();
                model.AllSubjectCategories = generatingData.populateSubjectCategories();
                return(View(model));
            }

            string AllFieldsIds            = "";
            string AllSubjectCategoriesIds = "";

            foreach (var field in model.FieldsIds)
            {
                AllFieldsIds += field + "-;";
            }

            foreach (var category in model.SubjectCategoriesIds)
            {
                AllSubjectCategoriesIds += category + "-;";
            }

            if (HttpContext.Session.GetInt32("articleId") != null)
            {
                int id = (int)HttpContext.Session.GetInt32("articleId");

                TempArticle article = dbContext.tempArticles.SingleOrDefault(ta => ta.Id == id);
                article.FieldsIds            = AllFieldsIds;
                article.SubjectCategoriesIds = AllSubjectCategoriesIds;

                dbContext.SaveChanges();
            }
            else
            {
                TempArticle article = new TempArticle()
                {
                    FieldsIds            = AllFieldsIds,
                    SubjectCategoriesIds = AllSubjectCategoriesIds,
                };
                dbContext.tempArticles.Add(article);
                dbContext.SaveChanges();
                HttpContext.Session.SetInt32("articleId", article.Id);
            }
            return(RedirectToAction("stepFour"));
        }
Exemplo n.º 9
0
        public void ShouldExecuteDoneTutorialCommandCompleteTheTutorial()
        {
            //arrange
            viewModel = new StepThreeViewModel();
            viewModel.NavigationService.SetRootPage(nameof(StepOnePage), new StepOneViewModel());
            viewModel.NavigationService.NavigateAsync(nameof(StepTwoPage), null, false);
            viewModel.NavigationService.NavigateAsync(nameof(StepThreePage), null, false);
            Page targetPage  = new DashboardPage();
            Page currentPage = viewModel.NavigationService.CurrentPage;

            //act
            Task.Run(async() =>
            {
                await viewModel.ExecuteDoneTutorialCommandAsync();
            }).GetAwaiter().GetResult();
            currentPage = viewModel.NavigationService.CurrentMasterDetailPage;

            //assert
            NUnit.Framework.Assert.AreEqual(currentPage.Title, targetPage.Title);
        }
Exemplo n.º 10
0
        public StepThreePage(string calledfrom)
        {
            InitializeComponent();
            CalledFrom                 = calledfrom;
            BindingContext             = ViewModels = new StepThreeViewModel(CalledFrom);
            ViewModels.NoRegisterCall += () => ShowResult();

            ViewModels.VerifyProfile += async() => await GoToLoginAsync();

            switch (CalledFrom)
            {
            case "ForUserPic":
                coments       = Translator.getText("UserPhoto");
                CamTitle.Text = Translator.getText("UserPhoto");
                break;

            case "ForIdPics":
                coments       = Translator.getText("IdPhoto");
                CamTitle.Text = Translator.getText("TextIdents");
                break;

            case "ForProductPic":
                coments       = Translator.getText("ProductPhoto");
                CamTitle.Text = Translator.getText("ProductPhoto");
                break;

            case "ForIdTrav":
                coments       = Translator.getText("IdPhoto");
                CamTitle.Text = Translator.getText("IdPhoto");
                break;
            }

            TakePicture.Clicked += async(sender, args) =>
            {
                await CrossMedia.Current.Initialize();

                if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
                {
                    await DisplayAlert("No Camera", ":( No camera available.", "OK");

                    return;
                }

                var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
                {
                    Directory          = "Sample",
                    Name               = "test.jpg",
                    PhotoSize          = Plugin.Media.Abstractions.PhotoSize.Small,
                    CompressionQuality = 90,
                    AllowCropping      = true
                });

                if (file == null)
                {
                    return;
                }

                using (UserDialogs.Instance.Loading(Translator.getText("Loading"), null, null, true, MaskType.Black))
                {
                    idInfo = new IdInfo
                    {
                        comments = coments,
                        Image    = ImageSource.FromStream(() =>
                        {
                            var stream = file.GetStream();
                            return(stream);
                        }),
                        ImageByte = ImageManager.ConvertToBytes(file.Path),
                    };
                }

                createImage(file.Path, idInfo);
            };

            SelectPicture.Clicked += async(sender, args) =>
            {
                await CrossMedia.Current.Initialize();

                if (!CrossMedia.Current.IsPickPhotoSupported)
                {
                    await DisplayAlert("No Camera", ":( No camera available.", "OK");

                    return;
                }

                var file = await CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
                {
                    PhotoSize          = Plugin.Media.Abstractions.PhotoSize.Medium,
                    CompressionQuality = 90,
                });

                if (file == null)
                {
                    return;
                }

                //await DisplayAlert("File Location", file.Path, "OK");


                using (UserDialogs.Instance.Loading(Translator.getText("Loading"), null, null, true, MaskType.Black))
                {
                    idInfo = new IdInfo
                    {
                        comments = coments,
                        Image    = ImageSource.FromStream(() =>
                        {
                            var stream = file.GetStream();
                            return(stream);
                        }),
                        ImageByte = ImageManager.ConvertToBytes(file.Path),
                    };
                }

                createImage(file.Path, idInfo);
            };


            lb_BackFunc();
            void lb_BackFunc()
            {
                try
                {
                    Back.GestureRecognizers.Add(new TapGestureRecognizer()
                    {
                        Command = new Command(async() =>
                        {
                            Navigation.PopModalAsync();
                        }
                                              )
                    });
                }
                catch (Exception ex) { Debug.WriteLine(ex); }
            }
        }
Exemplo n.º 11
0
        public ImagePage(string calledfrom)
        {
            InitializeComponent();
            CalledFrom                 = calledfrom;
            BindingContext             = ViewModels = new StepThreeViewModel(CalledFrom);
            ViewModels.NoRegisterCall += () => showResult();



            switch (CalledFrom)
            {
            case "ForUserPic":
                coments       = Translator.getText("UserPhoto");
                CamTitle.Text = Translator.getText("UserPhoto");
                break;

            case "ForIdPics":
                coments       = Translator.getText("IdPhoto");
                CamTitle.Text = Translator.getText("TextIdents");
                break;

            case "ForProductPic":
                coments       = Translator.getText("ProductPhoto");
                CamTitle.Text = Translator.getText("ProductPhoto");
                break;

            case "ForIdTrav":
                coments       = Translator.getText("IdPhoto");
                CamTitle.Text = Translator.getText("IdPhoto");
                break;
            }

            TakePicture.Clicked += async(sender, args) =>
            {
                await TakePicturemethod();
            };

            SelectPicture.Clicked += async(sender, args) =>
            {
                await SelectPicturemethod();
            };



            lb_BackFunc();
            void lb_BackFunc()
            {
                try
                {
                    Back.GestureRecognizers.Add(new TapGestureRecognizer()
                    {
                        Command = new Command(async() =>
                        {
                            await Navigation.PopModalAsync();
                        }
                                              )
                    });
                }
                catch (Exception ex) { Debug.WriteLine(ex); }
            }

            MessagingCenter.Subscribe <StepThreeViewModel, string>(this, "prodpicfinished", (obj, item) => {
                Navigation.PopModalAsync();
            });
        }