void ApplyBtnClick(object sender, EventArgs e) { if (LastNameTextBox.Text.Trim().Length == 0 && FirstNameTextBox.Text.Trim().Length == 0 && MiddleNameTextBox.Text.Trim().Length == 0 && NickNameTextBox.Text.Trim().Length == 0 && IDTextBox.Text.Trim().Length == 0 && HomePageTextBox.Text.Trim().Length == 0 && EmailTextBox.Text.Trim().Length == 0) { MessageBox.Show( "Ни одно поле не заполнено!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning ); LastNameTextBox.Focus(); return; } else if (LastNameTextBox.Text.Trim().Length == 0) { MessageBox.Show( "Поле 'Фамилия' должно быть заполнено обязательно!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning ); LastNameTextBox.Focus(); return; } m_ai.LastName = LastNameTextBox.Text.Trim(); m_ai.FirstName = FirstNameTextBox.Text.Trim(); m_ai.MiddleName = MiddleNameTextBox.Text.Trim(); m_ai.NickName = NickNameTextBox.Text.Trim(); m_ai.ID = IDTextBox.Text.Trim(); m_ai.HomePage = HomePageTextBox.Text.Trim(); m_ai.Email = EmailTextBox.Text.Trim(); Close(); }
void ApplyBtnClick(object sender, EventArgs e) { if (LastNameTextBox.Text.Trim().Length == 0 && FirstNameTextBox.Text.Trim().Length == 0 && MiddleNameTextBox.Text.Trim().Length == 0 && NickNameTextBox.Text.Trim().Length == 0 && IDTextBox.Text.Trim().Length == 0 && HomePageTextBox.Text.Trim().Length == 0 && EmailTextBox.Text.Trim().Length == 0) { MessageBox.Show( "Ни одно поле не заполнено!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning ); LastNameTextBox.Focus(); return; } else if (LastNameTextBox.Text.Trim().Length == 0) { if (m_ai.AuthorType == Enums.AuthorEnum.AuthorOfBook) { // Только для Авторов Книги Фамилия нужно вводить обязательно! MessageBox.Show( "Поле 'Фамилия' должно быть заполнено обязательно!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning ); LastNameTextBox.Focus(); return; } } m_ai.LastName = LastNameTextBox.Text.Trim(); m_ai.FirstName = FirstNameTextBox.Text.Trim(); m_ai.MiddleName = MiddleNameTextBox.Text.Trim(); m_ai.NickName = NickNameTextBox.Text.Trim(); m_ai.ID = IDTextBox.Text.Trim(); m_ai.HomePage = HomePageTextBox.Text.Trim(); m_ai.Email = EmailTextBox.Text.Trim(); Close(); }
private bool ValidateForm() { if (!Regex.Match(FirstNameTextBox.Text, @"^\D{1,30}$").Success) { MessageBox.Show("First name must consist of at least 1 character and not exceed 30 characters!"); FirstNameTextBox.Focus(); return(false); } if (!Regex.Match(LastNameTextBox.Text, @"^\D{1,30}$").Success) { MessageBox.Show("Last name must consist of at least 1 character and not exceed 30 characters!"); LastNameTextBox.Focus(); return(false); } if (!Regex.Match(AddressTextBox.Text, @"^(Вул\.\s\D{1,40}\,\s\d{1,3})$").Success) { MessageBox.Show("Address must consist of at least 1 character and not exceed 50 characters!"); AddressTextBox.Focus(); return(false); } if (!Regex.Match(PhoneNumberTextBox.Text, @"^\d{10}$").Success) { MessageBox.Show("Phone number must consist of 10 digits!"); PhoneNumberTextBox.Focus(); return(false); } return(true); }
void AuthorEditButtonClick(object sender, EventArgs e) { if (AuthorsListView.SelectedItems.Count > 1) { MessageBox.Show( "Выберите только одного Автора для редактирования!", m_sTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning ); } else if (AuthorsListView.SelectedItems.Count != 1) { MessageBox.Show( "Выберите одного Автора для редактирования.", m_sTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning ); } else { m_EditMode = true; AuthorBreakEditButton.Visible = true; AuthorsWorkPanel.Enabled = ApplyBtn.Enabled = AuthorsListView.Enabled = false; LastNameTextBox.Text = AuthorsListView.SelectedItems[0].SubItems[0].Text; FirstNameTextBox.Text = AuthorsListView.SelectedItems[0].SubItems[1].Text; MiddleNameTextBox.Text = AuthorsListView.SelectedItems[0].SubItems[2].Text; NickNameTextBox.Text = AuthorsListView.SelectedItems[0].SubItems[3].Text; HomePageTextBox.Text = AuthorsListView.SelectedItems[0].SubItems[4].Text; EmailTextBox.Text = AuthorsListView.SelectedItems[0].SubItems[5].Text; IDTextBox.Text = AuthorsListView.SelectedItems[0].SubItems[6].Text; LastNameTextBox.Focus(); } }
private void LastNameTextBox_Leave(object sender, EventArgs e) { if (LastNameTextBox.TextLength < 2) { LastNameTextBox.Focus(); LastNameTextBox.SelectAll(); } }
// Checks imput fields. private bool CheckFields() { // First name. if (String.IsNullOrEmpty(FirstNameTextBox.Text)) { ErrorFirstNameTextBlock.Visibility = Visibility.Visible; FirstNameTextBox.Focus(FocusState.Programmatic); return(false); } else { ErrorFirstNameTextBlock.Visibility = Visibility.Collapsed; } // Last name. if (String.IsNullOrEmpty(LastNameTextBox.Text)) { ErrorLastNameTextBlock.Visibility = Visibility.Visible; LastNameTextBox.Focus(FocusState.Programmatic); return(false); } else { ErrorLastNameTextBlock.Visibility = Visibility.Collapsed; } // DOB. if (DobDatePicker.Date == null || DobDatePicker.Date >= dateTimeOnPageCreation) { ErrorDobDateTextBlock.Visibility = Visibility.Visible; DobDatePicker.Focus(FocusState.Programmatic); return(false); } else { ErrorDobDateTextBlock.Visibility = Visibility.Collapsed; } // Gender. if (GenderComboBox.SelectedItem == null) { ErrorGenderTextBlock.Visibility = Visibility.Visible; GenderComboBox.Focus(FocusState.Programmatic); return(false); } else { ErrorGenderTextBlock.Visibility = Visibility.Collapsed; } return(true); }
/// <summary> /// Creates a new author based on the user inputs /// </summary> private void CreateAuthor() { //if nothing was inputted to FirstNameTextBox, show error message and return if (FirstNameTextBox.Text.Length == 0) { ErrorTextBlock.Text = "Please enter a first name."; FirstNameTextBox.Focus(); return; } //if nothing was entered in LastNameTextBox, show error message and return if (LastNameTextBox.Text.Length == 0) { ErrorTextBlock.Text = "Please enter a last name."; LastNameTextBox.Focus(); return; } //Show confirmation messagebox, if the messagebox result is Yes, set the dialog result to true and close this window. if (MessageBox.Show("Are you sure you want to create this author?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes) { FirstNameResult = FirstNameTextBox.Text; LastNameResult = LastNameTextBox.Text; if (BioTextBox.Text == BIO_TEXTBOX_DEFAULT) { BioResult = string.Empty; } else { BioResult = BioTextBox.Text; } DialogResult = true; this.Close(); } }
void AuthorAddButtonClick(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(LastNameTextBox.Text) && string.IsNullOrWhiteSpace(FirstNameTextBox.Text) && string.IsNullOrWhiteSpace(MiddleNameTextBox.Text) && string.IsNullOrWhiteSpace(NickNameTextBox.Text) && string.IsNullOrWhiteSpace(IDTextBox.Text) && string.IsNullOrWhiteSpace(HomePageTextBox.Text) && string.IsNullOrWhiteSpace(EmailTextBox.Text)) { MessageBox.Show("Ни одно поле не заполнено!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); LastNameTextBox.Focus(); return; } else if (string.IsNullOrWhiteSpace(LastNameTextBox.Text)) { MessageBox.Show("Поле 'Фамилия' должно быть заполнено обязательно!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); LastNameTextBox.Focus(); return; } AuthorBreakEditButton.Visible = false; if (m_EditMode) { // режим правки автора ListViewItem SelectedItem = AuthorsListView.SelectedItems[0]; SelectedItem.SubItems[0].Text = LastNameTextBox.Text.Trim(); SelectedItem.SubItems[1].Text = FirstNameTextBox.Text.Trim(); SelectedItem.SubItems[2].Text = MiddleNameTextBox.Text.Trim(); SelectedItem.SubItems[3].Text = NickNameTextBox.Text.Trim(); SelectedItem.SubItems[4].Text = HomePageTextBox.Text.Trim(); SelectedItem.SubItems[5].Text = EmailTextBox.Text.Trim(); SelectedItem.SubItems[6].Text = IDTextBox.Text.Trim(); } else { List <string> list1 = new List <string>(); list1.Add( LastNameTextBox.Text.Trim() + FirstNameTextBox.Text.Trim() + MiddleNameTextBox.Text.Trim() + NickNameTextBox.Text.Trim() + IDTextBox.Text.Trim() ); foreach (ListViewItem Item in AuthorsListView.Items) { List <string> list2 = new List <string>(); list2.Add( Item.SubItems[0].Text.Trim() + Item.SubItems[1].Text.Trim() + Item.SubItems[2].Text.Trim() + Item.SubItems[3].Text.Trim() + Item.SubItems[6].Text.Trim() ); List <string> list3 = list1.Intersect(list2, new FB2EqualityComparer()).ToList(); if (list3.Count >= 1) { MessageBox.Show( "В списке Авторов уже есть Автор с точно такими же данными!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning ); LastNameTextBox.Focus(); return; } } ListViewItem lvi = new ListViewItem(LastNameTextBox.Text.Trim()); lvi.SubItems.Add(FirstNameTextBox.Text.Trim()); lvi.SubItems.Add(MiddleNameTextBox.Text.Trim()); lvi.SubItems.Add(NickNameTextBox.Text.Trim()); lvi.SubItems.Add(HomePageTextBox.Text.Trim()); lvi.SubItems.Add(EmailTextBox.Text.Trim()); lvi.SubItems.Add(IDTextBox.Text.Trim()); AuthorsListView.Items.Add(lvi); } cancelEditMode(); LastNameTextBox.Focus(); }
private bool ValidateForm() { if (!Regex.Match(FirstNameTextBox.Text, @"^\D{1,30}$").Success) { MessageBox.Show("First name must consist of at least 1 character and not exceed 30 characters!"); FirstNameTextBox.Focus(); return(false); } if (!Regex.Match(LastNameTextBox.Text, @"^\D{1,30}$").Success) { MessageBox.Show("Last name must consist of at least 1 character and not exceed 30 characters!"); LastNameTextBox.Focus(); return(false); } if (!Regex.Match(PhoneNumberTextBox.Text, @"^\d{10}$").Success) { MessageBox.Show("Phone number must consist of 10 digits!"); PhoneNumberTextBox.Focus(); return(false); } if (!Regex.Match(ExperienceTextBox.Text, @"^[0-9]+$").Success) { MessageBox.Show("Invalid work experience number! It must contain only digits"); ExperienceTextBox.Focus(); return(false); } if (!Regex.Match(AddressTextBox.Text, @"^(Вул\.\s\D{1,40}\,\s\d{1,3})$").Success) { MessageBox.Show("Address must consist of at least 1 character and not exceed 50 characters!"); AddressTextBox.Focus(); return(false); } if (RoleComboBox.SelectedItem == null) { MessageBox.Show("Please select role"); return(false); } if (MarketComboBox.SelectedItem == null) { MessageBox.Show("Please select market"); return(false); } if (CityComboBox.SelectedItem == null) { MessageBox.Show("Please select city"); return(false); } if (!Regex.Match(LoginTextBox.Text, @"^\D{6,20}$").Success) { MessageBox.Show("Login must consist of at least 6 character and not exceed 20 characters!"); LoginTextBox.Focus(); return(false); } if (!Regex.Match(PasswordTextBox.Text, @"^\D{6,20}$").Success) { MessageBox.Show("Login must consist of at least 6 character and not exceed 20 characters!"); PasswordTextBox.Focus(); return(false); } return(true); }
private void button1_Click(object sender, EventArgs e) { password = ConfirmPassword.Text; //string encryptedPassword = Encrypt(password); int phoneNumber = PhoneText.Text.Length; int passLength = PasswordText.Text.Length; string gender = ""; if (MaleButton.Checked) { gender = MaleButton.Text; } if (FemaleButton.Checked) { gender = FemaleButton.Text; } //this.Hide(); //Home ss = new Home(); // ss.Show(); //check field empty or not if (string.IsNullOrEmpty(NameTextBox.Text) == true) { MessageBox.Show("Please enter First Name"); NameTextBox.Focus(); } else if (string.IsNullOrEmpty(LastNameTextBox.Text) == true) { MessageBox.Show("Please enter Last Name"); LastNameTextBox.Focus(); } else if (string.IsNullOrEmpty(EmailTextBox.Text) == true) { MessageBox.Show("Please enter Email"); EmailTextBox.Focus(); } else if (Regex.IsMatch(EmailTextBox.Text, emailValStr) == false) { MessageBox.Show("Invalid email!!"); EmailTextBox.Focus(); } else if (string.IsNullOrEmpty(StudentIDTextBox.Text) == true) { MessageBox.Show("Please enter your ID"); StudentIDTextBox.Focus(); } else if (string.IsNullOrEmpty(PhoneText.Text) == true) { MessageBox.Show("Please enter Phone Number"); PhoneText.Focus(); } else if (phoneNumber != 11) { MessageBox.Show("Please enter valid phone number"); PhoneText.Focus(); } else if (string.IsNullOrEmpty(gender) == true) { MessageBox.Show("Please select gender"); ConfirmPassword.Focus(); } else if (string.IsNullOrEmpty(PasswordText.Text) == true) { MessageBox.Show("Please type Password"); PasswordText.Focus(); } else if (passLength <= 8) { MessageBox.Show(Convert.ToString(passLength)); MessageBox.Show("Your password should contain minimum 8 characters or numbers"); PasswordText.Focus(); } else if (string.IsNullOrEmpty(ConfirmPassword.Text) == true) { MessageBox.Show("Please type Password again"); ConfirmPassword.Focus(); } else if (PasswordText.Text != ConfirmPassword.Text) { MessageBox.Show("You typed the wrond password"); PasswordText.Focus(); } else { // conn.ConnectionString = @"Data Source=LAPTOP-UDPCMQEF;Initial Catalog=LibraryManagementSystem;Integrated Security=True"; // conn.Open(); SqlCommand cmd = new SqlCommand("insert into Person" + "(first_name,last_name,password,email,student_id,gender,contact_no) values (@first_name,@last_name,aes_encrypt(@password, 'key'),@email,@student_id,@gender,@contact_no)", connDB.getConn()); cmd.Parameters.AddWithValue("@first_name", NameTextBox.Text); cmd.Parameters.AddWithValue("@last_name", LastNameTextBox.Text); cmd.Parameters.AddWithValue("@email", EmailTextBox.Text); cmd.Parameters.AddWithValue("@student_id", StudentIDTextBox.Text); cmd.Parameters.AddWithValue("@gender", gender); cmd.Parameters.AddWithValue("@contact_no", PhoneText.Text); cmd.Parameters.AddWithValue("@password", password); cmd.ExecuteNonQuery(); MessageBox.Show("You are registered now"); } }
private string TextBoxValidation() { string errorMessage = string.Empty; if (FirstNameTextBox.Text.Length > 0 && FirstNameTextBox.Text != null) { this.FirstName = FirstNameTextBox.Text; } else { errorMessage = "Invalid entry for first name. Please enter a valid first name"; FirstNameTextBox.Focus(); } if (MiddleNameTextBox.Text != null) { this.MiddleName = MiddleNameTextBox.Text; } else { errorMessage = "Invalid entry for middle name. Please enter a valid middle name"; MiddleNameTextBox.Focus(); } if (LastNameTextBox.Text.Length > 0 && LastNameTextBox.Text != null) { this.LastName = LastNameTextBox.Text; } else { errorMessage = "Invalid entry for last name. Please enter a valid last name"; LastNameTextBox.Focus(); } if (CityTextBox.Text.Length > 0 && CityTextBox.Text != null) { this.City = CityTextBox.Text; } else { errorMessage = "Invalid entry for city. Please enter a valid city"; CityTextBox.Focus(); } if (StateTextBox.Text.Length > 0 && StateTextBox.Text != null) { this.State = StateTextBox.Text; } else { errorMessage = "Invalid entry for state. Please enter a valid state"; StateTextBox.Focus(); } if (CountryTextBox.Text.Length > 0 && CountryTextBox.Text != null) { this.Country = CountryTextBox.Text; } else { errorMessage = "Invalid entry for Country. Please enter a valid country"; CountryTextBox.Focus(); } if (PhoneNumberTextBox.Text.Length > 0 && PhoneNumberTextBox.Text != null) { this.PhoneNumber = PhoneNumberTextBox.Text; } else { errorMessage = "Invalid entry for phone number. Please enter a valid phone number"; PhoneNumberTextBox.Focus(); } if (EmailAddressTextBox.Text.Length > 0 && EmailAddressTextBox.Text != null) { this.EmailAddress = EmailAddressTextBox.Text; } else { errorMessage = "Invalid entry for email address. Please enter a valid email address"; EmailAddressTextBox.Focus(); } return(errorMessage); }
private void button2_Click(object sender, EventArgs e) //add guest { if ((myState == FormState.Add) || ((myState == FormState.WhileBooking) && button2.Text == "Add Guest") || (myState == FormState.Edit)) { Regex validateEmail = new Regex(@"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$"); //https://msdn.microsoft.com/en-us/library/01escwtf(v=vs.110).aspx Regex testForNonNumeric = new Regex(@"\D"); Regex testForLetters = new Regex(@"^[a-zA-Z ]+$"); // @"^[a-zA-Z ]+$" for space character if (FirstNameTextBox.Text == "") { MessageBox.Show("Please Enter First Name", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //https://msdn.microsoft.com/en-us/library/system.windows.forms.messageboxicon(v=vs.110).aspx FirstNameTextBox.Focus(); //focuses on text box with error return; } else if (LastNameTextBox.Text == "") { MessageBox.Show("Please Enter Last Name", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); LastNameTextBox.Focus(); return; } else if (TelephoneTextBox.Text == "") { MessageBox.Show("Please Enter Your Telephone Number", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); TelephoneTextBox.Focus(); return; } else if (TelephoneTextBox.TextLength < 10) { MessageBox.Show("Telephone number must contains 10 digits", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); TelephoneTextBox.Focus(); return; } else if (TelephoneTextBox.TextLength > 10) { MessageBox.Show("Telephone number must contains 10 digits", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); TelephoneTextBox.Focus(); return; } else if (testForNonNumeric.IsMatch(TelephoneTextBox.Text)) { MessageBox.Show("Telephone number must contain digits only", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); TelephoneTextBox.Focus(); return; } else if (EmailTextBox.Text == "") { MessageBox.Show("Please Enter An Email Address", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); EmailTextBox.Focus(); return; } else if (!validateEmail.IsMatch(EmailTextBox.Text)) { MessageBox.Show("Invalid Email Address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); EmailTextBox.Focus(); return; } else { //go to next form if (myState == FormState.Add) { guest = PopulateObject(); guestController.ADD(guest); MessageBox.Show("Guest successfully added", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearAll(); this.Hide(); } if (myState == FormState.WhileBooking) { guest = PopulateObject(); aBooking.DepositPaid = "false"; aBooking.GuestID = guest.GuestID; bookingController.ADD(aBooking); guestController.ADD(guest); MessageBox.Show("Guest successfully added and booking successfully made", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information); //would they like to pay now DialogResult result = MessageBox.Show("Would you like to pay now", "Pay now?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { PaymentDetailsForm paymentDetailsForm = new PaymentDetailsForm(paymentController, aBooking, guest, bookingController); paymentDetailsForm.MdiParent = (Home)this.MdiParent; // Setting the MDI Parent paymentDetailsForm.StartPosition = FormStartPosition.CenterParent; this.Hide(); paymentDetailsForm.Show(); } else { //go straight to the email ConfirmationForm cf = new ConfirmationForm(guest, aBooking); cf.StartPosition = FormStartPosition.CenterParent; cf.Show(); this.Hide(); } ClearAll(); } if (myState == FormState.Edit) { Guest g = new Guest(); g.GuestID = textBox1.Text; g.FirstName = FirstNameTextBox.Text; g.Surname = LastNameTextBox.Text; g.TelephoneNumber = TelephoneTextBox.Text; g.EmailAddress = EmailTextBox.Text; DialogResult result = MessageBox.Show("Are you sure you want to edit guest", "Edit Guest", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); //populate the text boxes if (result == DialogResult.Yes) { //we must delete the guest tell them guest has been successfully deleted guestController.Edit(g); MessageBox.Show("Guest successfully editted", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearAll(); this.Hide(); } else { //reset the controls showRequiredFields(FormState.Edit); } } } } else if (((myState == FormState.WhileBooking) && (button2.Text == "Verify Guest")) || (myState == FormState.Delete)) { if (GuestIDTextBox.Text == "") { MessageBox.Show("Please Enter A Guest ID to search for", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); GuestIDTextBox.Focus(); return; } else if (guestController.FindByGuestID(GuestIDTextBox.Text) == null) { MessageBox.Show("Guest not found", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); GuestIDTextBox.Focus(); return; } else { Guest temp = guestController.FindByGuestID(GuestIDTextBox.Text); FirstNameTextBox.Text = temp.FirstName; LastNameTextBox.Text = temp.Surname; TelephoneTextBox.Text = temp.TelephoneNumber; EmailTextBox.Text = temp.EmailAddress; GuestIDTextBox.Text = temp.GuestID; if (myState == FormState.WhileBooking) { MessageBox.Show("Guest has been verified", "Verified", MessageBoxButtons.OK, MessageBoxIcon.Information); //add the booking aBooking.GuestID = temp.GuestID; aBooking.DepositPaid = "false"; bookingController.ADD(aBooking); MessageBox.Show("Booking has been successfully made", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); //populate the text boxes DialogResult result = MessageBox.Show("Would you like to pay now", "Pay now?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { PaymentDetailsForm paymentDetailsForm = new PaymentDetailsForm(paymentController, aBooking, temp, bookingController); paymentDetailsForm.MdiParent = (Home)this.MdiParent; // Setting the MDI Parent paymentDetailsForm.StartPosition = FormStartPosition.CenterParent; this.Hide(); paymentDetailsForm.Show(); } else { //go straight to the email ConfirmationForm cf = new ConfirmationForm(temp, aBooking); cf.StartPosition = FormStartPosition.CenterParent; cf.Show(); this.Hide(); } } if (myState == FormState.Delete) { DialogResult result = MessageBox.Show("Are you sure you want to delete guest", "Delete guest", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); //populate the text boxes if (result == DialogResult.Yes) { //we must delete the guest tell them guest has been successfully deleted guestController.Delete(temp); MessageBox.Show("Guest has been deleted", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); } else { //reset the controls showRequiredFields(FormState.Delete); } } } } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { string letterList = "ABCDEFGHIJKLMNOPRSTUVWXYZabcdefghijklmnoprstuvwxyzАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя"; string numList = "1234567890"; if (!String.IsNullOrWhiteSpace(LastNameTextBox.Text) && !String.IsNullOrWhiteSpace(FirstNameTextBox.Text) && !String.IsNullOrWhiteSpace(MiddleNameTextBox.Text) && !String.IsNullOrWhiteSpace(PhoneNumberTextBox.Text) && !String.IsNullOrWhiteSpace(PassportTextBox.Text) && !String.IsNullOrWhiteSpace(IssuedByWhomTextBox.Text) && !String.IsNullOrWhiteSpace(AreaTextBox.Text) && !String.IsNullOrWhiteSpace(CityTextBox.Text) && !String.IsNullOrWhiteSpace(StreetTextBox.Text) && !String.IsNullOrWhiteSpace(HouseTextBox.Text) && DateOfBirthDatePicker.SelectedDate != null && GroupComboBox.SelectedItem != null && EducationComboBox.SelectedItem != null && DateOfIssueDatePicker.SelectedDate != null && BasicOfLearningComboBox.SelectedItem != null) { if (LastNameTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (FirstNameTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (MiddleNameTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (PhoneNumberTextBox.Text.Length == 18 && (PhoneNumberTextBox.Text.IndexOfAny(letterList.ToCharArray()) <= -1) && !PhoneNumberTextBox.Text.Contains('_')) { if (AreaTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (CityTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (DateOfBirthDatePicker.SelectedDate < DateTime.Today) { if (!PassportTextBox.Text.Contains('_')) { if (DateOfIssueDatePicker.SelectedDate < DateTime.Today) { if (CurrentStudent == null) { //if (AppData.Context.Passport.Where(c => c.Serial == PassportTextBox.Text.Remove(5, 7) && c.Number == PassportTextBox.Text.Remove(0, 6)).FirstOrDefault() == null) //{ CurrentPassport = new Passport() { Serial = PassportTextBox.Text.Remove(5, 7).Replace(" ", ""), Number = PassportTextBox.Text.Remove(0, 6), DateOfIssue = DateOfIssueDatePicker.SelectedDate, IssuedByWhom = IssuedByWhomTextBox.Text, }; AppData.Context.Passport.Add(CurrentPassport); CurrentAddress = new Address() { Region = AreaTextBox.Text, City = CityTextBox.Text, Street = StreetTextBox.Text, House = HouseTextBox.Text, Apartment = ApartmentTextBox.Text, }; AppData.Context.Address.Add(CurrentAddress); CurrentStudent = new Student() { LastName = LastNameTextBox.Text, FirstName = FirstNameTextBox.Text, MiddleName = MiddleNameTextBox.Text, PhoneNumber = PhoneNumberTextBox.Text, DateOfBirth = DateOfBirthDatePicker.SelectedDate, Group = GroupComboBox.SelectedItem as Group, Education = EducationComboBox.SelectedItem as Education, IdPassport = CurrentPassport.Id, IdAddress = CurrentAddress.Id, BasicOfLearning = BasicOfLearningComboBox.SelectedItem as BasicOfLearning, }; AppData.Context.Student.Add(CurrentStudent); AppData.Context.SaveChanges(); MessageBox.Show("Обучающийся успешно добавлен!", "Внимание", MessageBoxButton.OK, MessageBoxImage.Information); NavigationService.GoBack(); } } else { CurrentStudent.LastName = LastNameTextBox.Text; CurrentStudent.FirstName = FirstNameTextBox.Text; CurrentStudent.MiddleName = MiddleNameTextBox.Text; CurrentStudent.PhoneNumber = PhoneNumberTextBox.Text; CurrentStudent.DateOfBirth = DateOfBirthDatePicker.SelectedDate; CurrentGroup = GroupComboBox.SelectedItem as Group; CurrentBasicOfLearning = BasicOfLearningComboBox.SelectedItem as BasicOfLearning; CurrentEducation = EducationComboBox.SelectedItem as Education; CurrentPassport.Serial = PassportTextBox.Text.Remove(5, 7).Replace(" ", ""); CurrentPassport.Number = PassportTextBox.Text.Remove(0, 6); CurrentPassport.DateOfIssue = DateOfIssueDatePicker.SelectedDate; CurrentPassport.IssuedByWhom = IssuedByWhomTextBox.Text; CurrentAddress.Region = AreaTextBox.Text; CurrentAddress.City = CityTextBox.Text; CurrentAddress.Street = StreetTextBox.Text; CurrentAddress.House = HouseTextBox.Text; CurrentAddress.Apartment = ApartmentTextBox.Text; AppData.Context.SaveChanges(); MessageBox.Show("Информация обновлена!", "Внимание", MessageBoxButton.OK, MessageBoxImage.Information); NavigationService.GoBack(); } } else { MessageBox.Show("Дата выдачи паспорта указаны некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); DateOfIssueDatePicker.Focus(); } //} //else //{ // MessageBox.Show("Серия и номер паспорта указаны некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); // PassportTextBox.Focus(); //} } else { MessageBox.Show("Дата рождения указана некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); DateOfBirthDatePicker.Focus(); } } else { MessageBox.Show("Город указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); CityTextBox.Focus(); } } else { MessageBox.Show("Область указана некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); AreaTextBox.Focus(); } } else { MessageBox.Show("Номер телефона указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); LastNameTextBox.Focus(); } } else { MessageBox.Show("Отчество указано некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); MiddleNameTextBox.Focus(); } } else { MessageBox.Show("Имя указано некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); FirstNameTextBox.Focus(); } } else { MessageBox.Show("Фамилия указана некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); LastNameTextBox.Focus(); } } else { MessageBox.Show("Не все поля заполнены!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } }
protected void Button1_Click(object sender, EventArgs e) { DateTime currentDate; currentDate = DateTime.Now; DateLabel.Text = currentDate.ToShortDateString(); DateTime currentTime; currentTime = DateTime.Now; TimeLabel.Text = currentTime.ToShortTimeString(); OutputLabel.Text = string.Empty; if (FirstNameTextBox.Text == string.Empty) { OutputLabel.Text = "Must enter a first name"; FirstNameTextBox.Focus(); return; } if (LastNameTextBox.Text == string.Empty) { OutputLabel.Text = "Must enter a last name"; LastNameTextBox.Focus(); return; } if (AreaCodeTextBox.Text == string.Empty) { OutputLabel.Text = "Must enter an area code"; AreaCodeTextBox.Focus(); return; } if (AreaCodeTextBox.Text.Length < 3) { OutputLabel.Text = "Area code must be 3 digits"; AreaCodeTextBox.Text = string.Empty; AreaCodeTextBox.Focus(); return; } Int32 AreaCodeEnterednumber; if (!Int32.TryParse(AreaCodeTextBox.Text, out AreaCodeEnterednumber)) { OutputLabel.Text = "Area code must be 3 digits"; AreaCodeTextBox.Text = string.Empty; return; } if (ExchangeTextBox.Text == string.Empty) { OutputLabel.Text = "Must enter an exchange"; ExchangeTextBox.Focus(); return; } if (ExchangeTextBox.Text.Length < 3) { OutputLabel.Text = "Exchange must be 3 digits"; ExchangeTextBox.Text = string.Empty; ExchangeTextBox.Focus(); return; } Int32 ExchangeEnterednumber; if (!Int32.TryParse(ExchangeTextBox.Text, out ExchangeEnterednumber)) { OutputLabel.Text = "Exchange must be 3 digits"; ExchangeTextBox.Text = string.Empty; ExchangeTextBox.Focus(); return; } if (NumberTextBox.Text == string.Empty) { OutputLabel.Text = "Must enter number"; NumberTextBox.Focus(); return; } if (NumberTextBox.Text.Length < 4) { OutputLabel.Text = "Number must be 4 digits"; NumberTextBox.Text = string.Empty; NumberTextBox.Focus(); return; } Int32 NumberEnterednumber; if (!Int32.TryParse(NumberTextBox.Text, out NumberEnterednumber)) { OutputLabel.Text = "Number must be 4 digits"; NumberTextBox.Text = string.Empty; NumberTextBox.Focus(); return; } if (EmailTextBox.Text.Length < 5) { OutputLabel.Text = "Must be at least 5 characters"; return; } if (!EmailTextBox.Text.Contains("@")) { OutputLabel.Text = "Must contain @"; return; } if (EmailTextBox.Text.Substring(0, 1) == "@" || EmailTextBox.Text.Substring(EmailTextBox.Text.Length - 2, 1) == "@" || EmailTextBox.Text.Substring(EmailTextBox.Text.Length - 1, 1) == "@") { OutputLabel.Text = "@ Character may not be the 1st character nor one of the last 2"; return; } if (EmailTextBox.Text.Substring(2, 1) == "." || EmailTextBox.Text.Substring(EmailTextBox.Text.Length - 1, 1) == ".") { } }
// save button clicked private void SaveButton_Click(object sender, EventArgs e) { if (FirstNameTextBox.Text == "" || FirstNameTextBox.ForeColor == Color.Red) { MessageBox.Show("Make sure you filled out <First Name> field and entered only letters (a-z, A-Z)", "Invalid Input Provided", MessageBoxButtons.OK, MessageBoxIcon.Error); FirstNameTextBox.Focus(); } else if (LastNameTextBox.Text == "" || LastNameTextBox.ForeColor == Color.Red) { MessageBox.Show("Make sure you filled out <Last Name> field and entered only letters (a-z, A-Z)", "Invalid Input Provided", MessageBoxButtons.OK, MessageBoxIcon.Error); LastNameTextBox.Focus(); } else if (PhoneTextBox.Text == "" || PhoneTextBox.ForeColor == Color.Red) { MessageBox.Show("Make sure you filled out <Phone Number> field and input is in correct format (XXXXXXXXXX or XXX XXX XXXX or XXX-XXX-XXXX)", "Invalid Input Provided", MessageBoxButtons.OK, MessageBoxIcon.Error); PhoneTextBox.Focus(); } else if (EmailTextBox.Text == "" || EmailTextBox.ForeColor == Color.Red) { MessageBox.Show("Make sure you filled out <Email> field and provided valid Email", "Invalid Input Provided", MessageBoxButtons.OK, MessageBoxIcon.Error); EmailTextBox.Focus(); } else if (CityTextBox.Text == "" || CityTextBox.ForeColor == Color.Red) { MessageBox.Show("Make sure you filled out <City> field and provided valid input", "Invalid Input Provided", MessageBoxButtons.OK, MessageBoxIcon.Error); CityTextBox.Focus(); } else if (StateTextBox.Text == "" || StateTextBox.ForeColor == Color.Red) { MessageBox.Show("Make sure you filled out <State> field and provided valid input", "Invalid Input Provided", MessageBoxButtons.OK, MessageBoxIcon.Error); StateTextBox.Focus(); } else if (ZipTextBox.Text == "" || ZipTextBox.ForeColor == Color.Red) { MessageBox.Show("Make sure you filled out <Zip> field and input is in valid format (XXXXX)", "Invalid Input Provided", MessageBoxButtons.OK, MessageBoxIcon.Error); ZipTextBox.Focus(); } else if (AddressTextBox.Text == "" || AddressTextBox.ForeColor == Color.Red) { MessageBox.Show("Make sure you filled out <Address> field and provided valid input", "Invalid Input Provided", MessageBoxButtons.OK, MessageBoxIcon.Error); AddressTextBox.Focus(); } else { string cmdText = "select count(*) from Customers where FirstName = @firstName and LastName = @lastName and Email = @email and Phone = @phone and Address = @address and City = @city and State = @state and Zip = @zip"; scmd = new SqlCommand(cmdText, connection); connection.Open(); scmd.Parameters.AddWithValue("@firstName", FirstNameTextBox.Text); scmd.Parameters.AddWithValue("@lastName", LastNameTextBox.Text); scmd.Parameters.AddWithValue("@email", EmailTextBox.Text); scmd.Parameters.AddWithValue("@phone", PhoneTextBox.Text); scmd.Parameters.AddWithValue("@address", AddressTextBox.Text); scmd.Parameters.AddWithValue("@city", CityTextBox.Text); scmd.Parameters.AddWithValue("@state", StateTextBox.Text); scmd.Parameters.AddWithValue("@zip", ZipTextBox.Text); int exists = (int)scmd.ExecuteScalar(); // check if entered isnb is unique connection.Close(); // if user clicks new customer button, add new customer mode is on if (addNewCustomerMode) { if (exists > 0) { MessageBox.Show("Customer Already Exists", "Addition of existing Customer", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DialogResult save = MessageBox.Show("Do you want to save the Customer?", "Add New Customer", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (save == DialogResult.Yes) { scmd = new SqlCommand("SET IDENTITY_INSERT Customers OFF; insert into Customers(FirstName, LastName, Email, Phone, Address, City, State, Zip) Values(@firstName, @lastName, @email, @phone, @address, @city, @state, @zip)", connection); connection.Open(); scmd.Parameters.AddWithValue("@firstName", FirstNameTextBox.Text); scmd.Parameters.AddWithValue("@lastName", LastNameTextBox.Text); scmd.Parameters.AddWithValue("@email", EmailTextBox.Text); scmd.Parameters.AddWithValue("@phone", PhoneTextBox.Text); scmd.Parameters.AddWithValue("@address", AddressTextBox.Text); scmd.Parameters.AddWithValue("@state", CityTextBox.Text); scmd.Parameters.AddWithValue("@city", CityTextBox.Text); scmd.Parameters.AddWithValue("@zip", ZipTextBox.Text); scmd.ExecuteNonQuery(); connection.Close(); MessageBox.Show("The Customer Was Added Successfully."); DisplayCustomers(); // refresh combobox values ResetAll(); CustomerComboBox.Enabled = true; } } } // if user chooses customer from combobox, update customer mode is on if (updateCustomerMode) { if (exists > 0) { MessageBox.Show("You haven't modified anything.", "Nothing to update", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DialogResult save = MessageBox.Show("Do you want to update the Customer?", "Update Existing Customer", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (save == DialogResult.Yes) { cmdText = "update Customers set FirstName = @firstName, LastName = @lastName, Email = @email, Phone = @phone, Address = @address, City = @city, State = @state, Zip = @zip where ID = @customerID"; scmd = new SqlCommand(cmdText, connection); connection.Open(); scmd.Parameters.AddWithValue("@customerID", customerID); scmd.Parameters.AddWithValue("@firstName", FirstNameTextBox.Text); scmd.Parameters.AddWithValue("@lastName", LastNameTextBox.Text); scmd.Parameters.AddWithValue("@email", EmailTextBox.Text); scmd.Parameters.AddWithValue("@phone", PhoneTextBox.Text); scmd.Parameters.AddWithValue("@address", AddressTextBox.Text); scmd.Parameters.AddWithValue("@city", CityTextBox.Text); scmd.Parameters.AddWithValue("@state", StateTextBox.Text); scmd.Parameters.AddWithValue("@zip", ZipTextBox.Text); scmd.ExecuteNonQuery(); connection.Close(); MessageBox.Show("The Customer Was Updated Successfully."); DisplayCustomers(); // refresh combobox values ResetAll(); } } } } }
protected void Page_Load(object sender, EventArgs e) { LastNameTextBox.Focus(); }
void EditAuthorInfoFormShown(object sender, EventArgs e) { LastNameTextBox.Focus(); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { string letterList = "ABCDEFGHIJKLMNOPRSTUVWXYZabcdefghijklmnoprstuvwxyzАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя"; string numList = "1234567890"; if (!String.IsNullOrWhiteSpace(NameTextBox.Text) && !String.IsNullOrWhiteSpace(PhoneNumberTextBox.Text) && !String.IsNullOrWhiteSpace(InnTextBox.Text) && !String.IsNullOrWhiteSpace(OgrnTextBox.Text) && !String.IsNullOrWhiteSpace(KPPTextBox.Text) && !String.IsNullOrWhiteSpace(LastNameTextBox.Text) && !String.IsNullOrWhiteSpace(FirstNameTextBox.Text) && !String.IsNullOrWhiteSpace(MiddleNameTextBox.Text) && !String.IsNullOrWhiteSpace(AreaTextBox.Text) && !String.IsNullOrWhiteSpace(CityTextBox.Text) && !String.IsNullOrWhiteSpace(StreetTextBox.Text) && !String.IsNullOrWhiteSpace(HouseTextBox.Text) && !String.IsNullOrWhiteSpace(BankNameTextBox.Text) && !String.IsNullOrWhiteSpace(PaymentAccountTextBox.Text) && !String.IsNullOrWhiteSpace(CorrespondentAccountTextBox.Text) && !String.IsNullOrWhiteSpace(BIKTextBox.Text)) { if (LastNameTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (FirstNameTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (MiddleNameTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (PhoneNumberTextBox.Text.Length == 18 && (PhoneNumberTextBox.Text.IndexOfAny(letterList.ToCharArray()) <= -1) && !PhoneNumberTextBox.Text.Contains('_')) { if (AreaTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (CityTextBox.Text.IndexOfAny(numList.ToCharArray()) <= -1) { if (!InnTextBox.Text.Contains('_')) { if (!OgrnTextBox.Text.Contains('_')) { if (!KPPTextBox.Text.Contains('_')) { if (!PaymentAccountTextBox.Text.Contains('_')) { if (!CorrespondentAccountTextBox.Text.Contains('_')) { if (!BIKTextBox.Text.Contains('_')) { if (CurrentOrganization == null) { if (AppData.Context.Organization.Where(c => c.Name == NameTextBox.Text).FirstOrDefault() == null) { Address CurrentAddress = new Address() { Region = AreaTextBox.Text, City = CityTextBox.Text, Street = StreetTextBox.Text, House = HouseTextBox.Text, }; AppData.Context.Address.Add(CurrentAddress); BankDetail CurrentBankDetail = new BankDetail() { BankName = BankNameTextBox.Text, PaymentAccount = PaymentAccountTextBox.Text, CorrespondentAccount = CorrespondentAccountTextBox.Text, BIK = BIKTextBox.Text, }; AppData.Context.BankDetail.Add(CurrentBankDetail); CurrentOrganization = new Organization() { Name = NameTextBox.Text, IdAddress = CurrentAddress.Id, OGRN = OgrnTextBox.Text, INN = InnTextBox.Text, KPP = KPPTextBox.Text, IdBankDetail = CurrentBankDetail.Id, PhoneNumber = PhoneNumberTextBox.Text, LastName = LastNameTextBox.Text, FirstName = FirstNameTextBox.Text, MiddleName = MiddleNameTextBox.Text, }; AppData.Context.Organization.Add(CurrentOrganization); AppData.Context.SaveChanges(); MessageBox.Show("Организация успешно добавлена!", "Внимание", MessageBoxButton.OK, MessageBoxImage.Information); NavigationService.GoBack(); } else { MessageBox.Show("Организация с таким названием уже существует!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); NameTextBox.Focus(); } } else { CurrentOrganization.Name = NameTextBox.Text; CurrentOrganization.OGRN = OgrnTextBox.Text; CurrentOrganization.INN = InnTextBox.Text; CurrentOrganization.KPP = KPPTextBox.Text; CurrentOrganization.PhoneNumber = PhoneNumberTextBox.Text; CurrentOrganization.LastName = LastNameTextBox.Text; CurrentOrganization.FirstName = FirstNameTextBox.Text; CurrentOrganization.MiddleName = MiddleNameTextBox.Text; CurrentAddress.Region = AreaTextBox.Text; CurrentAddress.City = CityTextBox.Text; CurrentAddress.Street = StreetTextBox.Text; CurrentAddress.House = HouseTextBox.Text; CurrentBankDetail.BankName = BankNameTextBox.Text; CurrentBankDetail.PaymentAccount = PaymentAccountTextBox.Text; CurrentBankDetail.CorrespondentAccount = CorrespondentAccountTextBox.Text; CurrentBankDetail.BIK = BIKTextBox.Text; AppData.Context.SaveChanges(); MessageBox.Show("Информация обновлена!", "Внимание", MessageBoxButton.OK, MessageBoxImage.Information); NavigationService.GoBack(); } } else { MessageBox.Show("БИК указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); BIKTextBox.Focus(); } } else { MessageBox.Show("Корреспондентский счёт указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); CorrespondentAccountTextBox.Focus(); } } else { MessageBox.Show("Расчётный счёт указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); PaymentAccountTextBox.Focus(); } } else { MessageBox.Show("КПП указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); KPPTextBox.Focus(); } } else { MessageBox.Show("ОГРН указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); OgrnTextBox.Focus(); } } else { MessageBox.Show("ИНН указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); InnTextBox.Focus(); } } else { MessageBox.Show("Город указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); CityTextBox.Focus(); } } else { MessageBox.Show("Область указана некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); AreaTextBox.Focus(); } } else { MessageBox.Show("Номер телефона указан некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); PhoneNumberTextBox.Focus(); } } else { MessageBox.Show("Отчество указано некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); MiddleNameTextBox.Focus(); } } else { MessageBox.Show("Имя указано некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); FirstNameTextBox.Focus(); } } else { MessageBox.Show("Фамилия указана некорректно!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); LastNameTextBox.Focus(); } } else { MessageBox.Show("Не все поля заполнены!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } }