private void bindRoomsComboBox() { ReserversionsServiceClient client = new ReserversionsServiceClient(); String sessionId = (String)App.Current.Properties[App.sessionPropertyName]; List <RoomsComboBoxWraper> rooms = client.FindAllRooms(sessionId).Select(room => new RoomsComboBoxWraper(room)).ToList(); comboBoxRoom.ItemsSource = rooms; comboBoxRoom.SelectedValuePath = "Id"; comboBoxRoom.SelectedItem = rooms.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; }