public void NewsSearch(IConnectionHandler connectionHandler, Guid congressId, string txtvalue, List <Tools.ModelView.SerachResultvalue> resultvalues) { var @select = NewsComponent.Instance.NewsContentFacade.Where( x => x.Body.Contains(txtvalue) || x.Lead.Contains(txtvalue) || x.Title1.Contains(txtvalue) || x.Title2.Contains(txtvalue)); if ([email protected]()) { return; } var enumerable = @select.Select(x => x.Id); var newses1 = new CongressNewsBO().Select(connectionHandler, x => x.News, c => c.CongressId == congressId && c.NewsId.In(enumerable)); if (!newses1.Any()) { return; } foreach (var VARIABLE in newses1) { var firstOrDefault = @select.FirstOrDefault(x => x.Id == VARIABLE.Id); if (firstOrDefault == null) { continue; } var resultvalue = new Tools.ModelView.SerachResultvalue(); resultvalue.Key = VARIABLE.Id.ToString(); resultvalue.ResultValue = firstOrDefault.Title1; resultvalue.SearchType = Enums.SearchType.News; resultvalues.Add(resultvalue); } }
public void ContenetSearch(IConnectionHandler connectionHandler, Guid congressId, string txtvalue, List <Tools.ModelView.SerachResultvalue> resultvalues) { var content = ContentManagerComponent.Instance.ContentContentFacade.Where( c => c.Text.Contains(txtvalue) || c.Title.Contains(txtvalue) || c.Abstract.Contains(txtvalue)); if (!content.Any()) { return; } var ints = content.Select(x => x.Id); var contents = new CongressContentBO().Select(connectionHandler, x => x.Content, c => c.CongressId == congressId && c.ContentId.In(ints)); if (!contents.Any()) { return; } foreach (var VARIABLE in contents) { var firstOrDefault = content.FirstOrDefault(x => x.Id == VARIABLE.Id); if (firstOrDefault == null) { continue; } var resultvalue = new Tools.ModelView.SerachResultvalue(); resultvalue.Key = VARIABLE.Id.ToString(); resultvalue.ResultValue = firstOrDefault.Title; resultvalue.SearchType = Enums.SearchType.Content; resultvalues.Add(resultvalue); } }