public WindowTravel(TravelLogic travelLogic, TourLogic tourLogic, ExcursionLogic excursionLogic) { InitializeComponent(); this.travelLogic = travelLogic; listAllTours = tourLogic.Read(null); logger = LogManager.GetCurrentClassLogger(); }
private void LoadData() { var listbindmodels = tourlogic.Read(new TourBindingModel { OperatorID = App.Operator.ID }); foreach (var tour in listbindmodels) { ListBoxTours.Items.Add(tour); } }
private void LoadData() { ComboBoxHalts.ItemsSource = Hlogic.Read(new HaltBindingModel { OperatorID = App.Operator.ID }); ComboBoxHalts.SelectedItem = null; var tours = logic.Read(new TourBindingModel { OperatorID = App.Operator.ID }); foreach (var tour in tours) { if (tour.ID == id) { this.tour = tour; } } var listbindmodels = Guidelogic.Read(new GuideBindingModel { OperatorID = App.Operator.ID }); foreach (var guide in listbindmodels) { ListBoxAvailable.Items.Add(guide); } if (tour != null) { ListBoxAvailable.Items.Clear(); List <int> array = new List <int>(); var listSelectedGuides = tour.TourGuides.ToList(); foreach (var guide in listSelectedGuides) { GuideViewModel current = Guidelogic.Read(new GuideBindingModel { ID = guide.Key })[0]; ListBoxSelected.Items.Add(current); array.Add(current.ID); } foreach (var guide in listbindmodels) { if (!array.Contains(guide.ID)) { ListBoxAvailable.Items.Add(guide); } } NameTextBox.Text = tour.Name; CountryTextBox.Text = tour.Country; PriceTextBox.Text = tour.Price.ToString(); ComboBoxHalts.SelectedValue = tour.HaltID; } }
private void LoadData() { try { var list = logic.Read(new TourBindingModel { OperatorID = App.Operator.ID }); if (list != null) { toursGrid.ItemsSource = list; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); logger.Warn("Ошибка при попытке загрузки списка туров"); } }