public async void RegisterMethod()
        {
            if (string.IsNullOrEmpty(this.NombreTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Nombre.", "Accept");

                return;
            }

            if (string.IsNullOrEmpty(this.ApellidoTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Apellido.", "Accept");

                return;
            }
            if (string.IsNullOrEmpty(this.EmailTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Email.", "Accept");

                return;
            }

            if (string.IsNullOrEmpty(this.EdadTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Edad.", "Accept");

                return;
            }
            //this.IsVisibleTxt = true;
            //this.isRunning = true;
            //this.isEnabled = true;

            var carros = new Carros
            {
                Nombre   = NombreTxt.ToLower(),
                Apellido = ApellidoTxt.ToLower(),
                Email    = EmailTxt.ToLower(),
                Edad     = EdadTxt.ToLower()
            };



            var obtenerId = await _databaseQuery.SaveCarrosAsync(carros);

            var obtengoRegistro = await _databaseQuery.GetCarros();


            await Application.Current.MainPage.DisplayAlert("Datos guardados", "Perfectamente", "Acectar");



            //this.IsRunningTxt = false;
            //this.IsVisibleTxt = false;
            //this.IsEnabledTxt = true;



            // await Application.Current.MainPage.Navigation.PushAsync(new LoginPage());
        }
        private async void Register()
        {
            if (string.IsNullOrEmpty(this.EmailTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You must enter an email", "Accept");

                return;
            }
            if (string.IsNullOrEmpty(this.PasswordTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You must enter a Password", "Accept");

                return;
            }
            if (string.IsNullOrEmpty(this.UsernameTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Username", "Accept");

                return;
            }
            if (AgeTxt.ToString() == null)
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Age", "Accept");

                return;
            }
            if (string.IsNullOrEmpty(this.LNameTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Last Name", "Accept");

                return;
            }
            if (string.IsNullOrEmpty(this.FNameTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You must enter an First Name", "Accept");

                return;
            }


            var user = new User
            {
                Email         = EmailTxt.ToLower(),
                Password      = PasswordTxt.ToLower(),
                FirstName     = FNameTxt.ToLower(),
                LastName      = LNameTxt.ToLower(),
                Age           = AgeTxt.ToString(),
                Creation_Date = DateTime.UtcNow.Date
            };

            await App.Database.SaveUserAsync(user);//Anade al nuevo usuario creado en el registro
        }
        public async void RegisterMethod()
        {
            var user = new User
            {
                UserName    = UserNameTxt.ToLower(),
                Password    = PasswordTxt.ToLower(),
                Email       = EmailTxt.ToLower(),
                PhoneNumber = PhoneNumberTxt.ToLower()
            };

            await App.Database.SaveUserAsync(user);

            await Application.Current.MainPage.DisplayAlert("Datos guardados", "Bienvenido" + userName.ToString(), "Acectar");

            await Application.Current.MainPage.Navigation.PushAsync(new LoginPage());

            #endregion
        }
Exemplo n.º 4
0
        public async void ActualizarMethod()
        {
            if (string.IsNullOrWhiteSpace(this.EmailTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Email.", "Accept");

                return;
            }


            //Valida que el formato del correo sea valido
            bool isEmail = Regex.IsMatch(EmailTxt, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase);

            if (!isEmail)
            {
                await Application.Current.MainPage.DisplayAlert("Advertencia", "El formato del correo electrónico es incorrecto, revíselo e intente de nuevo.", "OK");

                return;
            }


            if (string.IsNullOrEmpty(this.PasswordTxt))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Password.", "Acceptar");

                return;
            }


            if (string.IsNullOrEmpty(this.RepetircontrasenaTXT))
            {
                await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Password.", "Acceptar");

                return;
            }



            var user = new User
            {
                Email    = EmailTxt.ToLower(),
                Password = PasswordTxt.ToLower(),
            };


            //if (user.Id != 0)
            //{

            //}
            //else {
            //    await Application.Current.MainPage.DisplayAlert("Usuario no encontrado", "ok", "Aceptar");

            //    await Application.Current.MainPage.Navigation.PushAsync(new CambiarContraseña());

            //    return;
            //}


            await App.Database.SaveUserAsync(user);


            await Application.Current.MainPage.DisplayAlert("Datos Actualizados", "Bien echo", "Acectar");



            await Application.Current.MainPage.Navigation.PushAsync(new LoginPage());
        }