示例#1
0
        //TODO: Consider to group the history into one record
        public List <MovieHistory> AddHistory(MovieMagnet magnet)
        {
            List <MovieHistory> movieHistories = new List <MovieHistory>();

            if (magnet.IdMovieMag == 0)
            {
                movieHistories.Add(new MovieHistory()
                {
                    DescHistory = string.Format("Create new movie magnet {0}", magnet.Hash)
                });
            }
            else
            {
                MovieMagnet origin = FindById(magnet.IdMovieMag);
                string      result = string.Empty;

                if (HistoryDiffHelpers.GetDifferencesFieldString(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "MagName"), origin.MagName, magnet.MagName, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "MagnetUrl"), origin.MagnetUrl, magnet.MagnetUrl, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "Hash"), origin.Hash, magnet.Hash, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldDemical(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "Size"), origin.Size, magnet.Size, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldDate(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "Magnet Date"), origin.DtMagnet, magnet.DtMagnet, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldBoolean(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "IsHD"), origin.IsHD, magnet.IsHD, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldBoolean(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "HasSub"), origin.HasSub, magnet.HasSub, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "Magnet Source"), origin.IdMagSource.ToString(), magnet.IdMagSource.ToString(), ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldDate(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "DtStart"), origin.DtStart, magnet.DtStart, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldDate(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "DtFinish"), origin.DtFinish, magnet.DtFinish, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "SavePath"), origin.SavePath, magnet.SavePath, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString(string.Format("MagnetId {0} - {1}", magnet.IdMovieMag, "Magnet Status"), origin.IdStatus.ToString(), magnet.IdStatus.ToString(), ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }
            }
            return(movieHistories);
        }
示例#2
0
        public List <MovieHistory> AddHistory(Movie movie)
        {
            List <MovieHistory> movieHistories = new List <MovieHistory>();

            if (movie.IdMovie == 0)
            {
                movieHistories.Add(new MovieHistory()
                {
                    DescHistory = string.Format("Create new movie item {0}", movie.Number)
                });
            }
            else
            {
                Movie  origin = FindById(movie.IdMovie);
                string result = string.Empty;

                if (HistoryDiffHelpers.GetDifferencesFieldString("Title", origin.Title, movie.Title, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString("Company", origin.Company, movie.Company, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString("Director", origin.Director, movie.Director, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString("Publisher", origin.Publisher, movie.Publisher, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString("Category", origin.Category, movie.Category, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString("Actor", origin.Actor, movie.Actor, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldDate("Release Date", origin.DtRelease, movie.DtRelease, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldInteger("NbWant", origin.NbWant, movie.NbWant, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldInteger("NbWatched", origin.NbWatched, movie.NbWatched, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldInteger("NbOwned", origin.NbOwned, movie.NbOwned, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldInteger("Duration", origin.Duration, movie.Duration, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString("ThumbnailUrl", origin.ThumbnailUrl, movie.ThumbnailUrl, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString("CoverUrl", origin.CoverUrl, movie.CoverUrl, ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString("Favorite level", origin.FavLevel.ToString(), movie.FavLevel.ToString(), ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }

                if (HistoryDiffHelpers.GetDifferencesFieldString("Movie status", origin.IdStatus.ToString(), movie.IdStatus.ToString(), ref result))
                {
                    movieHistories.Add(new MovieHistory()
                    {
                        DescHistory = result
                    });
                }
            }
            return(movieHistories);
        }