예제 #1
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            try
            {
                Reservation reservation = (Reservation)bindingSourceReserve.Current;
                if (reservation == null)
                {
                    return;
                }

                FormAddEditReservation formEditReserve = new FormAddEditReservation(reservation);

                DialogResult dr = formEditReserve.ShowDialog();
                if (dr == DialogResult.Abort)
                {
                    do
                    {
                        dr = formEditReserve.ShowDialog();
                    } while (dr != DialogResult.OK && dr != DialogResult.Cancel);
                }
                if (dr == DialogResult.OK)
                {
                    repository.Update(reservation);
                    RefreshControls();
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(string.Format(ErrorMessages.ErrorMessageTemplate, ReservationDisplay), ex);
            }
        }
예제 #2
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            try
            {
                Reservation            reservation    = new Reservation();
                FormAddEditReservation formAddReserve = new FormAddEditReservation(reservation);

                DialogResult dr = formAddReserve.ShowDialog();
                if (dr == DialogResult.Abort)
                {
                    do
                    {
                        dr = formAddReserve.ShowDialog();
                    } while (dr != DialogResult.OK && dr != DialogResult.Cancel);
                }
                if (dr == DialogResult.OK)
                {
                    repository.Insert(reservation);
                    RefreshControls();
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(string.Format(ErrorMessages.ErrorMessageTemplate, ReservationDisplay), ex);
            }
        }