/// <summary> /// Connects to database and search by search word. /// </summary> /// <param name="offset">Paging offset.</param> /// <param name="limit">Paging limit.</param> /// <param name="Searchword">Search word.</param> /// <param name="SearchBy">Searching user's name.</param> /// <param name="CultureName">Culture name.</param> /// <param name="IsUseFriendlyUrls">Set true if the url is user friendly.</param> /// <param name="PortalID">Portal ID.</param> /// <returns>List of Search contents.</returns> public List <SageFrameSearchInfo> SageSearchBySearchWord(int offset, int limit, string Searchword, string SearchBy, string CultureName, bool IsUseFriendlyUrls, int PortalID) { try { List <SageFrameSearchInfo> searchList = new List <SageFrameSearchInfo>(); SQLHandler sagesql = new SQLHandler(); DataSet ds = new DataSet(); ds = sagesql.ExecuteScriptAsDataSet("[dbo].[sp_SageSearchBySearchKey] N'" + Searchword + "','" + SearchBy + "','" + IsUseFriendlyUrls + "','" + CultureName + "','" + PortalID + "','" + offset + "'," + limit); foreach (DataRow row in ds.Tables[0].Rows) { SageFrameSearchInfo obj = new SageFrameSearchInfo(); obj.RowTotal = Convert.ToInt32(row["RowTotal"]); obj.PageName = row["PageName"].ToString(); obj.HTMLContent = row["HTMLContent"].ToString(); obj.URL = row["URL"].ToString(); obj.UpdatedContentOn = row["UpdatedContentOn"].ToString(); obj.SearchWord = row["SearchWord"].ToString(); searchList.Add(obj); } return(searchList); } catch (Exception e) { throw e; } }
/// <summary> /// Connects to database and search by search word. /// </summary> /// <param name="offset">Paging offset.</param> /// <param name="limit">Paging limit.</param> /// <param name="Searchword">Search word.</param> /// <param name="SearchBy">Searching user's name.</param> /// <param name="CultureName">Culture name.</param> /// <param name="IsUseFriendlyUrls">Set true if the url is user friendly.</param> /// <param name="PortalID">Portal ID.</param> /// <returns>List of Search contents.</returns> public List <SageFrameSearchInfo> SageSearchBySearchWord(int offset, int limit, string Searchword, string SearchBy, string CultureName, bool IsUseFriendlyUrls, int PortalID) { try { List <SageFrameSearchInfo> searchList = new List <SageFrameSearchInfo>(); string spName = "[dbo].[sp_SageFrameFreeSearch11]"; List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@searchtxt", Searchword)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@offset", offset)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@limit", limit)); SQLHandler sagesql = new SQLHandler(); DataSet ds = new DataSet(); ds = sagesql.ExecuteAsDataSet(spName, ParaMeterCollection); if (ds != null && ds.Tables[0].Rows != null && ds.Tables[0].Rows.Count > 0) { int rowCount = Convert.ToInt32(ds.Tables[0].Rows[0]["RowTotal"]); if (rowCount <= 0) { rowCount = ds.Tables[0].Rows.Count; } foreach (DataRow row in ds.Tables[0].Rows) { SageFrameSearchInfo obj = new SageFrameSearchInfo(); obj.HTMLContent = row["HTMLContent"].ToString(); obj.TabPath = row["TabPath"].ToString(); obj.URL = row["URL"].ToString(); obj.RowTotal = rowCount; obj.PageName = string.Empty; obj.SearchWord = Searchword; obj.UpdatedContentOn = string.Empty; obj.UserModuleTitle = string.Empty; searchList.Add(obj); } } return(searchList); } catch (Exception e) { throw e; } }
/// <summary> /// Connects to database and returns list of search contents. /// </summary> /// <param name="offset">Paging offset.</param> /// <param name="limit">Paging limit.</param> /// <param name="Searchword">Search word.</param> /// <param name="SearchBy">Searching user's name.</param> /// <param name="CultureName">Culture name.</param> /// <param name="IsUseFriendlyUrls">Set true if the URL is user friendly.</param> /// <param name="PortalID">Portal ID.</param> /// <returns>list of search contents</returns> public List <SageFrameSearchInfo> GetSageSearchResultBySearchWord(int offset, int limit, string Searchword, string SearchBy, string CultureName, bool IsUseFriendlyUrls, int PortalID) { SqlDataReader reader = null; try { List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@Searchword", Searchword)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@CultureName", CultureName)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@IsUseFriendlyUrls", IsUseFriendlyUrls)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@SearchBy", SearchBy)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", PortalID)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@offset", offset)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@limit", limit)); SQLHandler Objsql = new SQLHandler(); reader = Objsql.ExecuteAsDataReader("[dbo].[sp_HtmlContentSearch]", ParaMeterCollection); List <SageFrameSearchInfo> searchList = new List <SageFrameSearchInfo>(); while (reader.Read()) { SageFrameSearchInfo obj = new SageFrameSearchInfo(); obj.RowTotal = Convert.ToInt32(reader["RowTotal"]); obj.PageName = reader["PageName"].ToString(); obj.HTMLContent = reader["HTMLContent"].ToString(); obj.URL = reader["URL"].ToString(); obj.UpdatedContentOn = reader["UpdatedContentOn"].ToString(); searchList.Add(obj); } return(searchList); } catch (Exception e) { throw e; } finally { if (reader != null) { reader.Close(); } } }