private void bindCusstomerComboBox() { ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; List <CustomerComboBoxWraper> customers = client.FindAllCustomers(sessionId).Select(customer => new CustomerComboBoxWraper(customer)).ToList(); comboBoxCustomer.ItemsSource = customers; comboBoxCustomer.SelectedValuePath = "Id"; comboBoxCustomer.SelectedItem = customers.FirstOrDefault(); }
private void buttonRefresh_Click(object sender, RoutedEventArgs e) { ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; ReserverionsDataGrid.ItemsSource = client.FindAll(sessionId); int selectedRoom = (int)comboBoxRoom.SelectedValue; comboBoxRoom.ItemsSource = client.FindAllRooms(sessionId).Select(room => new RoomsComboBoxWraper(room)).ToList(); comboBoxRoom.SelectedValue = selectedRoom; int selectedCustomer = (int)comboBoxCustomer.SelectedValue; comboBoxCustomer.ItemsSource = client.FindAllCustomers(sessionId).Select(customer => new CustomerComboBoxWraper(customer)).ToList(); comboBoxCustomer.SelectedValue = selectedCustomer; }