public GuestRequestListPage(NavigationService navigationService) { try { InitializeComponent(); m_navigationService = navigationService; List <GuestRequestItemControl> guestRequestItemsControl = new List <GuestRequestItemControl>(); ImpBL bl = ImpBL.Instance; foreach (var item in bl.GetGuestRequestList()) { GuestRequestItemControl gric = new GuestRequestItemControl(navigationService); gric.GuestRequestTextBlock.Content = item.PrivateName + " " + item.FamilyName; gric.GuestRequestKeyLable.Content = "#" + item.GuestRequestKey; guestRequestItemsControl.Add(gric); } HostingUnitListView.ItemsSource = guestRequestItemsControl; } catch (Exception err) { MessageBox.Show(err.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void fullNameSearchTextBox_TextChanged(object sender, TextChangedEventArgs e) { ImpBL bl = ImpBL.Instance; List <GuestRequestItemControl> SubguestRequestItemsControl = new List <GuestRequestItemControl>(); try { foreach (var item in bl.searchByName(fullNameSearchTextBox.Text)) { GuestRequestItemControl sgric = new GuestRequestItemControl(m_navigationService); sgric.GuestRequestTextBlock.Content = item.PrivateName + " " + item.FamilyName; sgric.GuestRequestKeyLable.Content = "#" + item.GuestRequestKey; SubguestRequestItemsControl.Add(sgric); } HostingUnitListView.ItemsSource = SubguestRequestItemsControl; } catch (Exception err) { MessageBox.Show(err.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void AvailableU_Click(object sender, RoutedEventArgs e) { try { if (dateTextBox.Text == "" || dateTextBox.Text == null) { throw new TzimerException("Must enter an wanted dates!"); } DateTime d; bool succes = DateTime.TryParse(dateTextBox.Text, out d); if (!succes) { throw new TzimerException("invalid format"); } if (amountTextBox.Text == "" || amountTextBox.Text == null) { throw new TzimerException("Must enter amount of wanted days!"); } InitializeComponent(); List <HostingUnit> availableUnitItemControl = new List <HostingUnit>(); ImpBL bl = ImpBL.Instance; foreach (var item in bl.GetAllAvilableUnits(d, int.Parse(amountTextBox.Text))) { //AvailableUnitItemControl auic = new AvailableUnitItemControl(); //auic.UnitNameTextBlock.Text = item.HostingUnitName; availableUnitItemControl.Add(item); } AvailableUnitListView.ItemsSource = availableUnitItemControl; } catch (Exception err) { MessageBox.Show(err.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public AddFoodItemModel() { bl = new ImpBL(); }
public SearchUserControlModel() { BL = new ImpBL(); }
public HostingUnitPage(Host owner, HostingUnit hu = null) { InitializeComponent(); m_Owner = owner; m_hostingUnit = hu; try { if (hu != null) { DataContext = hu; //HostinUnitNameTextBox.Text = hu.HostingUnitName; //SubAreaTextBox.Text = hu.SubArea; //HostingUnitKeyLable.Content = "#" + hu.HostingUnitKey; HasChildrenAttractionsCheckBox.IsChecked = hu.ChildrensAttractions; HasGardanCheckBox.IsChecked = hu.Garden; HasPoolCheckBox.IsChecked = hu.Pool; HasJacuzzCheckBox.IsChecked = hu.Jacuzz; AirConditionerCheckBox.IsChecked = hu.AirConditoiner; FreeParkingCheckBox.IsChecked = hu.FreeParking; BreakFastIncludedcheckBox.IsChecked = hu.breakfastIncluded; RoomServiceCheckBox.IsChecked = hu.RoomService; switch (hu.RateStars) { case 1: oneStar.Visibility = Visibility.Visible; break; case 2: oneStar.Visibility = Visibility.Visible; TwoStar.Visibility = Visibility.Visible; break; case 3: oneStar.Visibility = Visibility.Visible; TwoStar.Visibility = Visibility.Visible; ThreeStar.Visibility = Visibility.Visible; break; case 4: oneStar.Visibility = Visibility.Visible; TwoStar.Visibility = Visibility.Visible; ThreeStar.Visibility = Visibility.Visible; FourStar.Visibility = Visibility.Visible; break; case 5: oneStar.Visibility = Visibility.Visible; TwoStar.Visibility = Visibility.Visible; ThreeStar.Visibility = Visibility.Visible; FourStar.Visibility = Visibility.Visible; FiveStar.Visibility = Visibility.Visible; break; default: break; } switch (hu.Area) { case Areas.South: AreaComboBox.SelectedIndex = 3; break; case Areas.North: AreaComboBox.SelectedIndex = 2; break; case Areas.Center: AreaComboBox.SelectedIndex = 1; break; case Areas.Jerusalem: AreaComboBox.SelectedIndex = 0; break; default: break; } switch (hu.Type) { case UnitType.Tzimer: UnitTypeComboBox.SelectedIndex = 0; break; case UnitType.HostingUnit: UnitTypeComboBox.SelectedIndex = 1; break; case UnitType.HotelRoom: UnitTypeComboBox.SelectedIndex = 2; break; case UnitType.Tent: UnitTypeComboBox.SelectedIndex = 3; break; default: break; } m_isEdit = true; ImpBL bl = ImpBL.Instance; foreach (var item in bl.markTakenDatesInMatrix(hu)) { takenDatesCalender.BlackoutDates.Add(new CalendarDateRange(item.Item1, item.Item2)); } } } catch (Exception err) { MessageBox.Show(err.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void SaveBtn_Click(object sender, RoutedEventArgs e) { ImpBL bl = ImpBL.Instance; HostingUnit hu = m_hostingUnit == null ? new HostingUnit() : m_hostingUnit; try { hu.HostingUnitName = HostinUnitNameTextBox.Text; if (hu.HostingUnitName == "") { throw new TzimerException("Must enter a name for the unit!"); } hu.Area = (BE.Areas)AreaComboBox.SelectedIndex; hu.Type = (BE.UnitType)AreaComboBox.SelectedIndex; hu.SubArea = SubAreaTextBox.Text; hu.AirConditoiner = (bool)AirConditionerCheckBox.IsChecked; hu.FreeParking = (bool)FreeParkingCheckBox.IsChecked; hu.breakfastIncluded = (bool)BreakFastIncludedcheckBox.IsChecked; hu.RoomService = (bool)RoomServiceCheckBox.IsChecked; if (hu.SubArea == "") { throw new TzimerException("Must enter a sub area for your unit!"); } switch (AreaComboBox.SelectedIndex) { case 0: hu.Area = Areas.Jerusalem; break; case 1: hu.Area = Areas.Center; break; case 2: hu.Area = Areas.North; break; case 3: hu.Area = Areas.South; break; default: break; } switch (UnitTypeComboBox.SelectedIndex) { case 0: hu.Type = UnitType.Tzimer; break; case 1: hu.Type = UnitType.HostingUnit; break; case 2: hu.Type = UnitType.HotelRoom; break; case 3: hu.Type = UnitType.Tent; break; default: break; } hu.Pool = (bool)HasPoolCheckBox.IsChecked; hu.Jacuzz = (bool)HasJacuzzCheckBox.IsChecked; hu.Garden = (bool)HasGardanCheckBox.IsChecked; hu.ChildrensAttractions = (bool)HasChildrenAttractionsCheckBox.IsChecked; hu.Owner = m_Owner; if (m_isEdit) { int hostingUnitKey = int.Parse(HostingUnitKeyLable.Content.ToString().Substring(1)); hu.HostingUnitKey = hostingUnitKey; bl.UpdateHostingUnit(hu); HostinUnitListPage obj = new HostinUnitListPage(hu.Owner, this.NavigationService); this.NavigationService.Navigate(obj); } else { bl.AddHostingUnit(hu); HostinUnitListPage obj = new HostinUnitListPage(hu.Owner, this.NavigationService); this.NavigationService.Navigate(obj); } } catch (Exception err) { MessageBox.Show(err.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public FoodSearchItemModel() { myBL = new ImpBL(); }
public SearchFoodComboBox() { InitializeComponent(); //LayoutRoot.DataContext = this;/////// BL = new ImpBL(); }
public HostInformationPage(Host owner, HostingUnit hostingUnit = null) { try { getBanks(); m_hostingUnit = hostingUnit; InitializeComponent(); ImpBL bl = ImpBL.Instance; FirstNameTextBox.Text = owner.PrivateName; LastNameTextBox.Text = owner.FamilyName; HostIdTextBox.Text = owner.HostId; int number; bool checknumber = Int32.TryParse(owner.HostId, out number); if (!checknumber) { throw new TzimerException("Id number must not contain letters."); } PhoneNumberTextBox.Text = owner.PhoneNumber; if (owner.PhoneNumber == "" || owner.PhoneNumber == null) { throw new TzimerException("Must enter a phone number!"); } int number2; bool checknumber2 = Int32.TryParse(owner.PhoneNumber, out number2); if (!checknumber) { throw new TzimerException("Phone number must contain only numbers.", "bl"); } EmailTextBox.Text = owner.MailAddress; if (!(owner.MailAddress.Contains("@"))) { throw new TzimerException("E-mail Address format is invaled.Please enter the correct format."); } if (string.IsNullOrEmpty(owner.MailAddress)) { throw new TzimerException("Please enter your e-mail address."); } BankAccountNumberTextBox.Text = owner.BankAccountNumber; if (owner.BankAccountNumber == "" || owner.BankAccountNumber == null) { throw new TzimerException("Must enter a bank account number"); } int number3; bool checknumber3 = Int32.TryParse(owner.PhoneNumber, out number3); if (!checknumber) { throw new TzimerException("Bank account number must contain only numbers."); } collectoinCleearenceCheckBox.IsChecked = owner.CollectionClearance; if (owner.BankBranchDetails != null) { BaranchesListComboBox.SelectedValue = owner.BankBranchDetails.BankName + " - " + owner.BankBranchDetails.BankNumber.ToString(); tostringBox.Text = owner.BankBranchDetails.ToString(); } } catch (Exception err) { MessageBox.Show(err.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public WeekGoalsUserControlModel() { bl = new ImpBL(); }
private void SaveBTN_Click(object sender, RoutedEventArgs e) { try { ImpBL bl = ImpBL.Instance; HostingUnit hu = new HostingUnit(); hu.Owner = new Host(); hu.Owner.PrivateName = FirstNameTextBox.Text; if (hu.Owner.PrivateName == "" || hu.Owner.PrivateName == null) { throw new TzimerException("Must enter a private name!"); } hu.Owner.FamilyName = LastNameTextBox.Text; hu.Owner.HostId = HostIdTextBox.Text; if (hu.Owner.HostId == "" || hu.Owner.HostId == null) { throw new TzimerException("Must enter a Host Id!"); } hu.Owner.FamilyName = LastNameTextBox.Text; if (hu.Owner.FamilyName == null || hu.Owner.FamilyName == "") { throw new TzimerException("Must enter a family name!"); } hu.Owner.PhoneNumber = PhoneNumberTextBox.Text; if (hu.Owner.PhoneNumber == null) { throw new TzimerException("Must enter a Phone number"); } int number; bool checknumber = Int32.TryParse(hu.Owner.PhoneNumber, out number); if (!checknumber) { throw new TzimerException("Phone number must contain only numbers.", "bl"); } hu.Owner.MailAddress = EmailTextBox.Text; if (!(hu.Owner.MailAddress.Contains("@"))) { throw new TzimerException("E-mail Address format is invaled.Please enter the correct format.", "pl"); } if (string.IsNullOrEmpty(hu.Owner.MailAddress)) { throw new TzimerException("Please enter your e-mail address", "pl"); } hu.Owner.BankAccountNumber = BankAccountNumberTextBox.Text; int number2; bool checknumber2 = Int32.TryParse(hu.Owner.BankAccountNumber, out number2); if (!checknumber) { throw new TzimerException("Account number must contain only numbers.", "pl"); } hu.Owner.CollectionClearance = (bool)collectoinCleearenceCheckBox.IsChecked; if (BaranchesListComboBox.SelectedValue == null) { throw new TzimerException("Bank branch must be selected", "pl"); } string branchNumber = BaranchesListComboBox.SelectedValue.ToString().Split('-')[1].Trim(); int branchNum = int.Parse(branchNumber); hu.Owner.BankBranchDetails = branches?.FirstOrDefault(x => x.BranchNumber == branchNum); // if unit is null there is nothing to update if (m_hostingUnit != null) { bl.UpdateHostInfo(hu.Owner, m_hostingUnit.HostingUnitKey); } HostingUnitPage obj = new HostingUnitPage(hu.Owner, m_hostingUnit); this.NavigationService.Navigate(obj); } catch (Exception err) { MessageBox.Show(err.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void SaveBtn_Click(object sender, RoutedEventArgs e) { try { ImpBL bl = ImpBL.Instance; GuestRequest gr = new GuestRequest(); gr.Status = RequestStatus.Open; gr.RegistrationDate = DateTime.Now; if (FromDateCalender.SelectedDates.Count == 0) { throw new TzimerException("Must choose entry date", "pl"); } if (ToDateCalender.SelectedDates.Count == 0) { throw new TzimerException("Must choose leave date", "pl"); } gr.EntryDate = FromDateCalender.SelectedDates[0]; gr.ReleaseDate = ToDateCalender.SelectedDates[0]; if ((gr.ReleaseDate - gr.EntryDate).TotalDays < 1) { throw new TzimerException("Sorry, the dates you chose are invalid, entry must be before leave!", "bl"); } gr.PrivateName = GuestRequestFirstNameTextBox.Text; if (gr.PrivateName == null) { throw new TzimerException("Must enter a Private Name"); } gr.FamilyName = GuestRequestlastNameTextBox.Text; if (gr.FamilyName == null) { throw new TzimerException("Must enter a Family name"); } gr.PhoneNumber = PhoneNumbertTextBox.Text; if (gr.PhoneNumber == null || gr.PhoneNumber == "") { throw new TzimerException("Must enter a Phone number"); } int number; bool checknumber = Int32.TryParse(gr.PhoneNumber, out number); if (!checknumber) { throw new TzimerException("Phone number must contain only numbers.", "bl"); } if (string.IsNullOrEmpty(gr.PhoneNumber)) { throw new TzimerException("Please enter your phone number", "bl"); } gr.MailAddress = EmailTextBox.Text; if (!(gr.MailAddress.Contains("@"))) { throw new TzimerException("E-mail Address format is invaled.Please enter the correct format.", "bl"); } if (string.IsNullOrEmpty(gr.MailAddress)) { throw new TzimerException("Please enter your e-mail address", "bl"); } gr.Adults = AdultsTextBox.Text; if (string.IsNullOrEmpty(gr.Adults)) { throw new TzimerException("Must enter the amount of adults", "bl"); } if (gr.Adults == "0") { throw new TzimerException("Cannot set request with zero adults!", "bl"); } gr.Children = ChildrenTextBox.Text; if (string.IsNullOrEmpty(gr.Children)) { throw new TzimerException("Please enter the amount of children", "bl"); } gr.Area = (BE.Areas)AreaComboBox.SelectedIndex; gr.Type = (BE.UnitType)AreaComboBox.SelectedIndex; gr.SubArea = SubAreaTextBox.Text; if (string.IsNullOrEmpty(gr.Children)) { throw new TzimerException("Please enter the sub Area you would like", "bl"); } switch (AreaComboBox.SelectedIndex) { case 0: gr.Area = Areas.Jerusalem; break; case 1: gr.Area = Areas.Center; break; case 2: gr.Area = Areas.North; break; case 3: gr.Area = Areas.South; break; default: break; } gr.Type = (UnitType)Enum.Parse(typeof(UnitType), TypeComboBox.SelectedValue.ToString(), true); #region breakfastIncluded switch (BNotintersted.IsChecked) { case true: gr.breakfastIncluded = Options.notInterested; break; } switch (BPossible.IsChecked) { case true: gr.breakfastIncluded = Options.possible; break; } switch (BNeccesery.IsChecked) { case true: gr.breakfastIncluded = Options.necessary; break; } #endregion #region childrenattractions switch (CNotintersted.IsChecked) { case true: gr.ChildrensAttractions = Options.notInterested; break; } switch (CPossible.IsChecked) { case true: gr.ChildrensAttractions = Options.possible; break; } switch (CNeccesery.IsChecked) { case true: gr.ChildrensAttractions = Options.necessary; break; } #endregion #region Air conditioner switch (ANotintersted.IsChecked) { case true: gr.AirConditoiner = Options.notInterested; break; } switch (APossible.IsChecked) { case true: gr.AirConditoiner = Options.possible; break; } switch (ANeccesery.IsChecked) { case true: gr.AirConditoiner = Options.necessary; break; } #endregion #region Pool switch (PNotintersted.IsChecked) { case true: gr.Pool = Options.notInterested; break; } switch (PPossible.IsChecked) { case true: gr.Pool = Options.possible; break; } switch (PNeccesery.IsChecked) { case true: gr.Pool = Options.necessary; break; } #endregion #region Jacuzz switch (JNotintersted.IsChecked) { case true: gr.Jacuzzi = Options.notInterested; break; } switch (JPossible.IsChecked) { case true: gr.Jacuzzi = Options.possible; break; } switch (JNeccesery.IsChecked) { case true: gr.Jacuzzi = Options.necessary; break; } #endregion #region Garden switch (GNotintersted.IsChecked) { case true: gr.Garden = Options.notInterested; break; } switch (GPossible.IsChecked) { case true: gr.Garden = Options.possible; break; } switch (GNeccesery.IsChecked) { case true: gr.Garden = Options.necessary; break; } #endregion #region Free Parking switch (FNotintersted.IsChecked) { case true: gr.FreeParking = Options.notInterested; break; } switch (FPossible.IsChecked) { case true: gr.FreeParking = Options.possible; break; } switch (FNeccesery.IsChecked) { case true: gr.FreeParking = Options.necessary; break; } #endregion #region Room Service switch (RNotintersted.IsChecked) { case true: gr.RoomService = Options.notInterested; break; } switch (RPossible.IsChecked) { case true: gr.RoomService = Options.possible; break; } switch (RNeccesery.IsChecked) { case true: gr.RoomService = Options.necessary; break; } #endregion bl.AddRequest(gr); var thankPAGE = new ThankYouPage(); this.NavigationService.Navigate(thankPAGE); } catch (Exception err) { MessageBox.Show(err.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public UserControlChartModel() { myBL = new ImpBL(); }
public MonthChartUserControlModel() { myBL = new ImpBL(); }
public AddDailyFoodModel() { bl = new ImpBL(); }
public GroupingHU() { InitializeComponent(); ImpBL bl = ImpBL.Instance; }
public LogInModel() { myBL = new ImpBL(); }