예제 #1
0
        private void tsbNewSchedule_Click(object sender, EventArgs e)
        {
            //Open new movie User Interface
            try
            {
                int id;

                if (dgvMovies.SelectedRows.Count > 0)
                {
                    id = Convert.ToInt32(dgvMovies.SelectedRows[0].Cells["No"].Value.ToString());
                }
                else
                {
                    id = 0;
                }

                using (var unitOfWork = new UnitOfWork(new MovieBookingContext()))
                {
                    var movie         = unitOfWork.Movies.Get(id);
                    var movieSchedule = new MovieScheduleView(movie);
                    movieSchedule.Show();
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
예제 #2
0
 private void tsbMovieSchedule_Click(object sender, EventArgs e)
 {
     try
     {
         using (var unitOfWork = new UnitOfWork(new MovieBookingContext()))
         {
             var movie         = unitOfWork.Movies.Get(Convert.ToInt32(txtMovieId.Text));
             var movieSchedule = new MovieScheduleView(movie);
             movieSchedule.Show();
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }