//public void RemoveClick(object sender, RoutedEventArgs e) //{ // try // { // myBL.RemoveGuestRequest(guest); // MessageBox.Show("Your request was successfuly removed", "", MessageBoxButton.OK, MessageBoxImage.Information); // } // catch(System.Exception exp) // { // MessageBox.Show("There was a problem removeing your request", "", MessageBoxButton.OK, MessageBoxImage.Error); // } //} public void AddNewRequestButton(object sender, RoutedEventArgs e) { AddRequestOldUser window = new AddRequestOldUser(guest); window.ShowDialog(); Close(); AddRequestOldUserMainWindow window1 = new AddRequestOldUserMainWindow(guest); window1.ShowDialog(); }
private void ButtonClick(object sender, RoutedEventArgs e) { try { if (errorMessages.Any()) { string err = "Exception: "; foreach (var item in errorMessages) { err += item + "\n"; } MessageBox.Show(err); return; } int number; if (!int.TryParse(adultsTextBox.Text, out number) || !int.TryParse(childrenTextBox.Text, out number)) { MessageBox.Show("Please check you entered an invalid input", "warning", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (familyNameTextBox.Text == "" || privateNameTextBox.Text == "" || mailAddressTextBox.Text == "" || mailAddressTextBox.Text == "" || entryDateDatePicker.Text == "1/1/0001" || releaseDateDatePicker.Text == "1/1/0001" || adultsTextBox.Text == "" || childrenTextBox.Text == "") { MessageBox.Show($"Missing information", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } guest.Adults = int.Parse(adultsTextBox.Text); guest.amount = int.Parse(amountOfVacationDaysTextBlock.Text); guest.amountOFPeople = int.Parse(adultsTextBox.Text + childrenTextBox.Text); guest.Area = (BE.Enum.Area)System.Enum.Parse(typeof(BE.Enum.Area), areaComboBox.Text, true); guest.Children = int.Parse(childrenTextBox.Text); guest.ChildrensAttractions = (BE.Enum.ChildrensAttractions)System.Enum.Parse(typeof(BE.Enum.ChildrensAttractions), childrensAttractionsComboBox.Text, true); guest.EntryDate = DateTime.Parse(entryDateDatePicker.Text); guest.FamilyName = familyNameTextBox.Text; guest.Garden = (BE.Enum.Garden)System.Enum.Parse(typeof(BE.Enum.Garden), gardenComboBox.Text, true); guest.Jacuzzi = (BE.Enum.Jacuzzi)System.Enum.Parse(typeof(BE.Enum.Jacuzzi), jacuzziComboBox.Text, true); guest.MailAddress = mailAddressTextBox.Text; guest.Pool = (BE.Enum.Pool)System.Enum.Parse(typeof(BE.Enum.Pool), poolComboBox.Text, true); guest.PrivateName = privateNameTextBox.Text; guest.RegistrationDate = DateTime.Now; guest.ReleaseDate = DateTime.Parse(releaseDateDatePicker.Text); guest.Spooky = (BE.Enum.Spooky)System.Enum.Parse(typeof(BE.Enum.Spooky), spookyComboBox.Text, true); guest.Status = BE.Enum.CustomerOrderStatus.Open; guest.Type = (BE.Enum.ResortType)System.Enum.Parse(typeof(BE.Enum.ResortType), typeComboBox.Text, true); myBL.AddGuestRequest(guest); MessageBox.Show($"The order was added to the system, If there is a suitable unit you will receive an email", "", MessageBoxButton.OK, MessageBoxImage.Information); Close(); //AddRequestOldUser window = new AddRequestOldUser(guest); //window.ShowDialog(); //familyNameTextBox.Text = ""; //privateNameTextBox.Text = ""; //mailAddressTextBox.Text = ""; entryDateDatePicker.Text = "1/1/2020"; releaseDateDatePicker.Text = "1/2/2020"; adultsTextBox.Text = ""; childrenTextBox.Text = ""; gardenComboBox.Text = null; jacuzziComboBox.Text = null; poolComboBox.Text = null; spookyComboBox.Text = null; typeComboBox.Text = null; childrensAttractionsComboBox.Text = null; areaComboBox.Text = null; this.amountOfVacationDaysTextBlock.Text = "0"; guest = new BE.GuestRequest(); this.addGuestRequest.DataContext = guest; } catch (System.Exception exp) { MessageBox.Show(exp.Message, "", MessageBoxButton.OK, MessageBoxImage.Error); return; } Close(); AddRequestOldUser w = new AddRequestOldUser(guest); w.Show(); }