Esempio n. 1
0
        private void SaveAndContinueButton_Click(object sender, RoutedEventArgs e)
        {
            // Don't allow the user to submit their application until these are valid:
            // Title, First Name, Surname, Email, Year, Month
            if (!TitleBoxIsValid() ||
                !TextEntryIsValid(FirstNameTextEntry) ||
                !TextEntryIsValid(SurnameTextEntry) ||
                !EmailIsValid(EmailEntry) ||
                !DateDropDownIsValid(YearComboBox, YearsList, YearsTitle) ||
                !DateDropDownIsValid(MonthComboBox, MonthsList, MonthsTitle))
            {
                return;
            }

            // Parse the birthdate and title
            DateTime applicantBirthDate
                = ParseAndFormatBirthdate(DayComboBox.Text, MonthComboBox.Text, YearComboBox.Text);

            Titles title = (Titles)TitleComboBox.SelectedIndex;

            // Process the applicant's application
            CrudManager.CreateApplication(title, FirstNameTextEntry.Text, MiddleNameTextEntry.Text, SurnameTextEntry.Text, applicantBirthDate, EmailEntry.Text, "07722 222 222", "07722 222 222", 25_000, 1_000);

            // Dependency-inject the credit checker and process the check
            CreditChecker creditChecker = new InternalCreditChecker();
            var           approval      = creditChecker.PerformCreditCheck(null);
            bool          accepted      = approval.Approved;

            var acceptedWindow = new AcceptedWindow(accepted); // Make new window

            acceptedWindow.Show();
            acceptedWindow.Focus();
            Close(); // Close current window
        }
Esempio n. 2
0
 public Applicant CreateApplication()
 {
     return(CrudManager.CreateApplication
            (
                (Titles)ApplicantToTest.TitleId,
                ApplicantToTest.FirstName,
                ApplicantToTest.MiddleName,
                ApplicantToTest.Surname,
                ApplicantToTest.BirthDate,
                ApplicantToTest.Email,
                ApplicantToTest.MobileNum,
                ApplicantToTest.HomeTelephoneNum,
                ApplicantToTest.AnnualPersonalIncome,
                ApplicantToTest.OtherHouseholdIncome
            ));
 }