本文整理汇总了C#中JMMServer.Repositories.AnimeSeriesRepository.GetWithMissingEpisodes方法的典型用法代码示例。如果您正苦于以下问题:C# AnimeSeriesRepository.GetWithMissingEpisodes方法的具体用法?C# AnimeSeriesRepository.GetWithMissingEpisodes怎么用?C# AnimeSeriesRepository.GetWithMissingEpisodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.AnimeSeriesRepository
的用法示例。
在下文中一共展示了AnimeSeriesRepository.GetWithMissingEpisodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSeriesWithMissingEpisodes
public List<Contract_AnimeSeries> GetSeriesWithMissingEpisodes(int maxRecords, int jmmuserID)
{
DateTime start = DateTime.Now;
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
JMMUserRepository repUsers = new JMMUserRepository();
// get all the series
List<Contract_AnimeSeries> seriesContractList = new List<Contract_AnimeSeries>();
try
{
JMMUser user = repUsers.GetByID(jmmuserID);
if (user == null) return seriesContractList;
List<AnimeSeries> series = repSeries.GetWithMissingEpisodes();
List<AniDB_Anime> animes = repAnime.GetAll();
Dictionary<int, AniDB_Anime> dictAnimes = new Dictionary<int, AniDB_Anime>();
foreach (AniDB_Anime anime in animes)
dictAnimes[anime.AnimeID] = anime;
// tvdb
CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository();
List<CrossRef_AniDB_TvDBV2> allCrossRefs = repCrossRef.GetAll();
Dictionary<int, List<CrossRef_AniDB_TvDBV2>> dictCrossRefsV2 = new Dictionary<int, List<CrossRef_AniDB_TvDBV2>>();
foreach (CrossRef_AniDB_TvDBV2 xref in allCrossRefs)
{
if (!dictCrossRefsV2.ContainsKey(xref.AnimeID))
dictCrossRefsV2[xref.AnimeID] = new List<CrossRef_AniDB_TvDBV2>();
dictCrossRefsV2[xref.AnimeID].Add(xref);
}
// moviedb
CrossRef_AniDB_OtherRepository repOtherCrossRef = new CrossRef_AniDB_OtherRepository();
List<CrossRef_AniDB_Other> allOtherCrossRefs = repOtherCrossRef.GetAll();
Dictionary<int, CrossRef_AniDB_Other> dictMovieCrossRefs = new Dictionary<int, CrossRef_AniDB_Other>();
foreach (CrossRef_AniDB_Other xref in allOtherCrossRefs)
{
if (xref.CrossRefType == (int)CrossRefType.MovieDB)
dictMovieCrossRefs[xref.AnimeID] = xref;
}
// MAL
CrossRef_AniDB_MALRepository repMALCrossRef = new CrossRef_AniDB_MALRepository();
List<CrossRef_AniDB_MAL> allMALCrossRefs = repMALCrossRef.GetAll();
Dictionary<int, List<CrossRef_AniDB_MAL>> dictMALCrossRefs = new Dictionary<int, List<CrossRef_AniDB_MAL>>();
foreach (CrossRef_AniDB_MAL xref in allMALCrossRefs)
{
if (!dictMALCrossRefs.ContainsKey(xref.AnimeID))
dictMALCrossRefs[xref.AnimeID] = new List<CrossRef_AniDB_MAL>();
dictMALCrossRefs[xref.AnimeID].Add(xref);
}
// user records
AnimeSeries_UserRepository repSeriesUser = new AnimeSeries_UserRepository();
List<AnimeSeries_User> userRecordList = repSeriesUser.GetByUserID(jmmuserID);
Dictionary<int, AnimeSeries_User> dictUserRecords = new Dictionary<int, AnimeSeries_User>();
foreach (AnimeSeries_User serUser in userRecordList)
dictUserRecords[serUser.AnimeSeriesID] = serUser;
int i = 1;
foreach (AnimeSeries aser in series)
{
if (!dictAnimes.ContainsKey(aser.AniDB_ID)) continue;
AniDB_Anime anime = dictAnimes[aser.AniDB_ID];
if (!user.AllowedAnime(anime)) continue;
List<CrossRef_AniDB_TvDBV2> xrefs = new List<CrossRef_AniDB_TvDBV2>();
if (dictCrossRefsV2.ContainsKey(aser.AniDB_ID)) xrefs = dictCrossRefsV2[aser.AniDB_ID];
CrossRef_AniDB_Other xrefMovie = null;
if (dictMovieCrossRefs.ContainsKey(aser.AniDB_ID)) xrefMovie = dictMovieCrossRefs[aser.AniDB_ID];
AnimeSeries_User userRec = null;
if (dictUserRecords.ContainsKey(aser.AnimeSeriesID))
userRec = dictUserRecords[aser.AnimeSeriesID];
List<CrossRef_AniDB_MAL> xrefMAL = null;
if (dictMALCrossRefs.ContainsKey(aser.AniDB_ID))
xrefMAL = dictMALCrossRefs[aser.AniDB_ID];
List<TvDB_Series> sers = new List<TvDB_Series>();
foreach (CrossRef_AniDB_TvDBV2 xref in xrefs)
sers.Add(xref.GetTvDBSeries());
MovieDB_Movie movie = null;
if (xrefMovie != null)
movie = xrefMovie.GetMovieDB_Movie();
seriesContractList.Add(aser.ToContract(dictAnimes[aser.AniDB_ID], xrefs, xrefMovie, userRec,
sers, xrefMAL, false, null, null, null, null,movie));
if (i == maxRecords) break;
i++;
}
TimeSpan ts = DateTime.Now - start;
logger.Info("GetSeriesWithMissingEpisodes in {0} ms", ts.TotalMilliseconds);
}
//.........这里部分代码省略.........