Exemple #1
0
 /// <summary>
 /// Event handler for changes to the individual Reservations
 /// </summary>
 /// <remarks>
 /// Automaticly reassigns the Reservation under the correct key in the dictionary.
 /// </remarks>
 private void ReservationChanged(object sender, PropertyChangedEventArgs e)
 {
     this.OnPropertyChanged("Reservations");
     if (e.PropertyName == "Date")
     {
         MeetingReservation reservation = sender as MeetingReservation;
         this.Reservations.First(k => k.Value.Contains(reservation)).Value.Remove(reservation);
         this.AddReservation(reservation);
     }
 }
Exemple #2
0
 /// <summary>
 /// Creates a Form for an existing Reservation
 /// </summary>
 /// <param name="reservation">Reservation the Form is created for</param>
 public MeetingReservationForm(MeetingReservation reservation)
 {
     this.Customer            = reservation.Customer;
     this.Room                = reservation.MeetingRoom;
     this.Date                = reservation.Date;
     this.TimeFrom            = this.TimeFrom.Add(reservation.TimeFrom);
     this.TimeTo              = this.TimeTo.Add(reservation.TimeTo);
     this.ExpectedPersonCount = reservation.ExpectedPersonsCount;
     this.VideoConference     = reservation.VideoConference;
     this.Note                = reservation.Note;
     this.Instance            = reservation;
 }
Exemple #3
0
 /// <summary>
 /// Saves the form data to it's source MeetingReservation or to a new MeetingReservation
 /// </summary>
 /// <returns cref="MeetingReservation">Saved MeetingReservation</returns>
 public MeetingReservation Save()
 {
     if (this.Instance is null)
     {
         this.Instance = new MeetingReservation(this.Room, this.Date);
     }
     this.Instance.TimeFrom             = this.TimeFrom.TimeOfDay;
     this.Instance.TimeTo               = this.TimeTo.TimeOfDay;
     this.Instance.ExpectedPersonsCount = this.ExpectedPersonCount;
     this.Instance.Customer             = this.Customer;
     this.Instance.Note = this.Note;
     return(this.Instance);
 }
Exemple #4
0
 /// <summary>
 /// Adds a Reservation for this room under the correct key.
 /// </summary>
 /// <param name="reservation">Added Reservation</param>
 public void AddReservation(MeetingReservation reservation)
 {
     if (reservation.MeetingRoom == this)
     {
         string keyDate = reservation.Date.ToShortDateString();
         if (!this.Reservations.ContainsKey(keyDate))
         {
             this.Reservations.Add(keyDate, new ObservableCollection <MeetingReservation>());
         }
         this.Reservations[keyDate].Add(reservation);
     }
     else
     {
         throw new System.Exception("The Reservation is not for this Room");
     }
 }