Example #1
0
        /// <summary>
        /// Get Search Results View .. Search Post will be done through Ajax method - RaviM
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public ActionResult SearchResults(int start = 1, string range = "20")
        {
            SearchBL.SearchForm obj = new SearchBL.SearchForm();
            if (Session["SearchLimits"] != null)
            {
                SearchBL.MyQueryForm myQyeryForm = new SearchBL.MyQueryForm();
                int userid = CurrentUser.UserId;

                obj = (SearchBL.SearchForm)Session["SearchLimits"];
                int RangeCount = int.Parse(range);
                myQyeryForm.searchInfo = SearchBL.GetSearchInfo(userid, obj.SearchName, Convert.ToInt32(obj.SearchId));

                obj.ArticlesList = SearchBL.SearchFetchRange(userid, obj.SearchName, obj.SearchId, start, start + (RangeCount - 1));
                StringBuilder str = new StringBuilder();

                if (obj.ArticlesList != null)
                {
                    foreach (var item in obj.ArticlesList)
                    {
                        str.Append(item.PMID + ",");
                    }
                }

                string PMIDList = str.ToString();

                if (!string.IsNullOrEmpty(PMIDList))
                {
                    PMIDList = PMIDList.Remove(PMIDList.LastIndexOf(','), 1);
                }
                obj.AllCitationDetails = SearchBL.GetAllCitationAbstract(CurrentUser.UserId, PMIDList, 2, 1);
                obj.QueryDetails       = myQyeryForm.searchInfo.QueryDetails;
                obj.ErrorDesc          = myQyeryForm.searchInfo.ErrorDesc;
                obj.CitationCount      = Convert.ToInt32(myQyeryForm.searchInfo.SearchResultsCount);
                obj.TopicsList         = SearchBL.GetTopicsList(CurrentUser.UserId);

                Session["SearchLimits"] = obj;

                obj.DisplayCount = range;
                if (Session["SearchResults"] != null)
                {
                    SearchBL.SearchForm keep = (SearchBL.SearchForm)Session["SearchResults"];
                    obj.showGoToDestionation = keep.showGoToDestionation; obj.TopicFolderID = keep.FolderID; obj.SpecId = keep.SpecId; obj.resultFolder2 = keep.resultFolder2;
                }

                Session["SearchResults"] = null;
                return(View(obj));
            }
            else
            {
                return(RedirectToAction("Search", "Search"));
            }

            return(View(obj));
        }