private void resetToolStripMenuItem_Click(object sender, EventArgs e)
 {
     IDtextBox.Clear();
     NametextBox.Clear();
     EmailtextBox.Clear();
     PhonenumbertextBox.Clear();
     EventSessiontextBox.Clear();
     EventTypetextBox.Clear();
     AddresstextBox.Clear();
     AssignHalltextBox.Clear();
     EstimatedGueststextBox.Clear();
     AdvancetextBox.Clear();
     CitytextBox.Clear();
     TotalAmounttextBox.Clear();
 }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string lastName      = lastNametextBox1.Text.Trim();
                string firstName     = firstNametextBox.Text.Trim();
                string middleInitial = MItextBox.Text.Trim();
                string SSN           = SSNtextBox.Text.Trim();
                string age           = agecomboBox1.Text.Trim();
                string Number        = NumbertextBox.Text.Trim();
                string street        = streettextBox.Text.Trim();
                string city          = CitytextBox.Text.Trim();
                string employer      = employertextBox.Text.Trim();



                if (!validLast(lastName))
                {
                    MessageBox.Show("Invalid input for Last Name");
                    lastNametextBox1.Clear();
                }

                if (!validFirst(firstName))
                {
                    MessageBox.Show("Invalid input for First Name");
                    firstNametextBox.Clear();
                }


                if (!validMiddle(middleInitial))
                {
                    MessageBox.Show("Invalid input for MI");
                    MItextBox.Clear();
                }

                if (!validage(age))
                {
                    MessageBox.Show("Please enter a valid age");
                }


                if (validSSN(SSN))
                {
                    SSN_Format(ref SSN);
                    SSNtextBox.Text = SSN;
                }
                else
                {
                    MessageBox.Show("Invalid SSN Entry");
                    SSNtextBox.Clear();
                }

                if (!MarriedradioButton.Checked && !DivorcedradioButton.Checked && !UnmarriedradioButton.Checked)
                {
                    MessageBox.Show("Please Select an Marital Status");
                }

                if (!MaleRadioButton.Checked && !FemaleradioButton.Checked)
                {
                    MessageBox.Show("Please select a Gender");
                }

                if (!validNumber(Number))
                {
                    MessageBox.Show("Address Number Entry Incorrect");
                    NumbertextBox.Clear();
                }

                if (!validStreet(street))
                {
                    MessageBox.Show("Street Entry Incorrect");
                    streettextBox.Clear();
                }

                if (!validCity(city))
                {
                    MessageBox.Show("City Entry Incorrect");
                    CitytextBox.Clear();
                }



                if (!validEmployer(employer))
                {
                    MessageBox.Show("Employer Entry Incorrect");
                    employertextBox.Clear();
                }

                if (!checkBox1.Checked && !checkBox2.Checked &&
                    !checkBox3.Checked && !checkBox4.Checked && !checkBox5.Checked && !checkBox6.Checked)
                {
                    MessageBox.Show("Please Select a Job Position");
                }

                if (!CarradioButton.Checked && !HouseradioButton.Checked &&
                    !SchoolradioButton.Checked && !OtherradioButton.Checked)
                {
                    MessageBox.Show("Please Select your Loan Type");
                }
            }
            catch
            {
                MessageBox.Show("One or More Entries were Invalid");
            }

            try
            {
                //Names constants
                const decimal MINIMUM_SALARY       = 40000M;
                const int     MINIMUM_YEARS_ON_JOB = 2;

                //Local Variables
                decimal salary;
                int     yearsOnJob;

                //Get the salary and years on the job.
                salary     = decimal.Parse(AnnualSalary.Text);
                yearsOnJob = int.Parse(textBox2.Text);

                //Determine if user qualifies.
                if (salary >= MINIMUM_SALARY || yearsOnJob >= 5)
                {
                    if (yearsOnJob >= MINIMUM_YEARS_ON_JOB && salary >= MINIMUM_SALARY || yearsOnJob >= 5)
                    {
                        //User Qualifies
                        label4.Text = "You qualify for the loan";
                    }
                    else
                    {
                        //User doesn't qualify
                        label4.Text = "Minimum years at current " + "job not met.";
                    }
                }
                else
                {
                    //Use doesn't qualify.
                    label4.Text = "Minimum salary requirement " + "not met.";
                }
            }
            catch (Exception ex)
            {
                //Display error message
                MessageBox.Show(ex.Message);
            }
        }