private void Hospitalisation_Click(object sender, RoutedEventArgs e)
 {
     if (RoomBeginDatePicker.SelectedDate != null && RoomEndDatePicker.SelectedDate != null && RoomComboBox.SelectedIndex != -1 && BedComboBox.SelectedIndex != -1)
     {
         Room            room = (Room)RoomComboBox.SelectedItem;
         int             hospitalisationId  = GetHospitalisationId();
         Hospitalisation newHospitalisation = new Hospitalisation(hospitalisationId, selected.Username, room.RoomId, (DateTime)RoomBeginDatePicker.SelectedDate, (DateTime)RoomEndDatePicker.SelectedDate, (int)BedComboBox.SelectedItem);
         _hospitalisationControler.Save(newHospitalisation);
         hospitalisation = newHospitalisation;
     }
 }
 private void WriteHospitalisation()
 {
     hospitalisation = _hospitalisationControler.GetHospitalisationForPatient(selected);
     if (hospitalisation != null)
     {
         Room room = _roomController.GetOneRoom(hospitalisation.RoomId);
         int  bed  = _roomController.GetAvailableBed(room, hospitalisation.BeginDate, hospitalisation.EndDate);
         RoomBeginDatePicker.SelectedDate = hospitalisation.BeginDate;
         RoomEndDatePicker.SelectedDate   = hospitalisation.EndDate;
         List <Room> rooms = new List <Room>();
         rooms.Add(room);
         RoomComboBox.ItemsSource   = rooms;
         RoomComboBox.SelectedIndex = 0;
         BedComboBox.Items.Add(bed - 1);
         BedComboBox.SelectedIndex = 0;
     }
 }