Esempio n. 1
0
        private async void Book_Clicked(object sender, EventArgs e)
        {
            // Get Data
            BookTicketModel bookTicket = new BookTicketModel();

            bookTicket.Key    = "00";
            bookTicket.Ticket = ticketModel;

            bookTicket.Type = type.SelectedItem.ToString();
            bookTicket.Date = date.Date.ToString();

            long total = ticketModel.Price * long.Parse(quantity.SelectedItem.ToString());

            bookTicket.Amount   = total.ToString();
            bookTicket.Status   = "Pending";
            bookTicket.Quantity = quantity.SelectedItem.ToString();

            string uid = await _firebaseAuth.GetCurrentUser();

            bookTicket.UserUID = uid;


            _firebaseDatabase.SetBooking("ticketbookings", bookTicket);

            await DisplayAlert("Booking", "Your ticket is booked", "OK");

            await Navigation.PopAsync();
        }
Esempio n. 2
0
        private async void Savebtn_Clicked(object sender, EventArgs e)
        {
            string auth = await _firebaseAuth.GetCurrentUser();

            if (auth != null)
            {
                string name = username.Text.Trim();

                _firebaseDatabase.UpdateUserName(auth, name);
            }

            username.IsEnabled  = false;
            userimage.IsEnabled = false;
            editbtn.IsVisible   = true;
            savebtn.IsVisible   = false;
        }
Esempio n. 3
0
        private async void Submit_Clicked(object sender, EventArgs e)
        {
            FeedbackModel feedback = new FeedbackModel();
            var           uid      = await _firebaseAuth.GetCurrentUser();

            // Get input
            feedback.Key     = "00";
            feedback.Subject = subject.SelectedItem.ToString();
            feedback.Body    = body.Text;
            feedback.Date    = DateTime.Today.Date.ToString();
            feedback.Status  = false;
            feedback.UserUID = uid;

            _firebaseDatabase.SubmitFeedback(feedback);

            await Navigation.PopAsync();
        }
Esempio n. 4
0
        private async void HailTaxi(DriverModel driver)
        {
            state = "H";
            string uid = await _firebaseAuth.GetCurrentUser();

            Action <Dictionary <string, UserModel> > onValueEvent = null;

            onValueEvent = (Dictionary <string, UserModel> user) =>
            {
                try
                {
                    System.Diagnostics.Debug.WriteLine("---> EVENT GetDataFromFirebase ");

                    Action onSetValueSuccess = () =>
                    {
                    };

                    Action <string> onSetValueError = (string errorDesc) =>
                    {
                    };

                    if (user != null)
                    {
                        foreach (KeyValuePair <string, UserModel> item in user)
                        {
                            if (item.Value.Key == uid)
                            {
                                HailWithUserInfo(item.Value, driver);
                            }
                        }
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("---> error GetDataFromFirebase " + ex.Message);
                    throw;
                }
            };


            _firebaseDatabase.GetProfile("users", onValueEvent);
        }
Esempio n. 5
0
        private async void GetProfile()
        {
            string uid = await _firebaseAuth.GetCurrentUser();

            Action <Dictionary <string, UserModel> > onValueEvent = (Dictionary <string, UserModel> users) =>
            {
                try
                {
                    System.Diagnostics.Debug.WriteLine("---> EVENT Get Profile Firebase ");

                    Action onSetValueSuccess = () =>
                    {
                    };

                    Action <string> onSetValueError = (string errorDesc) =>
                    {
                    };

                    if (users != null)
                    {
                        foreach (KeyValuePair <string, UserModel> item in users)
                        {
                            if (item.Key == uid)
                            {
                                SetProfile(item.Value);
                                user = item.Value;
                            }
                        }
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("---> error Get Profile Firebase " + ex.Message);
                    throw;
                }
            };


            _firebaseDatabase.GetCheckProfile("users", onValueEvent);
        }
Esempio n. 6
0
        private async void SignupUser(string name, string email)
        {
            UserModel user = new UserModel();

            try
            {
                user.Key = "00";

                user.Name  = name;
                user.Email = email;

                user.Phone = "No Assigned";

                user.Jdate = getTodayDate();

                user.Image = new Uri("https://firebasestorage.googleapis.com/v0/b/nasiyebooking.appspot.com/o/image.png?alt=media&token=8a11ada6-4ee9-43fe-a5e3-f23b9c1f3e71");

                user.Rating = 0;

                user.Status = "Offline";

                string phone = await _firebaseAuth.GetUserPhone();

                user.Phone = phone;

                user.TripKey = "00";

                string res = await _firebaseAuth.GetCurrentUser();

                if (res != null)
                {
                    _firebaseDatabase.CreateProfile("users", user);
                    App.Current.MainPage = new MainContainerPage();
                }
            }
            catch (Exception ex)
            {
                container.IsVisible = true;
                loader.IsVisible    = false;
                await DisplayAlert("Signup", "Something went wrong, " + ex.Message, "OK");
            }
        }
Esempio n. 7
0
        private async void Book_Clicked(object sender, EventArgs e)
        {
            BookRoomModel bookRoom = new BookRoomModel();


            bookRoom.UserUID = await _firebaseAuth.GetCurrentUser();

            bookRoom.Room   = Room;
            bookRoom.Key    = "00";
            bookRoom.Date   = getTodayDate();
            bookRoom.Amount = Room.Amount;
            bookRoom.Status = "Pending";
            bookRoom.From   = from.Date.ToLocalTime().ToShortDateString();
            bookRoom.To     = to.Date.ToLocalTime().ToShortDateString();
            bookRoom.Hotel  = BHotel;

            _firebaseDatabase.SetBooking("hotelbookings", bookRoom);

            await DisplayAlert("Booking", "Your room is booked", "OK");

            await Navigation.PopAsync();
        }