public override void FilterArticles(SearchResultsInfoCollection data) { Debug.Assert(data != null, "data must not be null"); // some conditions that we don't need to bother if (data.Count == 0) { return; } IDictionary viewableIds = DataProvider.Instance().GetViewableArticleIds(PermissionType.View.GetId()); var al = new ArrayList(); foreach (SearchResultsInfo result in data) { int articleId = Utility.GetArticleId(result); if (viewableIds.Contains(articleId) == false) { // remove this row from the results al.Add(result); } } // remove all the rows that I'm not allowed to see foreach (SearchResultsInfo result in al) { data.Remove(result); } }
public static SearchResultsInfoCollection CleanSearchList(SearchResultsInfoCollection data) { //get rid of the duplicates //some conditions that we don't need to bother if (data == null || data.Count == 0) return data; IDictionary d = new Hashtable(); var al = new ArrayList(); foreach (SearchResultsInfo result in data) { //IDictionary listOfIds = GetSearchArticleIds(data); int articleId = Utility.GetArticleId(result); if (d.Contains(articleId)) { //remove this row from the results al.Add(result); } else { d.Add(articleId, null); } } //remove all the rows that I'm not allowed to see foreach (SearchResultsInfo result in al) { data.Remove(result); } return data; }