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 void logButton_Click(object sender, EventArgs e)
        {
            PatronLoginStatus loggedIn = PatronLoginStatus.MISCERROR;

            if (String.IsNullOrEmpty(idTextbox.Text))
            {
                MessageBox.Show("Please input an ID!");
            }
            else if (!DatabaseInputValidation.uintIsValid(idTextbox.Text))
            {
                MessageBox.Show("User ID must be a number!");
            }
            else
            {
                loggedIn = Database.Instance.patron_login(idTextbox.Text);
                string status;
                switch (loggedIn)
                {
                case PatronLoginStatus.MISCERROR:
                    status = "Login failed!"; break;

                case PatronLoginStatus.PATRONNOTFOUND:
                    status = "Patron not found!"; break;

                case PatronLoginStatus.WAVEREXPIRED:
                    status = "Waver expired! Please resign the waver."; break;

                case PatronLoginStatus.PATRONSUSPENDED:
                    status = "Patron currently suspended!"; break;

                case PatronLoginStatus.SUCCESS:
                    status = "Login successful!"; break;

                case PatronLoginStatus.PATRONSUSPCLEAR:
                    status = "Patron Suspension Cleared, Please Re-Enter your Login!"; break;

                default:
                    status = "what"; break;
                }
                MessageBox.Show(status);
            }
        }
Exemple #3
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 #4
0
 public void PositiveIntInputValidation6()
 {
     Assert.IsTrue(DatabaseInputValidation.uintIsValid(""));
 }
Exemple #5
0
 public void PositiveIntInputValidation5()
 {
     Assert.IsFalse(DatabaseInputValidation.uintIsValid("sad"));
 }