private void Button_Click(object sender, RoutedEventArgs e) { try { DataContext = hosting; hosting.adults = Int32.Parse(adults.Text.ToString()); hosting.kids = Int32.Parse(kids.Text.ToString()); hosting.stars = Int32.Parse(stars.Text.ToString()); do { hosting.HostingUnitKey = GetA8digitNumber(); } while (bl.GetHostingUnit(hosting.HostingUnitKey) != null); if (jacuzziOption1.IsChecked == false) { hosting.jaccuzi = false; } else { hosting.jaccuzi = true; } hosting.garden = (gardenOption1.IsChecked == false); hosting.pool = (poolOption1.IsChecked == false); hosting.childrenAttractions = (attractionOption1.IsChecked == false); hosting.HostingUnitName = HostingUnitName.Text; //hosting.Owner.FamilyName = Owner.Text; hosting.subArea = subArea.Text; bl.AddHostingUnit(hosting); MessageBoxResult result = MessageBox.Show("Thank You, your unit has been added. Would you like to add another hosting unit?", "Status", MessageBoxButton.YesNo, MessageBoxImage.Question); switch (result) { case MessageBoxResult.Yes: this.Close(); Window addHostingUnitWindow = new addHostingUnitWindow(); addHostingUnitWindow.Show(); break; case MessageBoxResult.No: this.Close(); break; } this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void addHostingUnit_Click_2(object sender, RoutedEventArgs e) { Window w = new addHostingUnitWindow(); w.Show(); }