Ejemplo n.º 1
0
        public async void BtnAdd_Clicked(object sender, EventArgs e)
        {
            String myDate = DateTime.Now.ToString();
            await firebaseHelper.AddPerson(Convert.ToInt32(txtId.Text), txtName.Text /*, *//*_item.ToString()*/, myDate);

            txtName.Text = string.Empty;
            await DisplayAlert("Başarılı", "Oda Eklendi", "OK");

            await Navigation.PopModalAsync();
        }
Ejemplo n.º 2
0
        public async void OnSuggestionTapped(string suggestionTapped)
        {
            Debug.WriteLine($"**** {this.GetType().Name}.{nameof(OnSuggestionTapped)}:  {suggestionTapped}");

            if (suggestionTapped == "In-N-Out Burger")
            {
                await _navigationService.NavigateAsync("ChooseSeatingPage", null);

                IsVisible = false;
            }
            else if (suggestionTapped == "ChickFila")
            {
                string email    = "*****@*****.**";
                string Name     = "Salan";
                string password = "******";

                var person = await firebaseHelper.GetPerson(Name, password);

                if (person == null)
                {
                    await firebaseHelper.AddPerson(email, Name, password);
                }
                //await DisplayAlert("Success", "Person Added Successfully", "OK");
                //var allPersons = await firebaseHelper.GetAllPersons();
                //lstPersons.ItemsSource = allPersons;
                await _navigationService.NavigateAsync("ChickFilaSeatPage", null);

                IsVisible = false;
            }
        }
        private async void BtnAdd_Clicked(object sender, EventArgs e)
        {
            if (!IsFormValid())
            {
                await DisplayAlert("Error", "Name and person are required fields", "OK");

                return;
            }

            var person = await firebaseHelper.GetPerson(TxtName.Text);

            if (person != null)
            {
                await DisplayAlert("Error", "A person with that name already exist", "OK");

                return;
            }

            await firebaseHelper.AddPerson(TxtName.Text, TxtPhone.Text);

            TxtName.Text  = string.Empty;
            TxtPhone.Text = string.Empty;

            await DisplayAlert("Success", "Person Added Successfully", "OK");

            await FetchAllPersons();
        }
Ejemplo n.º 4
0
        private async void btnRegister_Clicked(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUseName.Text))
            {
                await DisplayAlert("", "Invalid name", "Ok");

                return;
            }

            bool res = await firebaseHelper.checkExistingUser(txtUseName.Text.ToString());

            if (res)
            {
                await DisplayAlert("", "User Already registered", "Ok");
            }
            else
            {
                int userId = await firebaseHelper.GetMaxUserID();

                await firebaseHelper.AddPerson((userId + 1), txtUseName.Text.ToString(), true, "", "", "");

                Preferences.Set("isRegistered", true);
                Application.Current.MainPage = new AppShell();
            }
        }
        private async void GoToNextPage()
        {
            Debug.WriteLine($"**** {this.GetType().Name}.{nameof(GoToNextPage)}");

            if (string.IsNullOrEmpty(Username_Entry) || string.IsNullOrEmpty(Name_Entry) || string.IsNullOrEmpty(DateOfBirthMonth_Entry) || string.IsNullOrEmpty(DateOfBirthMonth_Entry) ||
                string.IsNullOrEmpty(DateOfBirthYear_Entry) || string.IsNullOrEmpty(Password_Entry))
            {
                await _pageDialogService.DisplayAlertAsync("Error", "You must fill out all fields", "Dismiss");

                return;
            }
            else
            {
                if (Username_Entry.Length < 0)
                {
                    await _pageDialogService.DisplayAlertAsync("Error", "Username is invalid", "Dismiss");

                    return;
                }
                else if (Name_Entry.Length < 0)
                {
                    await _pageDialogService.DisplayAlertAsync("Error", "You must enter a valid name", "Dismiss");

                    return;
                }
                else if (DateOfBirthMonth_Entry.Length != 2)
                {
                    await _pageDialogService.DisplayAlertAsync("Error", "You must enter a valid month", "Dismiss");

                    return;
                }
                else if (DateOfBirthYear_Entry.Length != 4)
                {
                    await _pageDialogService.DisplayAlertAsync("Error", "You must enter a valid year", "Dismiss");

                    return;
                }
                else if (Password_Entry.Length < 0)
                {
                    await _pageDialogService.DisplayAlertAsync("Error", "You must enter a valid password", "Dismiss");

                    return;
                }
                else
                {
                    var person = await firebaseHelper.GetPerson(Name_Entry, Password_Entry);

                    if (person == null)
                    {
                        firebaseHelper.AddPerson(Username_Entry, Name_Entry, Password_Entry);
                    }

                    await nav_service.NavigateAsync("LoginPage", null);
                }
            }
        }
Ejemplo n.º 6
0
        public async void OnClickedFinalizar(object sender, EventArgs args)
        {
            var prueba = files.GetStream();



            if (!string.IsNullOrWhiteSpace(nickname.Text) && !string.IsNullOrWhiteSpace(email.Text) && !string.IsNullOrWhiteSpace(celular.Text)

                && !string.IsNullOrWhiteSpace(password.Text) && files != null)

            {
                try
                {
                    var selectedValue = genero.Items[genero.SelectedIndex];

                    string user = _firebaseService.GetUserId();


                    Dialogs.ShowLoading("Registrando");;
                    await Task.Delay(4000);

                    Dialogs.HideLoading();
                    await firebaseHelper.AddPerson(user, nickname.Text, email.Text, celular.Text, codPromocional.Text, selectedValue.ToString(), password.Text, "true", "true", "P", "I", "N");

                    nickname.Text       = string.Empty;
                    email.Text          = string.Empty;
                    celular.Text        = string.Empty;
                    codPromocional.Text = string.Empty;
                    password.Text       = string.Empty;
                    passwordconf.Text   = string.Empty;
                    var stroageImage = await new FirebaseStorage("upick-app-c921d.appspot.com")
                                       .Child("Prestador")
                                       .Child(user + ".jpg")
                                       .PutAsync(files.GetStream());
                    await DisplayAlert("Success", "Se ha registrado exitosamente", "OK");


                    CrearPerfilPage myHomePage = new CrearPerfilPage();
                    NavigationPage.SetHasNavigationBar(myHomePage, false);
                    await Navigation.PushModalAsync(myHomePage);
                }

                catch (Exception ex)
                {
                    await DisplayAlert("Registrarse Error", ex.Message, "Gracias");
                }
            }


            else
            {
                await DisplayAlert("Registrarse", "Verifique la Información", "Gracias");
            }
        }
        private async void BtnAdd_Clicked(object sender, EventArgs e)
        {
            await firebaseHelper.AddPerson(Convert.ToInt32(txtId.Text), txtName.Text);

            txtId.Text   = string.Empty;
            txtName.Text = string.Empty;
            await DisplayAlert("Success", "Person Added Successfully", "OK");

            var allPersons = await firebaseHelper.GetAllPersons();

            lstPersons.ItemsSource = allPersons;
        }
Ejemplo n.º 8
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            await firebaseHelper.AddPerson(Convert.ToInt32(txtID.Text), txttitle.Text, txtcontend.Text);

            txtID.Text      = string.Empty;
            txttitle.Text   = string.Empty;
            txtcontend.Text = string.Empty;
            await DisplayAlert("Success", "Person Added Successfully", "OK");

            var allPersons = await firebaseHelper.GetAllPersons();

            await Navigation.PopAsync();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Invoked when the Sign Up button is clicked.
        /// </summary>
        /// <param name="obj">The Object</param>
        private async void SignUpClicked(object obj)
        {
            if (this.AreFieldsValid())
            {
                // Do something
                //await DataBase.AddData(Name.Value,"Test",Number.Value,Password.Item1.ToString());
                //Application.Current.MainPage = new LoginPage();

                var user = await fireBaseHelper.GetNumber(Number.Value);

                if (user != null && Number.Value == user.Number)
                {
                    await Application.Current.MainPage.DisplayAlert("Error", "Ya existe este numero registrado", "OK");

                    return;
                }
                else
                {
                    if (AdminCode.Value == null || AdminCode.Value != "nimda")
                    {
                        await fireBaseHelper.AddPerson(Number.Value, Name.Value, Password.Item1.ToString(), 0, "1");

                        await Application.Current.MainPage.DisplayAlert("Exito", "El usuario ha sido registrado", "OK");

                        Application.Current.MainPage = new LoginPage();
                    }
                    else if (AdminCode.Value == "nimda")
                    {
                        await fireBaseHelper.AddPerson(Number.Value, Name.Value, Password.Item1.ToString(), 0, "0");

                        await Application.Current.MainPage.DisplayAlert("Exito", "El usuario ha sido registrado", "OK");

                        Application.Current.MainPage = new LoginPage();
                    }
                }
            }
        }
Ejemplo n.º 10
0
        async void SignUpButtonClicked(object sender, EventArgs e)
        {
            var user = new User()
            {
                Username = usernameEntry.Text,
                Password = passwordEntry.Text,
                Email    = emailEntry.Text
            };

            Constants.Username = usernameEntry.Text;
            Constants.Password = passwordEntry.Text;
            Constants.Email    = emailEntry.Text;
            // Sign up logic goes here

            var signUpSucceeded = AreDetailsValid(user);

            if (signUpSucceeded)
            {
                var rootPage = Navigation.NavigationStack.FirstOrDefault();
                if (rootPage != null)
                {
                    App.IsUserLoggedIn = true;
                    await Navigation.PopToRootAsync();

                    //await Navigation.PopModalAsync();
                    App.Current.MainPage = new MainPage();
                    //Navigation.InsertPageBefore(new MainPage(), Navigation.NavigationStack.First());
                }
            }
            else
            {
                messageLabel.Text = "Sign up failed";
            }

            await firebaseHelper.AddPerson(usernameEntry.Text, passwordEntry.Text, emailEntry.Text);

            usernameEntry.Text = string.Empty;
            passwordEntry.Text = string.Empty;
            emailEntry.Text    = string.Empty;
            await DisplayAlert("Success", "Person Added Successfully", "OK");

            var allPersons = await firebaseHelper.GetAllPersons();

            //lstPersons.ItemsSource = allPersons;
        }
Ejemplo n.º 11
0
        private async void InsertMethod()
        {
            var person = new PersonModel
            {
                NameField = name,
                AgeField  = int.Parse(age),
            };

            await firebaseHelper.AddPerson(person);

            this.IsRefreshing = true;

            await Task.Delay(1000);

            LoadData();

            this.IsRefreshing = false;
        }
Ejemplo n.º 12
0
        async void OnLoginButtonClicked(object sender, EventArgs e)
        {
            var isValid    = false;
            var code_Input = codeEntry.Text;
            var name_Input = nameEntry.Text;
            var strinDOC   = "DOC001P1";

            if (code_Input == null)
            {
                DisplayAlert("Cuidado", "Entra un código válido o consulte con su médico", "ok");
            }
            else if (name_Input == null)
            {
                DisplayAlert("Falta un campo", "Rellena el campo con un nombre de referencia.", "Rellenar");
            }
            else
            {
                /*string pattern = @"^[a-zA-Z]{3}\d{3}$";
                 *
                 * if (Regex.IsMatch(code_Input, pattern, RegexOptions.IgnoreCase))
                 * {
                 *  _configuration.SaveProperty("name", name_Input);
                 *  _configuration.SaveProperty("docId", code_Input);
                 *  CheckCode(codeEntry.Text);
                 *
                 *  codeEntry.Text = string.Empty;
                 *  nameEntry.Text = string.Empty;
                 *  isValid = true;
                 * }
                 * else
                 * {
                 *  DisplayAlert("Cuidado", "Entra un código válido o consulte con su médico", "ok");
                 * }*/
                await firebaseHelper.AddPerson(Convert.ToInt32(codeEntry.Text.Substring(7)), nameEntry.Text.ToUpper(), codeEntry.Text.ToUpper(), false);

                _configuration.SaveProperty("name", name_Input);
                _configuration.SaveProperty("docId", code_Input);
                CheckCode(codeEntry.Text);

                codeEntry.Text = string.Empty;
                nameEntry.Text = string.Empty;
            }
        }
Ejemplo n.º 13
0
        private async void signup(object sender, EventArgs e)
        {
            await firebaseHelper.AddPerson(Convert.ToInt32(txtpass.Text), txtName.Text, Convert.ToInt32(txtic.Text), txtadd.Text, Convert.ToInt32(txtphone.Text), txtemail.Text);

            txtpass.Text  = string.Empty;
            txtName.Text  = string.Empty;
            txtic.Text    = string.Empty;
            txtadd.Text   = string.Empty;
            txtphone.Text = string.Empty;
            txtemail.Text = string.Empty;
            //await firebaseHelper.AddJob(txtDeliverAddressName.Text, txtDeliverAddress.Text,  txtPickUpAddressName.Text, txtPickUpAddress.Text);



            await DisplayAlert("Success", "Person Added Successfully", "OK");

            var allPersons = await firebaseHelper.GetAllPersons();

            // lstPersons.ItemsSource = allPersons;
        }
Ejemplo n.º 14
0
        private async void BtnAdd_Clicked(object sender, EventArgs e)
        {
            String sel = (String)picker.SelectedItem;

            if (String.IsNullOrWhiteSpace(Tutname.Text) || String.IsNullOrWhiteSpace(Tutadd.Text) || String.IsNullOrWhiteSpace(Tutphn.Text) || String.IsNullOrWhiteSpace(Tutsea.Text) || String.IsNullOrWhiteSpace(TutSub.Text) || String.IsNullOrWhiteSpace(TutStaff.Text) || String.IsNullOrWhiteSpace(Nos.Text) || String.IsNullOrWhiteSpace(sel))
            {
                await DisplayAlert("Alert", "Please enter all the fields", "Ok");
            }

            else
            {
                await firebaseHelper.AddPerson(loginid, Tutname.Text, Tutadd.Text, Tutphn.Text, Tutsea.Text, TutSub.Text, TutStaff.Text, sel, Nos.Text);

                Tutname.Text        = string.Empty;
                Tutadd.Text         = string.Empty;
                Tutphn.Text         = string.Empty;
                Tutsea.Text         = string.Empty;
                TutSub.Text         = string.Empty;
                Nos.Text            = String.Empty;
                TutStaff.Text       = string.Empty;
                picker.SelectedItem = string.Empty;
                await DisplayAlert("Success", "Updated Successfully", "OK");
            }
        }
Ejemplo n.º 15
0
 protected async override void OnAppearing()
 {
     await firebaseHelper.AddPerson(Convert.ToInt32(_configuration.ReadProperty("docId").Substring(7)), _configuration.ReadProperty("name").ToUpper(), _configuration.ReadProperty("docId").ToUpper(), true);
 }