Esempio n. 1
0
        public string GetReservationStatus(ReservationStatus status)
        {
            switch (status)
            {
            case ReservationStatus.Ok:
                return(T.GetValue("reservation_ok_short"));

            case ReservationStatus.Pending:
                return(T.GetValue("reservation_pending_short"));

            case ReservationStatus.CancelPlace:
                return(T.GetValue("reservation_cancel_place_short"));

            case ReservationStatus.CancelUser:
                return(T.GetValue("reservation_cancel_user_short"));

            case ReservationStatus.Running:
                return(T.GetValue("reservation_running_short"));

            case ReservationStatus.Close:
                return(T.GetValue("reservation_close_short"));
            }

            return(T.GetValue("cancel"));
        }
Esempio n. 2
0
        async Task <bool> RegisterValidations()
        {
            if (!FunctionsService.ValidateEmail(Mail))
            {
                await _page.DisplayAlert(T.GetValue("app_name"), T.GetValue("mail_error"), T.GetValue("ok"));

                return(false);
            }

            if (!FunctionsService.ValidatePhone(Phone))
            {
                await _page.DisplayAlert(T.GetValue("app_name"), T.GetValue("phone_error"), T.GetValue("ok"));

                return(false);
            }

            if (Password != RePassword)
            {
                await _page.DisplayAlert(T.GetValue("app_name"), T.GetValue("password_differents_message"), T.GetValue("ok"));

                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        public ReservationSummaryViewModel(Page page, ReservationModel reservation) : base(page)
        {
            _reservation = reservation;
            if (reservation.Status == ReservationStatus.Pending || reservation.Status == ReservationStatus.Ok)
            {
                CancelReservationButtonStatus = true;
            }
            else
            {
                CancelReservationButtonStatus = false;
            }

            CancelReservationCommand = new Command(async() =>
            {
                bool result = await _page.DisplayAlert(T.GetValue("app_name"), T.GetValue("reservation_cancel"), T.GetValue("ok"), T.GetValue("cancel"));
                if (result)
                {
                    CancelReservationButtonStatus = false;
                    IsBusy = true;

                    try
                    {
                        bool response = await RestService.Instance.CancelReservationAsync(reservation.IdReservation);

                        if (response)
                        {
                            ReservationService.HasChanges = true;
                            await DisplayAlertAsync(MessagesTexts.reservation_cancel_ok);
                        }
                        else
                        {
                            await DisplayAlertAsync(MessagesTexts.error_message);
                            CancelReservationButtonStatus = true;
                        }
                    }
                    catch
                    {
                        await DisplayAlertAsync(MessagesTexts.error_message);
                        CancelReservationButtonStatus = true;
                    }

                    IsBusy = false;
                }
            });
        }
Esempio n. 4
0
        public PlaceViewModel(Page page, PlaceModel place) : base(page)
        {
            Place      = place;
            _hourOfDay = place.GetHourOfDay();

            FindCommand      = new Command(async() => { await OpenPageAsync(new FindCourtView()); });
            OpenMapCommand   = new Command(async() => { await OpenPageAsync(new MapView(_place)); });
            ShowTimesCommand = new Command(async() =>
            {
                string[] times = new string[place.Hours.Count];
                int count      = 0;
                foreach (HourModel hour in place.Hours)
                {
                    int numberDay = hour.NumberDay;
                    if (numberDay == 7)
                    {
                        numberDay = 0;
                    }

                    string day = null;
                    if (numberDay == 8)
                    {
                        day = T.GetValue("holydays");
                    }
                    else
                    {
                        day = place.GetDayName(numberDay, DependencyService.Get <ILocalize>().GetCurrentCultureInfo());
                    }

                    times[count] = string.Format("{0}: {1:hh:mm tt} - {2:hh:mm tt}", day, hour.HourStart, hour.HourEnd);
                    count++;
                }

                await _page.DisplayActionSheet("", T.GetValue("close"), null, times);
            });
        }
Esempio n. 5
0
        public App()
        {
            try
            {
                InitializeComponent();

                if (Device.OS != TargetPlatform.Windows)
                {
                    DependencyService.Get <ILocalize>().SetLocale();
                }

                Page page = null;
                if (IsLogin)
                {
                    page = new HomeView();
                }
                else
                {
                    page = new LoadingView();
                }

                // The root page of your application
                MainPage = new NavigationPage(page)
                {
                    BarBackgroundColor = GetBackgroundColor()
                };
                if (!IsLogin)
                {
                    ValidateLoginAsync();
                }
            }
            catch
            {
                MainPage.DisplayAlert(T.GetValue("app_name"), T.GetValue("error_message"), T.GetValue("ok"));
            }
        }
Esempio n. 6
0
 public async Task DisplayAlertAsync(MessagesTexts messageKey)
 {
     await _page.DisplayAlert(T.GetValue("app_name"), T.GetValue(messageKey.ToString()), T.GetValue("ok"));
 }