Ejemplo n.º 1
0
        private async void AddLot()
        {
            if (string.IsNullOrEmpty(LotName) || string.IsNullOrEmpty(Row) || string.IsNullOrEmpty(Col.ToString()))
            {
                await App.Current.MainPage.DisplayAlert("Empty Values", "Please enter Email and Password", "OK");
            }
            else
            {
                var lot = await FBParkingHelper.AddLot(LotName, Row, Col);

                if (lot)
                {
                    await App.Current.MainPage.DisplayAlert("Lot Added Successfully", "", "Ok");

                    await App.Current.MainPage.Navigation.PushAsync(new CreateParkingLot(email));
                }
            }
        }
Ejemplo n.º 2
0
        public static async Task <bool> RefreshReservations(DateTime refresh)
        {
            try
            {
                List <Reservation> r = new List <Reservation>();
                r = Task.Run(() => GetExpiredReservation(refresh)).Result;
                for (int i = 0; i < r.Count; i++)
                {
                    await DeleteRes(r[i].LotName, r[i].Row, r[i].Col);

                    await FBParkingHelper.UpdateLotFree(r[i].LotName, r[i].Row, r[i].Col);
                }
                return(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error{e}");
                return(false);
            }
        }
Ejemplo n.º 3
0
        private async void ConfirmReservation()
        {
            starttime  = DateTime.Now;
            TimeLength = TimeLength * 60;
            endtime    = starttime.AddMinutes((double)TimeLength);
            var reservation = await FBReservationHelper.AddReservation(lotname, row, col, email, TimeLength, starttime, endtime);

            var reserved = await FBParkingHelper.UpdateLotTaken(lotname, row, col);

            if (reservation && reserved)
            {
                await ReservationHistoryHelper.AddReservationToHistory(email, lotname, row, col, starttime, endtime);

                await App.Current.MainPage.DisplayAlert("Reservation Confirmed", "", "Ok");

                await App.Current.MainPage.Navigation.PushAsync(new ParkingReservationHistory(email));
            }
            else
            {
                await App.Current.MainPage.DisplayAlert("Reservation UNSUCCESFUL", "", "Ok");
            }
        }