private void LoadData() { if (id != null) { var halt = logic.Read(new HaltBindingModel { ID = id })[0]; NameTextBox.Text = halt.Name; AddressTextBox.Text = halt.Address; } }
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 HaltBindingModel { OperatorID = App.Operator.ID }); if (list != null) { gridHalts.ItemsSource = list; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } }