private bool CheckFields()
    {
        bool validInstitution;

        if (institutionFieldObj.activeSelf)
        {
            if (institutionField.text.Length > 3)
            {
                validInstitution = true;
            }
            else
            {
                validInstitution = false;
            }
        }
        else
        {
            validInstitution = true;
        }

        return(UtilsService.CheckName(nameField.text) &&
               UtilsService.CheckEmail(emailField.text) &&
               UtilsService.CheckPassword(passwordField.text) &&
               userTypeDropdown.captionText.text != "Você é..." &&
               validInstitution);
    }
Пример #2
0
 private bool CheckFields()
 {
     return(UtilsService.CheckEmail(emailField.text) &&
            UtilsService.CheckPassword(passwordField.text));
 }
Пример #3
0
    private string CheckPersonalInfo()
    {
        User   aux     = UserService.user;
        string message = STATUS_OK;

        if (!aux.name.Equals(nameField.text) && nameField.text.Length < 3)
        {
            message = "O nome deve conter, pelo menos, três caracteres.";
        }

        if (!aux.email.Equals(emailField.text) && !UtilsService.CheckEmail(emailField.text))
        {
            message = "Insira um e-mail num formato válido.";
        }

        if (!aux.phone.Equals(phoneField.text))
        {
            if (phoneField.text.Length < 10)
            {
                message = "Insira um telefone num formato válido.";
            }
        }

        if (!aux.birth.Equals(birthField.text) && birthField.text.Length > 0)
        {
            if (birthField.text.Length != 10)
            {
                message = "Insira uma data de nascimento válida.";
            }

            string[] birthDate = birthField.text.Split('/');

            if (birthDate.Length != 3)
            {
                message = "Insira uma data da nascimento válida.";
            }
            else
            {
                int year  = birthDate[2].Length == 4 ? int.Parse(birthDate[2]) : 0,
                    month = birthDate[1].Length == 2 ? int.Parse(birthDate[1]) : 0,
                    day   = birthDate[0].Length == 2 ? int.Parse(birthDate[0]) : 0;

                if (birthDate[2].Length >= 2 && year > System.DateTime.Now.Year)
                {
                    message = "Verifique se inseriu o ano correto em seu registro.";
                }

                if (birthDate[1].Length == 2 && month > 12 || month < 1)
                {
                    message = "Verifique se inseriu o mês correto em seu registro.";
                }

                if (birthDate[0].Length == 2 && day > 31 || day < 1)
                {
                    message = "Verifique se inseriu o dia correto em seu registro.";
                }
            }
        }

        if (aux.sex.Length > 0)
        {
            if (genreDropdown.captionText.text.Equals("Gênero"))
            {
                message = "Por favor, selecione um gênero válido.";
            }
        }

        if (passField.text.Length < 6)
        {
            message = "A senha deve conter, pelo menos, seis caracteres.";
        }

        if (passField.text.Length == 0)
        {
            message = "Insira sua senha (ou uma nova senha) no campo específico para confirmar suas mudanças.";
        }

        return(message);
    }