Exemple #1
0
        private void modifyButton_Click(object sender, EventArgs e)
        {
            if (FirstNameTextbox.Text != "" && LastNameTextbox.Text != "" && MiddleInitTextbox.Text != "" && EmailTextbox.Text != "" && PhoneTextbox.Text != "" && IDTextbox.Text != "")
            {
                //First make sure all the text boxes are filled
                bool isValid = true;

                if (!DatabaseInputValidation.nameIsValid(FirstNameTextbox.Text) && isValid)
                {
                    isValid = false;
                    MessageBox.Show("First Name has Invalid Input!");
                }
                if (!DatabaseInputValidation.nameIsValid(FirstNameTextbox.Text) && isValid)
                {
                    isValid = false;
                    MessageBox.Show("Last Name has Invalid Input!");
                }
                if (!DatabaseInputValidation.nameIsValid(FirstNameTextbox.Text) && isValid)
                {
                    isValid = false;
                    MessageBox.Show("Middle Initial has Invalid Input!");
                }
                if (!DatabaseInputValidation.uintIsValid(PhoneTextbox.Text) && isValid)
                {
                    isValid = false;
                    MessageBox.Show("Phone Number has Invalid Input!");
                }
                if (!DatabaseInputValidation.uintIsValid(IDTextbox.Text) && isValid)
                {
                    isValid = false;
                    MessageBox.Show("ID number has Invalid Input!");
                }
                if (!DatabaseInputValidation.stringIsValid(EmailTextbox.Text) && isValid)
                {
                    isValid = false;
                    MessageBox.Show("Email has Invalid Input!");
                }


                if (isValid)
                {
                    var sign = new SignWaiver(FirstNameTextbox.Text, LastNameTextbox.Text, MiddleInitTextbox.Text, PhoneTextbox.Text, EmailTextbox.Text, Convert.ToInt32(IDTextbox.Text), true);
                    sign.Show();
                    //createPatron(string fName, string lName, string midI, string phone, string email, string pat_Id)
                    //  bool status = Database.Instance.modifyPatron(FirstNameTextbox.Text, LastNameTextbox.Text, MiddleInitTextbox.Text, PhoneTextbox.Text, EmailTextbox.Text, Convert.ToInt32(IDTextbox.Text));
                }
            }
            else
            {
                MessageBox.Show("Make sure all textboxes are filled out!");
            }
        }
Exemple #2
0
        private bool databaseSearchValidation()
        {
            bool isValid = false;

            switch (tableSelectBox.SelectedIndex)
            {
            case ((int)DatabaseSearchVal.EMPLOYEE):
                if (DatabaseInputValidation.uintIsValid(empIdBox.Text) &&
                    DatabaseInputValidation.uintIsValidWithinRange(empLevelBox.Text, 0, 2) &&
                    DatabaseInputValidation.stringIsValid(empUsernameBox.Text))
                {
                    isValid = true;
                }
                break;

            case ((int)DatabaseSearchVal.PATRON):
                if (DatabaseInputValidation.uintIsValid(patronIdBox.Text) &&
                    DatabaseInputValidation.nameIsValid(patronFirstNameBox.Text) &&
                    DatabaseInputValidation.nameIsValid(patronLastNameBox.Text))
                {
                    isValid = true;
                }
                break;

            case ((int)DatabaseSearchVal.LOGINS):
                if (DatabaseInputValidation.uintIsValid(loginPatronIdBox.Text))
                {
                    isValid = true;
                }
                break;

            case ((int)DatabaseSearchVal.SUSPENSIONS):
                if (DatabaseInputValidation.uintIsValid(susPatronIdBox.Text))
                {
                    isValid = true;
                }
                break;
            }
            return(isValid);
        }
Exemple #3
0
 public void NameInputValidation4()
 {
     Assert.IsFalse(DatabaseInputValidation.nameIsValid("#######"));
 }
Exemple #4
0
 public void NameInputValidation3()
 {
     Assert.IsFalse(DatabaseInputValidation.nameIsValid("a32d"));
 }
Exemple #5
0
 public void NameInputValidation2()
 {
     Assert.IsTrue(DatabaseInputValidation.nameIsValid(""));
 }
Exemple #6
0
 public void NameInputValidation1()
 {
     Assert.IsTrue(DatabaseInputValidation.nameIsValid("John Dickenson"));
 }