public List<GroupFilterCondition> GetByConditionType(GroupFilterConditionType ctype)
		{
			using (var session = JMMService.SessionFactory.OpenSession())
			{
				var gfcs = session
					.CreateCriteria(typeof(GroupFilterCondition))
					.Add(Restrictions.Eq("ConditionType", (int)ctype))
					.List<GroupFilterCondition>();

				return new List<GroupFilterCondition>(gfcs);
			}
		}
        public static string GetTextForEnum_ConditionType(GroupFilterConditionType conditionType)
        {
            switch (conditionType)
            {
                case GroupFilterConditionType.AirDate: return Properties.Resources.GroupFilterConditionType_AirDate;
                case GroupFilterConditionType.AllEpisodesWatched: return Properties.Resources.GroupFilterConditionType_AllEpisodesWatched;
                case GroupFilterConditionType.AnimeGroup: return Properties.Resources.GroupFilterConditionType_AnimeGroup;
                case GroupFilterConditionType.AnimeType: return Properties.Resources.GroupFilterConditionType_AnimeType;
                case GroupFilterConditionType.AssignedTvDBInfo: return Properties.Resources.GroupFilterConditionType_AssignedTvDBInfo;
                case GroupFilterConditionType.AssignedMALInfo: return Properties.Resources.GroupFilterConditionType_AssignedMALInfo;
                case GroupFilterConditionType.AssignedMovieDBInfo: return Properties.Resources.GroupFilterConditionType_AssignedMovieDBInfo;
                case GroupFilterConditionType.AssignedTvDBOrMovieDBInfo: return Properties.Resources.GroupFilterConditionType_AssignedTvDBOrMovieDBInfo;
                case GroupFilterConditionType.Tag: return Properties.Resources.GroupFilterConditionType_Tag;
                case GroupFilterConditionType.CompletedSeries: return Properties.Resources.GroupFilterConditionType_CompletedSeries;
                case GroupFilterConditionType.Favourite: return Properties.Resources.GroupFilterConditionType_Favourite;
                case GroupFilterConditionType.HasUnwatchedEpisodes: return Properties.Resources.GroupFilterConditionType_HasUnwatchedEpisodes;
                case GroupFilterConditionType.MissingEpisodes: return Properties.Resources.GroupFilterConditionType_MissingEpisodes;
                case GroupFilterConditionType.MissingEpisodesCollecting: return Properties.Resources.GroupFilterConditionType_MissingEpisodesCollecting;
                case GroupFilterConditionType.ReleaseGroup: return Properties.Resources.GroupFilterConditionType_ReleaseGroup;
                case GroupFilterConditionType.Studio: return Properties.Resources.GroupFilterConditionType_Studio;
                case GroupFilterConditionType.UserVoted: return Properties.Resources.GroupFilterConditionType_UserVoted;
                case GroupFilterConditionType.UserVotedAny: return Properties.Resources.GroupFilterConditionType_UserVotedAny;
                case GroupFilterConditionType.VideoQuality: return Properties.Resources.GroupFilterConditionType_VideoQuality;
                case GroupFilterConditionType.AniDBRating: return Properties.Resources.GroupFilterConditionType_AniDBRating;
                case GroupFilterConditionType.UserRating: return Properties.Resources.GroupFilterConditionType_UserRating;
                case GroupFilterConditionType.SeriesCreatedDate: return Properties.Resources.GroupFilterConditionType_SeriesDate;
                case GroupFilterConditionType.EpisodeAddedDate: return Properties.Resources.GroupFilterConditionType_EpisodeAddedDate;
                case GroupFilterConditionType.EpisodeWatchedDate: return Properties.Resources.GroupFilterConditionType_EpisodeWatchedDate;
                case GroupFilterConditionType.FinishedAiring: return Properties.Resources.GroupFilterConditionType_FinishedAiring;
                case GroupFilterConditionType.AudioLanguage: return Properties.Resources.GroupFilterConditionType_AudioLanguage;
                case GroupFilterConditionType.SubtitleLanguage: return Properties.Resources.GroupFilterConditionType_SubtitleLanguage;
                case GroupFilterConditionType.HasWatchedEpisodes: return Properties.Resources.GroupFilterConditionType_HasWatchedEpisodes;
                case GroupFilterConditionType.EpisodeCount: return Properties.Resources.GroupFilterConditionType_EpisodeCount;
                case GroupFilterConditionType.CustomTags: return Properties.Resources.GroupFilterConditionType_CustomTag;

                default: return Properties.Resources.GroupFilterConditionType_AirDate;
            }
        }
        public static List<string> GetAllowedOperators(GroupFilterConditionType conditionType)
        {
            List<string> ops = new List<string>();

            switch (conditionType)
            {
                case GroupFilterConditionType.AirDate:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.GreaterThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LessThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LastXDays));
                    break;
                case GroupFilterConditionType.SeriesCreatedDate:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.GreaterThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LessThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LastXDays));
                    break;
                case GroupFilterConditionType.EpisodeWatchedDate:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.GreaterThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LessThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LastXDays));
                    break;
                case GroupFilterConditionType.EpisodeAddedDate:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.GreaterThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LessThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LastXDays));
                    break;
                case GroupFilterConditionType.AllEpisodesWatched:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.AnimeGroup:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Equals));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotEquals));
                    break;
                case GroupFilterConditionType.AnimeType:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.In));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotIn));
                    break;
                case GroupFilterConditionType.AssignedTvDBInfo:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.AssignedMALInfo:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.AssignedMovieDBInfo:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.AssignedTvDBOrMovieDBInfo:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.Tag:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.In));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotIn));
                    break;
                case GroupFilterConditionType.CustomTags:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.In));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotIn));
                    break;
                case GroupFilterConditionType.AudioLanguage:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.In));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotIn));
                    break;
                case GroupFilterConditionType.SubtitleLanguage:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.In));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotIn));
                    break;
                case GroupFilterConditionType.CompletedSeries:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.FinishedAiring:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.Favourite:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.HasUnwatchedEpisodes:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.HasWatchedEpisodes:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.MissingEpisodes:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.MissingEpisodesCollecting:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.ReleaseGroup:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.In));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotIn));
                    break;
                case GroupFilterConditionType.Studio:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.In));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotIn));
                    break;
                case GroupFilterConditionType.UserVoted:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.UserVotedAny:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Include));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.Exclude));
                    break;
                case GroupFilterConditionType.VideoQuality:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.In));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotIn));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.InAllEpisodes));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.NotInAllEpisodes));
                    break;
                case GroupFilterConditionType.AniDBRating:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.GreaterThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LessThan));
                    break;
                case GroupFilterConditionType.UserRating:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.GreaterThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LessThan));
                    break;
                case GroupFilterConditionType.EpisodeCount:
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.GreaterThan));
                    ops.Add(GetTextForEnum_Operator(GroupFilterOperator.LessThan));
                    break;
            }

            return ops;
        }