private void SetRandomPassword()
        {
            var randomPass = Data.RandomValuesGenerator.RandomString(8);

            Password.Clear();
            PasswordConfirm.Clear();
            Password.SendKeys(randomPass);
            PasswordConfirm.SendKeys(randomPass);
        }
Exemple #2
0
        public bool AreRequiredFieldsFilled()
        {
            bool areFilled = true;

            areFilled = String.IsNullOrEmpty(UserName.CleanSpaces()) ? false : true;
            areFilled = String.IsNullOrEmpty(Password.CleanSpaces()) ? false : true;
            areFilled = String.IsNullOrEmpty(PasswordConfirm.CleanSpaces()) ? false : true;
            areFilled = String.IsNullOrEmpty(Email.CleanSpaces()) ? false : true;
            areFilled = String.IsNullOrEmpty(TfsUserName.CleanSpaces()) ? false : true;
            areFilled = GetTeams().Where(x => x.Selected.Equals(true)).ToList().Count == 0 ? false : true;

            return(areFilled);
        }
Exemple #3
0
 //Reset form data and visibility
 private void ResetForm()
 {
     //EditPermBT.IsEnabled = false;
     UserNameTX.Clear();
     UserRealTX.Clear();
     UserPassword.Clear();
     FormGrid.MaxHeight       = 230;
     CheckPassword.Visibility = Visibility.Collapsed;
     PasswordConfirm.Clear();
     SelectedIndex              = "";
     UserRolCB.SelectedIndex    = 0;
     UserBranchCB.SelectedIndex = 0;
     SaveBT.IsEnabled           = false;
 }
Exemple #4
0
 void ReleaseDesignerOutlets()
 {
     if (Email != null)
     {
         Email.Dispose();
         Email = null;
     }
     if (ErrorText != null)
     {
         ErrorText.Dispose();
         ErrorText = null;
     }
     if (FirstNameChoice != null)
     {
         FirstNameChoice.Dispose();
         FirstNameChoice = null;
     }
     if (LastNameChoice != null)
     {
         LastNameChoice.Dispose();
         LastNameChoice = null;
     }
     if (PasswordChoice != null)
     {
         PasswordChoice.Dispose();
         PasswordChoice = null;
     }
     if (PasswordConfirm != null)
     {
         PasswordConfirm.Dispose();
         PasswordConfirm = null;
     }
     if (Signup != null)
     {
         Signup.Dispose();
         Signup = null;
     }
     if (UsernameChoice != null)
     {
         UsernameChoice.Dispose();
         UsernameChoice = null;
     }
 }
        private async void Save()
        {
            if (string.IsNullOrEmpty(FirstName))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su nombre.");

                return;
            }
            if (string.IsNullOrEmpty(LastName))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su apellido paterno.");

                return;
            }
            if (string.IsNullOrEmpty(MotherLastName))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su apellido materno.");

                return;
            }
            if (string.IsNullOrEmpty(Phone))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su número de teléfono.");

                return;
            }
            var digito = Phone.Substring(0, 1);

            if (Convert.ToInt32(digito) != 9)
            {
                await dialogService.ShowMessage("Mensaje", "Debe empezar el primero dígito del número telefónico con el número 9");

                return;
            }
            if (string.IsNullOrEmpty(DNI))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su número de DNI.");

                return;
            }
            if (string.IsNullOrEmpty(Email))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su email.");

                return;
            }
            if (!Utilities.IsValidEmail(Email))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar un Email  válido");

                return;
            }
            if (string.IsNullOrEmpty(Password))
            {
                await dialogService.ShowMessage("Mensaje", "Debes ingresar una Contraseña");

                return;
            }

            int numberCharter = Password.Length;

            if (numberCharter < 5)
            {
                await dialogService.ShowMessage("Mensaje", "Su contarseña debe tener como mínimo 5 caracteres.");

                return;
            }

            if (string.IsNullOrEmpty(PasswordConfirm))
            {
                await dialogService.ShowMessage("Mensaje", "Debes ingresar la confirmación de la contraseña");

                return;
            }
            if (!PasswordConfirm.Equals(Password))
            {
                await dialogService.ShowMessage("Mensaje", "Las contraseñas no coinciden");

                return;
            }

            if (UserTypeId == 0)
            {
                await dialogService.ShowMessage("Mensaje", "Seleccione un tipo de usuario");

                return;
            }

            isBusy    = true;
            IsEnabled = !isBusy;

            byte[] array = null;
            if (ImageSource != null)
            {
                Stream stream = null;
                if (file != null)
                {
                    stream = file.GetStream() ?? null;
                    if (stream != null)
                    {
                        array = Utilities.ReadFully(stream);
                    }
                }
            }

            var userForm = new UserForm
            {
                Nombre           = FirstName,
                Apellido_Paterno = LastName,
                Apellido_Materno = MotherLastName,
                Telefono         = Phone,
                DNI              = DNI,
                Email            = Email,
                Contrasenia      = Password,
                Fecha_Nacimiento = DateTime.UtcNow.AddHours(-5),
                //Photo
                //Usuario_Name=Email,
                UserTypeId = UserTypeId,
            };

            var isReachable = await CrossConnectivity.Current.IsRemoteReachable("google.com");

            if (isReachable)
            {
                var response = await apiService.Post <UserForm, Response>(Configuration.SERVER, "/api", "/account/RegisterUser", "", "", userForm, false);

                if (response != null)
                {
                    var result = (Response)response.Resullt;
                    isBusy    = false;
                    IsEnabled = !isBusy;

                    if (result.IsSuccess)
                    {
                        await dialogService.ShowMessage("Confirmación", result.Message);

                        navigationService.SetMainPage("NewLoginPage");
                    }
                    else
                    {
                        await dialogService.ShowMessage("Mensaje", result.Message);

                        return;
                    }
                }
            }
            else
            {
                isBusy    = false;
                IsEnabled = !isBusy;
                await dialogService.ShowMessage("Mensaje", "Es necesario tener conexión a internet para poder registrarse");

                return;
            }
        }