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() { ComboBoxChoosenGuide.ItemsSource = guidelogic.Read(new GuideBindingModel { OperatorID = App.Operator.ID }); ComboBoxChoosenGuide.SelectedItem = null; var listbindmodels = excursionlogic.Read(null); foreach (var excursion in listbindmodels) { ListBoxExcursion.Items.Add(excursion); } }
private void LoadData() { if (id != null) { var guide = logic.Read(new GuideBindingModel { ID = id })[0]; NameTextBox.Text = guide.Name; SurnameTextBox.Text = guide.Surname; WorkPlaceTextBox.Text = guide.WorkPlace; PhoneTextBox.Text = guide.PhoneNumber; MainLanguageTextBox.Text = guide.MainLanguage; AdditionalLanguageTextBox.Text = guide.AdditionalLanguage; } }
private void LoadData() { try { var list = logic.Read(new GuideBindingModel { OperatorID = App.Operator.ID }); if (list != null) { GridGuides.ItemsSource = list; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); logger.Warn("Ошибка при попытке загрузки списка гидов"); } }