예제 #1
0
        private void CommitFormAction(object sender, EventArgs e)
        {
            Forms.ReservationForm form = sender as Forms.ReservationForm;
            switch (form.ClosedWith)
            {
            case Forms.CloseAction.Save:
                Models.Entities.MeetingReservation reservation = form.Reservation.Save();
                if (!form.Reservation.Room.Reservations.ContainsKey(form.Reservation.Date.ToShortDateString()) || !form.Reservation.Room.Reservations[form.Reservation.Date.ToShortDateString()].Contains(reservation))
                {
                    form.Reservation.Room.AddReservation(reservation);
                }
                ViewModel.RefreshReservations();
                break;

            case Forms.CloseAction.Delete:
                this.DeleteReservation(sender, null);
                ViewModel.RefreshReservations();
                break;
            }
        }
예제 #2
0
 private void EditReservation(object sender, RoutedEventArgs e)
 {
     Forms.ReservationForm form = new Forms.ReservationForm(ViewModel.SelectedReservation);
     form.Closed += CommitFormAction;
     form.ShowDialog();
 }