Beispiel #1
0
        private void OnMoviesAdd(object sender, EventArgs e)
        {
            var child = new MovieDetailsForm("Movie Details");

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

            _movie = child.Movie;
        }
Beispiel #2
0
        private void OnMoviesAdd(object sender, EventArgs e)
        {
            var child = new MovieDetailsForm("Movie Details");

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

            _database.Add(child.Movie);
            UpdateList();
        }
Beispiel #3
0
        private void EditMovie(Movie movie)
        {
            var child = new MovieDetailsForm("Movie Details");

            child.Movie = movie;
            if (child.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            _database.Update(child.Movie);
            UpdateList();
        }
Beispiel #4
0
    /////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Opens/creates form to add new movie exemplar depending on the current
    /// active form with selected movie.
    /// </summary>
    ///
    internal void AddNewMovieExemplar()
    {
        MovieListForm         movieList    = Find <MovieListForm> ();
        MovieDetailsForm      movieDetials = Find <MovieDetailsForm> ();
        MovieExemplarListForm exemplarList = Find <MovieExemplarListForm> ();

        if (exemplarList != null && exemplarList.MdiForm == ActiveMdiChild)
        {
            OpenAddNew <MovieExemplarListForm> ();
        }
        else if (movieDetials != null && movieDetials.Record != null &&
                 movieDetials.MdiForm == ActiveMdiChild)
        {
            OpenAddNewMovieExemplarDetails(movieDetials.Record);
        }
        else if (movieList != null && movieList.CurrentRecord != null &&
                 movieList.MdiForm == ActiveMdiChild)
        {
            OpenAddNewMovieExemplarDetails(movieList.CurrentRecord);
        }
        else if (exemplarList != null &&
                 (exemplarList.Movie != null || exemplarList.CurrentRecord != null))
        {
            OpenAddNew <MovieExemplarListForm> ();
        }
        else if (movieDetials != null && movieDetials.Record != null)
        {
            OpenAddNewMovieExemplarDetails(movieDetials.Record);
        }
        else if (movieList != null && movieList.CurrentRecord != null)
        {
            OpenAddNewMovieExemplarDetails(movieList.CurrentRecord);
        }
        else // movies == null && exemplars == null
        {
            Open <MovieListForm>(OpenMode.Edit);

            MessageBox.Show(
                "Choose a movie first!\n\n"
                + "Then select Add New Exemplar for the movie...",
                "Add New Movie Exemplar",
                MessageBoxButtons.OK, MessageBoxIcon.Information
                );
        }
    }
Beispiel #5
0
        private void EditMovie(Movie movie)
        {
            var child = new MovieDetailsForm("Movie Details");

            child.Movie = movie;
            if (child.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            try
            {
                _database.Update(child.Movie);
            } catch (Exception ex)
            {
                DisplayError(ex, "Update Failed");
            };
            UpdateList();
        }
Beispiel #6
0
        private void OnMovieAdd(object sender, EventArgs e)
        {
            var child = new MovieDetailsForm("Movie Details");

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

            try
            {
                _database.Add(child.Movie);
            } catch (ValidationException ex)
            {
                DisplayError(ex, "Validation Failed");
            } catch (Exception ex)
            {
                DisplayError(ex, "Add Failed");
            };
            UpdateList();
        }