/// <summary> /// Method to be triggered when user clicks the submit-button. Checks if ssn is validated, then calls the backend to see if /// the ssn exists in the database. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void submitSsnButton_Click(object sender, EventArgs e) { this.ValidateChildren(); if (ssnErrorLabel.Visible) { MessageBox.Show("Please enter a legit birthdate first."); return; } Customer activeCustomer = handler.GetCustomer(ssnTextBox.Text, out bool isNewCustomer); if (isNewCustomer) { DialogResult answer = MessageBox.Show("Oh, you are a new customer?\n" + "If you press no, you will be returned to the main screen.", "Welcome", MessageBoxButtons.YesNo); if (answer == DialogResult.No) { return; } this.Enabled = false; NewCustInfoForm newCustomerInfo = new NewCustInfoForm(); newCustomerInfo.Customer = activeCustomer; newCustomerInfo.StartPosition = FormStartPosition.CenterParent; if (newCustomerInfo.ShowDialog() == DialogResult.OK) { activeCustomer = newCustomerInfo.Customer; this.Enabled = true; } else { this.Enabled = true; return; } } //Setup and enter the booking-form, with the active customers information PersonalPageForm bookingForm = new PersonalPageForm(); bookingForm.ActiveCustomer = activeCustomer; bookingForm.Show(); this.Enabled = false; //Set "MainForm" to this in order to be able to go back to this form if needed later on bookingForm.MainForm = this; }