Esempio n. 1
0
    /// <summary>
    /// Build the search request, submit the search and process the result
    /// This is the handler for the Department searches
    /// </summary>
    private void ProcessDeptSearch()
    {
        Session["ProfileSearchRequestCriteriaList"] = new List <string>();
        Session["ProfileSearchRequestKeywordList"]  = new List <string>();

        Profiles profiles = ProfileHelper.GetNewProfilesDefinition();

        // Name
        profiles.QueryDefinition.Name.LastName.Text  = this.HTMLEncode(txtLastName.Text.Trim());
        profiles.QueryDefinition.Name.FirstName.Text = this.HTMLEncode(txtFirstName.Text.Trim());

        // Institution Selection
        if (Request.QueryString["InstName"] != null)
        {
            AffiliationInstitutionName affilInstname = new AffiliationInstitutionName();
            affilInstname.Text = this.HTMLEncode(Request.QueryString["InstName"].ToString().Trim());
            profiles.QueryDefinition.AffiliationList.Affiliation[0].InstitutionName = affilInstname;

            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(affilInstname.Text);
        }

        // Department Selection
        if (Request.QueryString["DeptName"] != null)
        {
            AffiliationDepartmentName affilDeptname = new AffiliationDepartmentName();
            affilDeptname.Text = this.HTMLEncode(Request.QueryString["DeptName"].ToString().Trim());
            profiles.QueryDefinition.AffiliationList.Affiliation[0].DepartmentName = affilDeptname;

            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(affilDeptname.Text);
        }

        profiles.Version = 2;

        // Save the search request into a session object so that the
        // object data source can use it during the Select event
        Session["ProfileSearchRequest"] = profiles;

        Session["MeshSearch"]   = 0;
        Session["WasSearchRun"] = "Y";

        _personId = GetPersonFromQueryString();
        lnkBackToProfile.NavigateUrl = "~/ProfileDetails.aspx?Person=" + _personId.ToString();
        lnkBackToProfile.Visible     = true;

        BindSearchResults(0);
    }
Esempio n. 2
0
    /// <summary>
    /// Build the search request, submit the search and process the result
    /// This is the handler for the "Mini Search" user control.
    /// </summary>
    private void ProcessMiniSearch()
    {
        Profiles profiles = ProfileHelper.GetNewProfilesDefinition();

        Session["ProfileSearchRequestCriteriaList"] = new List <string>();
        Session["ProfileSearchRequestKeywordList"]  = new List <string>();

        // Name
        if (Request.QueryString["Lname"] != null)
        {
            string lastName = this.HTMLEncode(Request.QueryString["Lname"].ToString().Trim());
            profiles.QueryDefinition.Name.LastName.Text = lastName;
            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(lastName);
        }

        // Institution Selection
        if (Request.QueryString["Institute"] != null)
        {
            string inst = this.HTMLEncode(Request.QueryString["Institute"].ToString().Trim());

            AffiliationInstitutionName affilInstname = new AffiliationInstitutionName();
            affilInstname.Text = inst;
            profiles.QueryDefinition.AffiliationList.Affiliation[0].InstitutionName = affilInstname;
            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(inst);
        }
        // Division Selection
        if (Request.QueryString["Division"] != null)
        {
            string inst = this.HTMLEncode(Request.QueryString["Division"].ToString().Trim());

            AffiliationDivisionName affilDivname = new AffiliationDivisionName();
            affilDivname.Text = inst;
            profiles.QueryDefinition.AffiliationList.Affiliation[0].DivisionName = affilDivname;
            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(inst);
        }
        // Department Selection
        if (Request.QueryString["DeptName"] != null)
        {
            AffiliationDepartmentName affilDeptname = new AffiliationDepartmentName();
            affilDeptname.Text = this.HTMLEncode(Request.QueryString["DeptName"].ToString().Trim());
            profiles.QueryDefinition.AffiliationList.Affiliation[0].DepartmentName = affilDeptname;
            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(affilDeptname.Text);
        }

        // Keywords
        if (Request.QueryString["Keyword"] != null)
        {
            string keyword = this.HTMLEncode(Request.QueryString["Keyword"].ToString().Trim());

            profiles.QueryDefinition.Keywords.KeywordString.Text = keyword;
            ((List <string>)Session["ProfileSearchRequestKeywordList"]).Add(keyword);
        }

        profiles.Version = 2;

        // Save the search request into a session object so that the
        // object data source can use it during the Select event
        Session["ProfileSearchRequest"] = profiles;


        Session["MeshSearch"]   = 0;
        Session["WasSearchRun"] = "Y";

        BindSearchResults(0);
    }
Esempio n. 3
0
    /// <summary>
    /// Build the search request, submit the search and process the result.
    /// This is the handler for the main search using the full set of criteria
    /// </summary>
    private void ProcessProfileSearch()
    {
        Profiles searchReq = ProfileHelper.GetNewProfilesDefinition();

        string lastName  = this.HTMLEncode(txtLastName.Text.Trim());
        string firstName = this.HTMLEncode(txtFirstName.Text.Trim());

        Session["ProfileSearchRequestCriteriaList"] = new List <string>();
        Session["ProfileSearchRequestKeywordList"]  = new List <string>();

        // Reset current page number
        Session["ProfileSearchResultsPage"] = 0;

        grdSearchResults.DataSource = null;

        // Name
        if (lastName.Length > 0)
        {
            searchReq.QueryDefinition.Name.LastName.Text = lastName.Trim();
            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(lastName);
        }

        if (firstName.Length > 0)
        {
            searchReq.QueryDefinition.Name.FirstName.Text = firstName.Trim();
            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(firstName);
        }

        // Institution Selection
        if (ddlInstitution.SelectedIndex != 0)
        {
            AffiliationInstitutionName affilInstname = new AffiliationInstitutionName();
            affilInstname.Text = ddlInstitution.SelectedItem.Text;
            searchReq.QueryDefinition.AffiliationList.Affiliation[0].InstitutionName = affilInstname;

            // Set the appropriate message on the right
            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(chkInstitution.Checked == true ? "All except " + affilInstname.Text : affilInstname.Text);

            searchReq.QueryDefinition.AffiliationList.Affiliation[0].InstitutionName.Exclude = chkInstitution.Checked;
        }

        // Division Selection
        if (ddlDivision.SelectedIndex != 0)
        {
            AffiliationDivisionName affilDivname = new AffiliationDivisionName();
            affilDivname.Text = ddlDivision.SelectedItem.Text;
            searchReq.QueryDefinition.AffiliationList.Affiliation[0].DivisionName = affilDivname;

            // Set the appropriate message on the right
            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(chkInstitution.Checked == true ? "All except " + affilDivname.Text : affilDivname.Text);

            searchReq.QueryDefinition.AffiliationList.Affiliation[0].DivisionName.Exclude = chkDivision.Checked;
        }


        // Department Selection
        if (ddlDepartment.SelectedIndex != 0)
        {
            AffiliationDepartmentName affilDeptname = new AffiliationDepartmentName();
            affilDeptname.Text = ddlDepartment.SelectedItem.Text;
            searchReq.QueryDefinition.AffiliationList.Affiliation[0].DepartmentName = affilDeptname;

            // Set the appropriate message on the right
            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(chkDepartment.Checked == true ? "All except " + affilDeptname.Text : affilDeptname.Text);

            searchReq.QueryDefinition.AffiliationList.Affiliation[0].DepartmentName.Exclude = chkDepartment.Checked;
        }

        // Faculty Selection
        if (ddlFacultyRank.SelectedIndex != 0)
        {
            FacultyRankList ftList = new FacultyRankList();

            searchReq.QueryDefinition.FacultyRankList             = new FacultyRankList();
            searchReq.QueryDefinition.FacultyRankList.FacultyRank = new List <string>();

            searchReq.QueryDefinition.FacultyRankList.FacultyRank.Add(ddlFacultyRank.SelectedItem.Value.ToString());

            ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(ddlFacultyRank.SelectedItem.Text);
        }

        // Person Filter Section
        HiddenField  hdnSelectedText = ((HiddenField)ctcFirst.FindControl("hdnSelectedText"));
        PersonFilter pf;

        searchReq.QueryDefinition.PersonFilterList = new PersonFilterList();

        if ((hdnSelectedText.Value.Length > 0) && (hdnSelectedText.Value != "--Select--"))
        {
            string[] pfArray = hdnSelectedText.Value.Split(',');

            for (int i = 0; i < pfArray.Length; i++)
            {
                pf      = new PersonFilter();
                pf.Text = pfArray[i];

                searchReq.QueryDefinition.PersonFilterList.Add(pf);

                ((List <string>)Session["ProfileSearchRequestCriteriaList"]).Add(pfArray[i]);
            }
        }

        // Keywords
        if (txtKeyword.Text.Trim().Length > 0)
        {
            string keywordString;

            if (chkKeyword.Checked == true)
            {
                keywordString = this.HTMLEncode(txtKeyword.Text.Trim().Replace("\"", ""));

                searchReq.QueryDefinition.Keywords.KeywordString.Text      = keywordString;
                searchReq.QueryDefinition.Keywords.KeywordString.MatchType = KeywordMatchType.exact;
                ((List <string>)Session["ProfileSearchRequestKeywordList"]).Add(keywordString);
            }
            else
            {
                keywordString = this.HTMLEncode(txtKeyword.Text.Trim());

                searchReq.QueryDefinition.Keywords.KeywordString.Text = keywordString;


                ((List <string>)Session["ProfileSearchRequestKeywordList"]).Add(keywordString);
            }
        }

        searchReq.Version = 2;

        // Save the search request into a session object so that the
        // object data source can use it during the Select event


        Session["ProfileSearchRequest"] = searchReq;

        Session["MeshSearch"]      = 0;
        Session["SearchPageIndex"] = 0;
        Session["WasSearchRun"]    = "Y";

        // Get results bound to grid
        BindSearchResults(0);

        SetBackPageURL();
    }