예제 #1
0
        private void AddHistoryEntry(string pageString, string queryString)
        {
            Regex         regex         = new Regex(".ascx", RegexOptions.IgnoreCase);
            UpdateHistory updateHistory = (UpdateHistory)_page.FindControl("uxUpdateHistory");

            updateHistory.AddEntry(regex.Replace(pageString, ",") + queryString);
        }
예제 #2
0
        private void SearchBindData(bool newSearch)
        {
            try
            {
                if (newSearch && !CheckSearchRequest())
                {
                    return;
                }
                else if (newSearch || Mession.SearchData == null)
                {
                    SearchWhatFlags sw      = (SearchWhatFlags)System.Enum.Parse(typeof(SearchWhatFlags), listSearchWhat.SelectedValue);
                    SearchWhatFlags sfw     = (SearchWhatFlags)System.Enum.Parse(typeof(SearchWhatFlags), listSearchFromWho.SelectedValue);
                    int             forumID = int.Parse(listForum.SelectedValue);

                    DataTable searchDataTable = YAF.Classes.Data.DB.GetSearchResult(txtSearchStringWhat.Text,
                                                                                    txtSearchStringFromWho.Text, sfw, sw, forumID,
                                                                                    PageContext.PageUserID, PageContext.PageBoardID,
                                                                                    PageContext.BoardSettings.ReturnSearchMax,
                                                                                    PageContext.BoardSettings.UseFullTextSearch);
                    Pager.CurrentPageIndex = 0;
                    Pager.PageSize         = int.Parse(listResInPage.SelectedValue);
                    Pager.Count            = searchDataTable.DefaultView.Count;
                    Mession.SearchData     = searchDataTable;

                    bool bResults = (searchDataTable.DefaultView.Count > 0) ? true : false;

                    SearchRes.Visible = bResults;
                    NoResults.Visible = !bResults;
                }

                PagedDataSource pds = new PagedDataSource();
                pds.AllowPaging      = true;
                pds.DataSource       = Mession.SearchData.DefaultView;
                pds.PageSize         = Pager.PageSize;
                pds.CurrentPageIndex = Pager.CurrentPageIndex;

                UpdateHistory.AddEntry(Pager.CurrentPageIndex.ToString() + "|" + Pager.PageSize);

                SearchRes.DataSource = pds;
                SearchRes.DataBind();
            }
            catch (Exception x)
            {
                YAF.Classes.Data.DB.eventlog_create(PageContext.PageUserID, this, x);
                CreateMail.CreateLogEmail(x);

                if (PageContext.IsAdmin)
                {
                    PageContext.AddLoadMessage(string.Format("{0}", x));
                }
                else
                {
                    PageContext.AddLoadMessage("An error occured while searching.");
                }
            }
        }