Пример #1
0
        private void EditSelectedMovie()
        {
            var movie = GetSelectedMovie();

            if (movie == null)
            {
                return;
            }

            var form = new MovieDetailForm(movie);

            if (form.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }

            //update product
            form.Movie.Id = movie.Id;
            _database.Update(form.Movie, out var message);
            if (!String.IsNullOrEmpty(message))
            {
                MessageBox.Show(message);
                EditSelectedMovie();
            }
            RefreshUI();
        }
Пример #2
0
        private void EditSelectedMovie()
        {
            var movie = GetSelectedMovie();

            if (movie == null)
            {
                return;
            }

            var form = new MovieDetailForm(movie);

            if (form.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            //update product
            form.Movie.Id = movie.Id;
            try
            {
                _database.Update(form.Movie);
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                EditSelectedMovie();
            }

            RefreshUI();
        }
Пример #3
0
        private void OnMovieAdd(object sender, EventArgs e)
        {
            var form = new MovieDetailForm();

            form.Text = "Add Movie";
            if (form.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            _movie = form.Movie;
        }
Пример #4
0
        private void OnMovieAdd(object sender, EventArgs e)
        {
            var form = new MovieDetailForm("Add Movie");

            if (form.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            _database.Add(form.Movie);
            //if (!String.IsNullOrEmpty(message))
            //    MessageBox.Show(message);

            RefreshUI();
        }
Пример #5
0
        private void OnMovieAdd(object sender, EventArgs e)
        {
            var form = new MovieDetailForm("Add Movie");

            if (form.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }
            _database.Add(form.Movie, out var message);
            if (!String.IsNullOrEmpty(message))
            {
                MessageBox.Show(message);
                OnMovieAdd(sender, e);
            }
            RefreshUI();
        }
Пример #6
0
        private void OnMovieEdit(object sender, EventArgs e)
        {
            var form = new MovieDetailForm();

            if (_movie == null)
            {
                MessageBox.Show(this, "No Movie to edit");
                return;
            }

            form.Text  = "Edit Movie";
            form.Movie = _movie;
            if (form.ShowDialog(this) == DialogResult.OK)
            {
                _movie = form.Movie;
            }
        }