예제 #1
0
        private bool VerifyFields()
        {
            // check username
            if (String.IsNullOrEmpty(Username.Text))
            {
                MOG_Prompt.PromptResponse("Missing Data", "Please enter a user name");
                Username.Focus();
                return(false);
            }
            if (Email.Text.IndexOf(" ") != -1)
            {
                MOG_Prompt.PromptResponse("Invalid Character", "Email addresses cannot contian spaces");
                Email.Focus();
                return(false);
            }

            if (MOG_ControllerSystem.InvalidMOGCharactersCheck(Username.Text, false))
            {
                MOG_Prompt.PromptResponse("Please fix the user name", "Invalid Character in user name.  Fix this and try again.");
                Username.Focus();
                return(false);
            }

            if (String.IsNullOrEmpty(Departments.Text))
            {
                MOG_Prompt.PromptResponse("Missing Data", "Please enter a user category");
                Departments.Focus();
                return(false);
            }

            if (String.IsNullOrEmpty(Privileges.Text))
            {
                MOG_Prompt.PromptResponse("Missing Data", "Please enter a user privilege group");
                Privileges.Focus();
                return(false);
            }

            // fixup hand-entered bless target
            foreach (string blessTarget in BlessTargets.Items)
            {
                if (String.Compare(blessTarget, BlessTargets.Text, true) == 0)
                {
                    BlessTargets.SelectedItem = blessTarget;
                }
            }

            if (String.Compare(BlessTargets.Text, Username.Text, true) == 0 &&
                !BlessTargets.Items.Contains(Username.Text))
            {
                BlessTargets.Items.Add(Username.Text);
                BlessTargets.SelectedItem = Username.Text;
            }

            if (String.IsNullOrEmpty(BlessTargets.SelectedItem as string))
            {
                MOG_Prompt.PromptResponse("Missing Data", "Please enter a user bless target");
                BlessTargets.Focus();
                return(false);
            }

            return(true);
        }