Esempio n. 1
0
        /// <summary>
        /// Validates the sets to ensure all movies are in database.
        /// </summary>
        public static void ValidateSets()
        {
            foreach (var set in CurrentDatabase)
            {
                var removeIndex = new List <string>();

                for (int index = 0; index < set.Movies.Count; index++)
                {
                    var movie = set.Movies[index];
                    var check = MovieDBFactory.GetMovie(movie.MovieUniqueId);

                    if (check == null)
                    {
                        removeIndex.Add(movie.MovieUniqueId);
                    }
                }

                foreach (var i in removeIndex)
                {
                    set.Movies.Remove((from m in set.Movies where m.MovieUniqueId == i select m).SingleOrDefault());
                }

                var count = 1;

                foreach (var movieInSet in set.Movies)
                {
                    movieInSet.Order = count;
                    count++;
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Removes the movie from set.
 /// </summary>
 private void RemoveMovieFromSet()
 {
     foreach (int movieIndex in this.gridView.GetSelectedRows())
     {
         var movie = this.gridView.GetRow(movieIndex) as MovieSetObjectModel;
         MovieSetManager.RemoveFromSet(movie.MovieUniqueId);
         MovieDBFactory.GetMovie(movie.MovieUniqueId).ChangedText = true;
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Handles the Click event of the GalleryItem control.
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="DevExpress.XtraBars.Ribbon.GalleryItemClickEventArgs"/> instance containing the event data.
        /// </param>
        private void GalleryItem_Click(object sender, GalleryItemClickEventArgs e)
        {
            this.grdViewByTitle.ClearSelection();

            var selectedMovie = MovieDBFactory.MovieDatabase.IndexOf(MovieDBFactory.GetMovie(e.Item.Tag.ToString()));
            var handle        = this.grdViewByTitle.GetRowHandle(selectedMovie);

            this.grdViewByTitle.FocusedRowHandle = handle;
            this.grdViewByTitle.SelectRow(handle);
            this.UpdateMovieFromGrid();

            // MovieDBFactory.SetCurrentMovie(e.Item.Tag.ToString());
        }
Esempio n. 4
0
        private static List <MovieModel> MovieListTagToList(string movieModelsString)
        {
            var movieIds  = movieModelsString.Split('|').ToList();
            var movieList = new List <MovieModel>();

            foreach (var id in movieIds)
            {
                if (!string.IsNullOrEmpty(id))
                {
                    movieList.Add(MovieDBFactory.GetMovie(id));
                }
            }

            return(movieList);
        }
Esempio n. 5
0
 /// <summary>
 /// Returns the movies in sets.
 /// </summary>
 /// <param name="movieSetModel">The movie set model.</param>
 /// <returns>Collection of movies in a set</returns>
 public static List <MovieModel> GetMoviesInSets(MovieSetModel movieSetModel)
 {
     return(movieSetModel.Movies.Select(movieSetObect => MovieDBFactory.GetMovie(movieSetObect.MovieUniqueId)).Where(movie => movie != null).ToList());
 }
Esempio n. 6
0
 /// <summary>
 /// Get movie model using unique ID
 /// </summary>
 /// <returns>
 /// Movie Model
 /// </returns>
 public MovieModel GetMovieModel()
 {
     return(MovieDBFactory.GetMovie(this.MovieUniqueId));
 }