Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        vwarDAL.ISearchProxy _SearchProxy = new DataAccessFactory().CreateSearchProxy(Context.User.Identity.Name);
        _ResultsPerPage = System.Convert.ToInt32(ResultsPerPageDropdown.SelectedValue);

        //Search
        if (!IsPostBack)
        {
            SetInitialSortValue();

            IEnumerable <ContentObject> co = GetSearchResults();

            if (co != null && co.Count() > 0)
            {
                //If it's presorted, we cannot rely on the number of items in the returned collection
                //to get the true number of objects matching the specified search query
                int totalResults = (_Presorted) ? _SearchProxy.GetContentObjectCount() : co.Count();
                BindPageNumbers(totalResults);

                ApplySearchResults(co);
            }
            else
            {
                NoneFoundLabel.Visible = true;
                NoneFoundLabel.Text    = "No models found. <br />";
                SearchList.Visible     = false;
            }
        }
        _SearchProxy.Dispose();
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        vwarDAL.ISearchProxy _SearchProxy = new DataAccessFactory().CreateSearchProxy(Context.User.Identity.Name);
        _ResultsPerPage = System.Convert.ToInt32(ResultsPerPageDropdown.SelectedValue);

        string tempUrl = "";

        string[] acceptableArray = { "Search", "Keywords", "DeveloperName", "ArtistName", "SponsorName" };

        for (int i = 0; i < acceptableArray.Length; i++)
        {
            if (Context.Request.QueryString[acceptableArray[i]] != null)
            {
                tempUrl = (acceptableArray[i] == "Keywords") ? "Keywords;" + Context.Request.QueryString[acceptableArray[i]] : Context.Request.QueryString[acceptableArray[i]];
                break;
            }
        }

        APILink.NavigateUrl = "https://" + ConfigurationManager.AppSettings["LR_Integration_APIBaseURL"] + "/Search/" + Server.UrlEncode(tempUrl) + "/json?id=00-00-00";

        //Search
        if (!IsPostBack)
        {
            SetInitialSortValue();

            IEnumerable <ContentObject> co = GetSearchResults();

            if (co != null && co.Count() > 0)
            {
                //If it's presorted, we cannot rely on the number of items in the returned collection
                //to get the true number of objects matching the specified search query
                int totalResults = (_Presorted) ? _SearchProxy.GetContentObjectCount() : co.Count();
                BindPageNumbers(totalResults);

                ApplySearchResults(co);
            }
            else
            {
                NoneFoundLabel.Visible = true;
                if (Membership.GetUser() == null)
                {
                    NoneFoundLabel.Text = "No models found. It's possible that some models are hidden by their owners. Try logging in for more results. <br />";
                }
                else
                {
                    NoneFoundLabel.Text = "No models found. It's possible that some models are hidden by their owners. <br />";
                }
                SearchList.Visible = false;
            }
        }
        _SearchProxy.Dispose();
    }
Пример #3
0
    protected void NumResultsPerPageChanged(object sender, EventArgs e)
    {
        vwarDAL.ISearchProxy _SearchProxy = new DataAccessFactory().CreateSearchProxy(Context.User.Identity.Name);
        _ResultsPerPage = System.Convert.ToInt32(ResultsPerPageDropdown.SelectedValue);

        IEnumerable <ContentObject> co = GetSearchResults();

        if (co != null)
        {
            BindPageNumbers(_Presorted
                            ? _SearchProxy.GetContentObjectCount()
                            : co.Count());
        }

        ApplySearchResults(co);
        _SearchProxy.Dispose();
    }
Пример #4
0
    protected void PageNumberChanged(object sender, EventArgs e)
    {
        vwarDAL.ISearchProxy _SearchProxy = new DataAccessFactory().CreateSearchProxy(Context.User.Identity.Name);
        //Get the page number from the value displayed to the user
        LinkButton btn = (LinkButton)sender;

        _PageNumber = System.Convert.ToInt32(btn.CommandArgument);

        IEnumerable <ContentObject> co = GetSearchResults();

        ApplySearchResults(co);

        BindPageNumbers(_Presorted
                        ? _SearchProxy.GetContentObjectCount()
                        : co.Count());
        _SearchProxy.Dispose();
    }