public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo) { DotNetNuke.Services.Search.SearchItemInfoCollection SearchItemCollection = new DotNetNuke.Services.Search.SearchItemInfoCollection(); IDataReader dr = null; try { dr = DataProvider.Instance().Search_DotNetNuke(ModInfo.ModuleID); DotNetNuke.Services.Search.SearchItemInfo SearchItem = null; while (dr.Read()) { string subject = dr["Subject"].ToString(); string description = string.Empty; string body = dr["Body"].ToString(); int authorid = Convert.ToInt32(dr["AuthorId"]); DateTime datecreated = Convert.ToDateTime(dr["DateCreated"]); DateTime dateupdated = Convert.ToDateTime(dr["DateUpdated"]); int contentid = Convert.ToInt32(dr["ContentId"]); int forumid = Convert.ToInt32(dr["ForumId"]); int topicid = Convert.ToInt32(dr["TopicId"]); int replyId = Convert.ToInt32(dr["ReplyId"]); int jumpid = topicid; if (replyId > 0) { jumpid = replyId; } body = System.Web.HttpUtility.HtmlDecode(body); body = Utilities.StripHTMLTag(body); if (!(string.IsNullOrEmpty(body))) { if (body.Length > 100) { description = body.Substring(0, 100) + "..."; } else { description = body; } } SearchItem = new DotNetNuke.Services.Search.SearchItemInfo(subject, description, authorid, datecreated, ModInfo.ModuleID, contentid.ToString() + "-" + forumid.ToString(), body, ParamKeys.ForumId + "=" + forumid + "&" + ParamKeys.ViewType + "=" + Views.Topic + "&" + ParamKeys.TopicId + "=" + topicid + "&" + ParamKeys.ContentJumpId + "=" + jumpid); SearchItemCollection.Add(SearchItem); } dr.Close(); return(SearchItemCollection); } catch (Exception ex) { return(null); } finally { if (dr != null) { if (!dr.IsClosed) { dr.Close(); } } } }
public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo) { DotNetNuke.Services.Search.SearchItemInfoCollection SearchItemCollection = new DotNetNuke.Services.Search.SearchItemInfoCollection(); IDataReader dr = null; try { dr = DataProvider.Instance().Search_DotNetNuke(ModInfo.ModuleID); DotNetNuke.Services.Search.SearchItemInfo SearchItem = null; while (dr.Read()) { string subject = dr["Subject"].ToString(); string description = string.Empty; string body = dr["Body"].ToString(); int authorid = Convert.ToInt32(dr["AuthorId"]); DateTime datecreated = Convert.ToDateTime(dr["DateCreated"]); DateTime dateupdated = Convert.ToDateTime(dr["DateUpdated"]); int contentid = Convert.ToInt32(dr["ContentId"]); int forumid = Convert.ToInt32(dr["ForumId"]); int topicid = Convert.ToInt32(dr["TopicId"]); int replyId = Convert.ToInt32(dr["ReplyId"]); int jumpid = topicid; if (replyId > 0) { jumpid = replyId; } body = System.Web.HttpUtility.HtmlDecode(body); body = Utilities.StripHTMLTag(body); if (! (string.IsNullOrEmpty(body))) { if (body.Length > 100) { description = body.Substring(0, 100) + "..."; } else { description = body; } } SearchItem = new DotNetNuke.Services.Search.SearchItemInfo(subject, description, authorid, datecreated, ModInfo.ModuleID, contentid.ToString() + "-" + forumid.ToString(), body, ParamKeys.ForumId + "=" + forumid + "&" + ParamKeys.ViewType + "=" + Views.Topic + "&" + ParamKeys.TopicId + "=" + topicid + "&" + ParamKeys.ContentJumpId + "=" + jumpid); SearchItemCollection.Add(SearchItem); } dr.Close(); return SearchItemCollection; } catch (Exception ex) { return null; } finally { if (dr != null) { if (! dr.IsClosed) { dr.Close(); } } } }