Beispiel #1
0
        /// <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;
            }
        }
        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;
            }
        }