当前位置: 首页>>代码示例>>C#>>正文


C# AnimeSeriesRepository.GetByGroupID方法代码示例

本文整理汇总了C#中JMMServer.Repositories.AnimeSeriesRepository.GetByGroupID方法的典型用法代码示例。如果您正苦于以下问题:C# AnimeSeriesRepository.GetByGroupID方法的具体用法?C# AnimeSeriesRepository.GetByGroupID怎么用?C# AnimeSeriesRepository.GetByGroupID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JMMServer.Repositories.AnimeSeriesRepository的用法示例。


在下文中一共展示了AnimeSeriesRepository.GetByGroupID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetContinueWatchingFilter

        public List<Contract_AnimeEpisode> GetContinueWatchingFilter(int userID, int maxRecords)
        {
            List<Contract_AnimeEpisode> retEps = new List<Contract_AnimeEpisode>();
            try
            {
                using (var session = JMMService.SessionFactory.OpenSession())
                {
                    GroupFilterRepository repGF = new GroupFilterRepository();

                    JMMUserRepository repUsers = new JMMUserRepository();
                    JMMUser user = repUsers.GetByID(session, userID);
                    if (user == null) return retEps;

                    // find the locked Continue Watching Filter
                    GroupFilter gf = null;
                    List<GroupFilter> lockedGFs = repGF.GetLockedGroupFilters(session);
                    if (lockedGFs != null)
                    {
                        // if it already exists we can leave
                        foreach (GroupFilter gfTemp in lockedGFs)
                        {
                            if (gfTemp.FilterType == (int)GroupFilterType.ContinueWatching)
                            {
                                gf = gfTemp;
                                break;
                            }
                        }
                    }

                    if (gf == null) return retEps;

                    // Get all the groups
                    // it is more efficient to just get the full list of groups and then filter them later
                    AnimeGroupRepository repGroups = new AnimeGroupRepository();
                    List<AnimeGroup> allGrps = repGroups.GetAll(session);

                    // get all the user records
                    AnimeGroup_UserRepository repUserRecords = new AnimeGroup_UserRepository();
                    List<AnimeGroup_User> userRecords = repUserRecords.GetByUserID(session, userID);
                    Dictionary<int, AnimeGroup_User> dictUserRecords = new Dictionary<int, AnimeGroup_User>();
                    foreach (AnimeGroup_User userRec in userRecords)
                        dictUserRecords[userRec.AnimeGroupID] = userRec;

                    // get all the groups in this filter for this user
                    HashSet<int> groups = StatsCache.Instance.StatUserGroupFilter[user.JMMUserID][gf.GroupFilterID];

                    List<Contract_AnimeGroup> comboGroups = new List<Contract_AnimeGroup>();
                    foreach (AnimeGroup grp in allGrps)
                    {
                        if (groups.Contains(grp.AnimeGroupID))
                        {
                            AnimeGroup_User userRec = null;
                            if (dictUserRecords.ContainsKey(grp.AnimeGroupID)) userRec = dictUserRecords[grp.AnimeGroupID];

                            Contract_AnimeGroup rec = grp.ToContract(userRec);
                            comboGroups.Add(rec);
                        }
                    }

                    // apply sorting
                    List<SortPropOrFieldAndDirection> sortCriteria = GroupFilterHelper.GetSortDescriptions(gf);
                    comboGroups = Sorting.MultiSort<Contract_AnimeGroup>(comboGroups, sortCriteria);

                    if ((StatsCache.Instance.StatUserGroupFilter.ContainsKey(user.JMMUserID)) && (StatsCache.Instance.StatUserGroupFilter[user.JMMUserID].ContainsKey(gf.GroupFilterID)))
                    {
                        AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
                        foreach (Contract_AnimeGroup grp in comboGroups)
                        {
                            List<AnimeSeries> sers = repSeries.GetByGroupID(session, grp.AnimeGroupID);

                            // sort the series by air date
                            List<SortPropOrFieldAndDirection> sortCriteria2 = new List<SortPropOrFieldAndDirection>();
                            sortCriteria2.Add(new SortPropOrFieldAndDirection("AirDate", false, SortType.eDateTime));
                            sers = Sorting.MultiSort<AnimeSeries>(sers, sortCriteria2);

                            List<int> seriesWatching = new List<int>();

                            foreach (AnimeSeries ser in sers)
                            {
                                if (!user.AllowedSeries(ser)) continue;
                                bool useSeries = true;

                                if (seriesWatching.Count > 0)
                                {
                                    if (ser.GetAnime().AnimeType == (int)enAnimeType.TVSeries)
                                    {
                                        // make sure this series is not a sequel to an existing series we have already added
                                        foreach (AniDB_Anime_Relation rel in ser.GetAnime().GetRelatedAnime())
                                        {
                                            if (rel.RelationType.ToLower().Trim().Equals("sequel") || rel.RelationType.ToLower().Trim().Equals("prequel"))
                                                useSeries = false;
                                        }
                                    }

                                }

                                if (!useSeries) continue;

                                Contract_AnimeEpisode ep = GetNextUnwatchedEpisode(session, ser.AnimeSeriesID, userID);
                                if (ep != null)
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: GetSeries

		public List<AnimeSeries> GetSeries(ISession session)
		{
			AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
			List<AnimeSeries> seriesList = repSeries.GetByGroupID(this.AnimeGroupID);

			return seriesList;
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:7,代码来源:AnimeGroup.cs

示例3: GetAnimeContinueWatching

        public List<MetroContract_Anime_Summary> GetAnimeContinueWatching(int maxRecords, int jmmuserID)
        {
            List<MetroContract_Anime_Summary> retAnime = new List<MetroContract_Anime_Summary>();
            try
            {
                using (var session = JMMService.SessionFactory.OpenSession())
                {

                    GroupFilterRepository repGF = new GroupFilterRepository();

                    JMMUserRepository repUsers = new JMMUserRepository();
                    JMMUser user = repUsers.GetByID(session, jmmuserID);
                    if (user == null) return retAnime;

                    // find the locked Continue Watching Filter
                    GroupFilter gf = null;
                    List<GroupFilter> lockedGFs = repGF.GetLockedGroupFilters(session);
                    if (lockedGFs != null)
                    {
                        // if it already exists we can leave
                        foreach (GroupFilter gfTemp in lockedGFs)
                        {
                            if (gfTemp.GroupFilterName.Equals(Constants.GroupFilterName.ContinueWatching, StringComparison.InvariantCultureIgnoreCase))
                            {
                                gf = gfTemp;
                                break;
                            }
                        }
                    }

                    if (gf == null) return retAnime;

                    // Get all the groups 
                    // it is more efficient to just get the full list of groups and then filter them later
                    AnimeGroupRepository repGroups = new AnimeGroupRepository();
                    List<AnimeGroup> allGrps = repGroups.GetAll(session);

                    // get all the user records
                    AnimeGroup_UserRepository repUserRecords = new AnimeGroup_UserRepository();
                    List<AnimeGroup_User> userRecords = repUserRecords.GetByUserID(session, jmmuserID);
                    Dictionary<int, AnimeGroup_User> dictUserRecords = new Dictionary<int, AnimeGroup_User>();
                    foreach (AnimeGroup_User userRec in userRecords)
                        dictUserRecords[userRec.AnimeGroupID] = userRec;

                    // get all the groups in this filter for this user
                    HashSet<int> groups = StatsCache.Instance.StatUserGroupFilter[user.JMMUserID][gf.GroupFilterID];

                    List<Contract_AnimeGroup> comboGroups = new List<Contract_AnimeGroup>();
                    foreach (AnimeGroup grp in allGrps)
                    {
                        if (groups.Contains(grp.AnimeGroupID))
                        {
                            AnimeGroup_User userRec = null;
                            if (dictUserRecords.ContainsKey(grp.AnimeGroupID)) userRec = dictUserRecords[grp.AnimeGroupID];

                            Contract_AnimeGroup rec = grp.ToContract(userRec);
                            comboGroups.Add(rec);
                        }
                    }

                    // apply sorting
                    List<SortPropOrFieldAndDirection> sortCriteria = GroupFilterHelper.GetSortDescriptions(gf);
                    comboGroups = Sorting.MultiSort<Contract_AnimeGroup>(comboGroups, sortCriteria);

                    if ((StatsCache.Instance.StatUserGroupFilter.ContainsKey(user.JMMUserID)) && (StatsCache.Instance.StatUserGroupFilter[user.JMMUserID].ContainsKey(gf.GroupFilterID)))
                    {
                        AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
                        foreach (Contract_AnimeGroup grp in comboGroups)
                        {
                            JMMServiceImplementation imp = new JMMServiceImplementation();
                            foreach (AnimeSeries ser in repSeries.GetByGroupID(session, grp.AnimeGroupID))
                            {
                                if (!user.AllowedSeries(ser)) continue;

                                AnimeSeries_User serUser = ser.GetUserRecord(session, jmmuserID);

                                Contract_AnimeEpisode ep = imp.GetNextUnwatchedEpisode(session, ser.AnimeSeriesID, jmmuserID);
                                if (ep != null)
                                {
                                    AniDB_Anime anidb_anime = ser.GetAnime(session);

                                    MetroContract_Anime_Summary summ = new MetroContract_Anime_Summary();
                                    summ.AnimeID = ser.AniDB_ID;
                                    summ.AnimeName = ser.GetSeriesName(session);
                                    summ.AnimeSeriesID = ser.AnimeSeriesID;
                                    summ.BeginYear = anidb_anime.BeginYear;
                                    summ.EndYear = anidb_anime.EndYear;
                                    //summ.PosterName = anidb_anime.GetDefaultPosterPathNoBlanks(session);

                                    if (serUser != null)
                                        summ.UnwatchedEpisodeCount = serUser.UnwatchedEpisodeCount;
                                    else
                                        summ.UnwatchedEpisodeCount = 0;

                                    ImageDetails imgDet = anidb_anime.GetDefaultPosterDetailsNoBlanks(session);
                                    summ.ImageType = (int)imgDet.ImageType;
                                    summ.ImageID = imgDet.ImageID;

                                    retAnime.Add(summ);

//.........这里部分代码省略.........
开发者ID:maz0r,项目名称:jmmserver,代码行数:101,代码来源:JMMServiceImplementationMetro.cs

示例4: GetContinueWatchingFilter

		public List<Contract_AnimeEpisode> GetContinueWatchingFilter(int userID, int maxRecords)
		{
			List<Contract_AnimeEpisode> retEps = new List<Contract_AnimeEpisode>();
			try
			{
				using (var session = JMMService.SessionFactory.OpenSession())
				{
					GroupFilterRepository repGF = new GroupFilterRepository();

					JMMUserRepository repUsers = new JMMUserRepository();
					JMMUser user = repUsers.GetByID(session, userID);
					if (user == null) return retEps;

					// find the locked Continue Watching Filter
					GroupFilter gf = null;
					List<GroupFilter> lockedGFs = repGF.GetLockedGroupFilters(session);
					if (lockedGFs != null)
					{
						// if it already exists we can leave
						foreach (GroupFilter gfTemp in lockedGFs)
						{
							if (gfTemp.GroupFilterName.Equals(Constants.GroupFilterName.ContinueWatching, StringComparison.InvariantCultureIgnoreCase))
							{
								gf = gfTemp;
								break;
							}
						}
					}

					if (gf == null) return retEps;

					// Get all the groups 
					// it is more efficient to just get the full list of groups and then filter them later
					AnimeGroupRepository repGroups = new AnimeGroupRepository();
					List<AnimeGroup> allGrps = repGroups.GetAll(session);

					// get all the user records
					AnimeGroup_UserRepository repUserRecords = new AnimeGroup_UserRepository();
					List<AnimeGroup_User> userRecords = repUserRecords.GetByUserID(session, userID);
					Dictionary<int, AnimeGroup_User> dictUserRecords = new Dictionary<int, AnimeGroup_User>();
					foreach (AnimeGroup_User userRec in userRecords)
						dictUserRecords[userRec.AnimeGroupID] = userRec;

					// get all the groups in this filter for this user
					HashSet<int> groups = StatsCache.Instance.StatUserGroupFilter[user.JMMUserID][gf.GroupFilterID];

					List<Contract_AnimeGroup> comboGroups = new List<Contract_AnimeGroup>();
					foreach (AnimeGroup grp in allGrps)
					{
						if (groups.Contains(grp.AnimeGroupID))
						{
							AnimeGroup_User userRec = null;
							if (dictUserRecords.ContainsKey(grp.AnimeGroupID)) userRec = dictUserRecords[grp.AnimeGroupID];

							Contract_AnimeGroup rec = grp.ToContract(userRec);
							comboGroups.Add(rec);
						}
					}

					// apply sorting
					List<SortPropOrFieldAndDirection> sortCriteria = GroupFilterHelper.GetSortDescriptions(gf);
					comboGroups = Sorting.MultiSort<Contract_AnimeGroup>(comboGroups, sortCriteria);

					if ((StatsCache.Instance.StatUserGroupFilter.ContainsKey(user.JMMUserID)) && (StatsCache.Instance.StatUserGroupFilter[user.JMMUserID].ContainsKey(gf.GroupFilterID)))
					{
						AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
						foreach (Contract_AnimeGroup grp in comboGroups)
						{
							foreach (AnimeSeries ser in repSeries.GetByGroupID(session, grp.AnimeGroupID))
							{
								if (!user.AllowedSeries(ser)) continue;

								Contract_AnimeEpisode ep = GetNextUnwatchedEpisode(session, ser.AnimeSeriesID, userID);
								if (ep != null)
								{
									retEps.Add(ep);

									// Lets only return the specified amount
									if (retEps.Count == maxRecords)
										return retEps;
								}
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				logger.ErrorException(ex.ToString(), ex);
			}
			return retEps;
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:92,代码来源:JMMServiceImplementation.cs


注:本文中的JMMServer.Repositories.AnimeSeriesRepository.GetByGroupID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。