Example #1
0
        private void onEditPelicula(object sender, EventArgs e)
        {
            if (dataGridView.SelectedRows.Count == 1)
            {
                int selectedRowIndex = dataGridView.SelectedRows[0].Index;

                try
                {
                    using (PeliculaRepository repo = new PeliculaRepository())
                    {
                        using (PeliculaForm form = new PeliculaForm())
                        {
                            form.Text = "Editando película";
                            form.ConfigureAsDialog();
                            form.Pelicula = repo.FindById(peliculas[selectedRowIndex].Id);

                            if (form.ShowDialog(this) == DialogResult.OK)
                            {
                                peliculas[selectedRowIndex] = form.Pelicula;
                            }
                        }
                    }
                }
                catch (BusinessEntityRepositoryException ex)
                {
                    this.ShowExceptionMessageBox(ex);
                }
            }
        }
Example #2
0
        private void onNewPelicula(object sender, EventArgs e)
        {
            using (PeliculaForm form = new PeliculaForm())
            {
                form.Text = "Agregando nueva película";
                form.ConfigureAsDialog();

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    Pelicula pelicula = form.Pelicula;
                    peliculas.Add(pelicula);
                    dataGridView.SelectLastRowAndScroll();
                }
            }
        }