コード例 #1
0
        public static bool Validate(Person person)
        {
            if (string.IsNullOrWhiteSpace(person.FirstName))
            {
                StandardMessages.DisplayValidationError("first name");
                return(false);
            }

            if (string.IsNullOrWhiteSpace(person.LastName))
            {
                StandardMessages.DisplayValidationError("last name");
                return(false);
            }

            return(true);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            // Welcome Message for user
            StandardMessages.WelcomeMessage();

            // Ask for user information
            Person user = PersonDataCapture.Capture();

            // Checks to be sure if the first and last names are valid
            bool isUserValid = PersonValidator.Validate(user);

            if (isUserValid == false)
            {
                StandardMessages.EndApplication();
                return;
            }

            // Creates a username for the user
            AccountGenerator.CreateAccount(user);

            // Ending message for user
            StandardMessages.EndApplication();
        }