public static bool Validate(Person person)
        {
            if (string.IsNullOrEmpty(person.FirstName))
            {
                StandardMessage.DisplayValidationError("first name");
                return(false);
            }
            if (string.IsNullOrEmpty(person.LastName))
            {
                StandardMessage.DisplayValidationError("last name");
                return(false);
            }

            return(true);
        }
示例#2
0
        static void Main(string[] args)
        {
            StandardMessage.WelcomeMessage();

            Person user = PersonDataCapture.Capture();

            bool isUserValid = PersonValidator.Validate(user);

            if (isUserValid == false)
            {
                StandardMessage.EndMessage();
                return;
            }
            AccountGenerator.CreateUserAccount(user);
            StandardMessage.EndMessage();
        }
示例#3
0
        public static bool Validate(Person person)
        {
            //Check to be sure the first and last name are valid
            if (string.IsNullOrWhiteSpace(person.FirstName))
            {
                StandardMessage.DisplayValidationError("first name");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(person.LastName))
            {
                StandardMessage.DisplayValidationError("last name");

                return(false);
            }

            return(true);
        }