Ejemplo n.º 1
0
    bool ValidateUsername()
    {
        string uname = username.GetText();

        if (uname.Equals(""))
        {
            username.ValidationFailed("* Field is required");
            return(true);
        }

        UserData userData = new UserData();

        userData.username = uname;
        StartCoroutine(userData.DownloadUserData(result =>
        {
            if (result != null)
            {
                username.ValidationFailed("* Username not available");
                username.ClearText();
                uname            = "";
                validationFailed = true;
            }
        }));

        if (!validationFailed)
        {
            username.HideValidation();
        }

        userData = null;
        return(validationFailed);
    }
Ejemplo n.º 2
0
    bool ValidateDetails()
    {
        if (firstName.GetText().Equals(""))
        {
            firstName.ValidationFailed("* Field is required");
            validationFailed = true;
        }
        else
        {
            firstName.HideValidation();
        }

        if (lastName.GetText().Equals(""))
        {
            lastName.ValidationFailed("* Field is required");
            validationFailed = true;
        }
        else
        {
            lastName.HideValidation();
        }

        //Might need a separate more complex validation
        if (contactNumber.GetText().Equals(""))
        {
            contactNumber.ValidationFailed("* Field is required");
            validationFailed = true;
        }
        else
        {
            contactNumber.HideValidation();
        }

        return(validationFailed);
    }
Ejemplo n.º 3
0
    bool ValidatePassword()
    {
        if (password.GetText().Equals(""))
        {
            password.ValidationFailed("* Field is required");
            validationFailed = true;
            return(validationFailed);
        }

        if (!password.GetText().Equals(confirmPassword.GetText()))
        {
            confirmPassword.ValidationFailed("* Passwords do not match");
            validationFailed = true;
            return(validationFailed);
        }

        if (!validationFailed)
        {
            password.HideValidation();
            confirmPassword.HideValidation();
        }

        return(false);
    }
Ejemplo n.º 4
0
    bool ValidateEmails()
    {
        //emailAddress
        if (emailAddress.GetText().Equals(""))
        {
            emailAddress.ValidationFailed("* Field is required");
            validationFailed = true;
        }
        else
        {
            try
            {
                MailAddress addr = new MailAddress(emailAddress.GetText());
                validationFailed = !(addr.Address == emailAddress.GetText());

                if (validationFailed)
                {
                    emailAddress.ValidationFailed("* Invalid E-mail Address");
                }
            }
            catch
            {
                validationFailed = true;
                emailAddress.ValidationFailed("* Invalid E-mail Address");
            }
        }

        //parentsEmail
        if (parentsEmail.GetText().Equals(""))
        {
            parentsEmail.ValidationFailed("* Field is required");
            validationFailed = true;
        }
        else
        {
            try
            {
                MailAddress addr = new MailAddress(parentsEmail.GetText());
                validationFailed = !(addr.Address == parentsEmail.GetText());

                if (validationFailed)
                {
                    parentsEmail.ValidationFailed("* Invalid E-mail Address");
                }
            }
            catch
            {
                validationFailed = true;
                parentsEmail.ValidationFailed("* Invalid E-mail Address");
            }
        }


        if (!validationFailed)
        {
            emailAddress.HideValidation();
            parentsEmail.HideValidation();
        }

        return(validationFailed);
    }