Exemplo n.º 1
0
        internal bool[] validate()
        {
            var res = new bool[4];

            if (!string.IsNullOrEmpty(Name))
            {
                res[0] = true;
            }
            Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
            Match match = regex.Match(EmailorPhone);

            if (match.Success)
            {
                res[1] = true;
            }
            else
            {
                var phone = new string(EmailorPhone.Where(Char.IsDigit).ToArray());
                if (phone.Length == 10)
                {
                    res[1] = true;
                }
            }
            if (PassWord.Length > 5)
            {
                if (PassWord.Where(Char.IsDigit).Count() > 0 && PassWord.Where(Char.IsLetter).Count() > 0)
                {
                    res[2] = true;
                }
            }
            if (ConfirmPassword.Length > 5)
            {
                if (ConfirmPassword == PassWord && res[2])
                {
                    res[3] = true;
                }
            }
            return(res);
        }