private async Task iniciarAsync()
        {
            if (Email == null || Email.Equals(""))
            {
                EmailMessage = "Ingrese el Email";
                _textBoxEmail.Focus(FocusState.Programmatic);
            }
            else
            {
                if (TextBoxEvent.IsValidEmail(Email))
                {
                    if (Password == null || Password.Equals(""))
                    {
                        PasswordMessage = "Ingrese el password";
                        _textBoxPass.Focus(FocusState.Programmatic);
                    }
                    else
                    {
                    }
                }

                else
                {
                    EmailMessage = "El email no es valido";
                    _textBoxEmail.Focus(FocusState.Programmatic);
                }
            }
        }
Пример #2
0
        private async Task IniciarAsync()
        {
            if (Email == null || Email.Equals(""))
            {
                EmailMessage = "Ingrese el email";
                _textBoxEmail.Focus(FocusState.Programmatic);
            }
            else
            {
                if (TextBoxEvent.IsValidEmail(Email))
                {
                    if (Password == null || Password.Equals(""))
                    {
                        PasswordMessage = "Ingrese el password";
                        _textBoxPass.Focus(FocusState.Programmatic);
                    }
                    else
                    {
                        try
                        {
                            var user = _conn.TUsers.Where(u => u.Email.Equals(Email)).ToList();

                            if (0 < user.Count)
                            {
                                var pass = Encrypt.DecryptData(user[0].Password, Email);
                                if (pass.Equals(Password))
                                {
                                    var dataUser = user.ElementAt(0);
                                    dataUser.Date = DateTime.Now.ToString("dd/MMM/yyy");
                                    _sqlite.Connection.Insert(dataUser);
                                    //funcion para cambiar de vista
                                    rootFrame.Navigate(typeof(MainPage));
                                }
                                else
                                {
                                    Message = "Contraseña o email incorrectos";
                                }
                            }
                            else
                            {
                                Message = "Contraseña o email incorrectos";
                            }
                        }
                        catch (Exception ex)
                        {
                            Message = ex.Message;
                        }
                    }
                }
                else
                {
                    EmailMessage = "El email no es valido";
                    _textBoxEmail.Focus(FocusState.Programmatic);
                }
            }
        }
Пример #3
0
 private async Task RegisterUserAsync()
 {
     if (Nid == null || Nid.Equals(""))
     {
         UserTittle = "Ingrese Nid";
         _textBoxNid.Focus(FocusState.Programmatic);
     }
     else
     {
         if (Name == null || Name.Equals(""))
         {
             UserTittle = "Ingrese el nombre";
             _textBoxName.Focus(FocusState.Programmatic);
         }
         else
         {
             if (LastName == null || LastName.Equals(""))
             {
                 UserTittle = "Ingrese el apellido";
                 _textBoxLastName.Focus(FocusState.Programmatic);
             }
             else
             {
                 if (Telephone == null || Telephone.Equals(""))
                 {
                     UserTittle = "Ingrese el Numero de telefono";
                     _textBoxTelephone.Focus(FocusState.Programmatic);
                 }
                 else
                 {
                     if (Email == null || Email.Equals(""))
                     {
                         UserTittle = "Ingrese el email";
                         _textBoxEmail.Focus(FocusState.Programmatic);
                     }
                     else
                     {
                         if (TextBoxEvent.IsValidEmail(Email))
                         {
                             if (Password == null || Password.Equals(""))
                             {
                                 UserTittle = "Ingrese la contrseña";
                                 _textBoxPass.Focus(FocusState.Programmatic);
                             }
                             else
                             {
                                 if (User == null || User.Equals(""))
                                 {
                                     UserTittle = "Ingrese el usuario";
                                     _textBoxUser.Focus(FocusState.Programmatic);
                                 }
                                 else
                                 {
                                     if (SelectedRole == null || SelectedRole.Equals(""))
                                     {
                                         UserTittle = "Seleccione un rol";
                                     }
                                     else
                                     {
                                         await SaveDataAsync();
                                     }
                                 }
                             }
                         }
                         else
                         {
                             UserTittle = "el Email no es valido";
                             _textBoxEmail.Focus(FocusState.Programmatic);
                         }
                     }
                 }
             }
         }
     }
 }