private void Addbutton_Click(object sender, RoutedEventArgs e) { hostingUnit.Owner = host; hostingUnit.VacationProperties = vacProp; try { bl.AddHostingUnit(hostingUnit); MessageBox.Show(hostingUnit.HostingUnitName + " was added successfuly."); hostingUnit = new HostingUnit(); NewUnitGrid.DataContext = hostingUnit; vacProp = new VacationProperties(); VcationPropertiesGrid.DataContext = vacProp; } catch (BlArgumentNullException) { MessageBox.Show("There was a problem. Please try again later.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error); } catch (BlNoVacationeersException) { MessageBox.Show("Please add some vacationeers.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error); } catch (BlPriceLowException) { MessageBox.Show("The price you chose is too low.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error); } catch (BlNameTooShortException) { MessageBox.Show("The Name has to be at least 5 characters.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } catch (BlNameAlreadyExistException) { MessageBox.Show("The Name already exist. Please try another name.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public AddHostingUnitWindow(Host host) { InitializeComponent(); this.host = host; bl = SingletonFactoryBL.GetBL(); errorMessages = new List <string>(); hostingUnit = new HostingUnit(); vacProp = new VacationProperties(); NewUnitGrid.DataContext = hostingUnit; VcationPropertiesGrid.DataContext = vacProp; areaComboBox.ItemsSource = Enum.GetValues(typeof(Area)); typeComboBox.ItemsSource = Enum.GetValues(typeof(BE.VacationType)); }
private bool IsPropertiesFits(VacationProperties HUvP, VacationProperties GRvP) { if (GRvP.Adults > HUvP.Adults) { return(false); } if (GRvP.Area != Area.All) { if (GRvP.Area != HUvP.Area) { return(false); } } if (GRvP.BBQ == Extension.Necessary && HUvP.BBQ == Extension.Unintrested) { return(false); } if (GRvP.ChildernAttractions == Extension.Necessary && HUvP.ChildernAttractions == Extension.Unintrested) { return(false); } if (GRvP.Garden == Extension.Necessary && HUvP.Garden == Extension.Unintrested) { return(false); } if (GRvP.Jacuzzi == Extension.Necessary && HUvP.Jacuzzi == Extension.Unintrested) { return(false); } if (GRvP.NearbyKosherFood == Extension.Necessary && HUvP.NearbyKosherFood == Extension.Unintrested) { return(false); } if (GRvP.NearbyRestaurant == Extension.Necessary && HUvP.NearbyRestaurant == Extension.Unintrested) { return(false); } if (GRvP.NearbySynagogue == Extension.Necessary && HUvP.NearbySynagogue == Extension.Unintrested) { return(false); } if (GRvP.Pool == Extension.Necessary && HUvP.Pool == Extension.Unintrested) { return(false); } if (GRvP.Children > HUvP.Children) { return(false); } if (GRvP.MaxPrice < HUvP.MaxPrice) { return(false); } if (GRvP.Type != VacationType.Undefined) { if (GRvP.Type != HUvP.Type) { return(false); } } return(true); }