private void DrawProfilesModule() { Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); Search.Utilities.DataIO search = new Profiles.Search.Utilities.DataIO(); XmlDocument xml = data.GetSameDepartment(base.RDFTriple); List<ListItem> items = new List<ListItem>(); string departmenturi = xml.SelectSingleNode("Network/DepartmentURI").InnerText; string insitutitionuri = xml.SelectSingleNode("Network/InstitutionURI").InnerText; string searchrequest = string.Empty; search.SearchRequest("", "", "", "", insitutitionuri, "", departmenturi, "", "", "", "http://xmlns.com/foaf/0.1/Person", "25", "0", "", "", "", ref searchrequest); this.SearchRequest = searchrequest; foreach (XmlNode n in xml.SelectNodes("Network/Connection")) { items.Add(new ListItem(n.InnerText, n.SelectSingleNode("@URI").Value)); } rptSameDepartment.DataSource = items; rptSameDepartment.DataBind(); }
public static string BuildDropdown(string type, string width, string defaultitem) { Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); string output = string.Empty; List<GenericListItem> list = new List<GenericListItem>(); switch (type) { case "institution": list = data.GetInstitutions(); break; case "department": list = data.GetDepartments(); break; case "division": list = data.GetDivisions(); break; } //if (defaultitem.IsNullOrEmpty()) output += "<option value=\"\"></option>"; foreach (GenericListItem item in list) { if (!defaultitem.IsNullOrEmpty() && defaultitem == item.Value) output += "<option selected=\"true\" value=\"" + item.Value + "\">" + item.Text + "</option>"; else output += "<option value=\"" + item.Value + "\">" + item.Text + "</option>"; } return "<select title=\"" + type + "\" name=\"" + type + "\" id=\"" + type + "\" style=\"width:" + width + "px\">" + output + "</select>"; }
public static string BuildDropdown(string type,string width) { Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); string output = string.Empty; List<GenericListItem> list = new List<GenericListItem>(); switch (type) { case "institution": list = data.GetInstitutions(); break; case "department": list = data.GetDepartments(); break; case "division": list = data.GetDivisions(); break; } output += "<option value=\"\"> -- Select One -- </option>"; foreach (GenericListItem item in list) { output += "<option value=\"" + item.Value + "\">" + item.Text + "</option>"; } return "<select id=\"" + type + "\" style=\"width:" + width + "\">" + output + "</select>"; }
private void DrawProfilesModule() { System.Text.StringBuilder list = new StringBuilder(); Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); SqlDataReader reader = data.TopSearchPhrase(base.GetModuleParamString("TimePeriod")); litDescription.Text = base.GetModuleParamString("Description"); list.Append("<ul>"); string classuri = "http://xmlns.com/foaf/0.1/Person"; string searchtype = string.Empty; if (base.MasterPage.Tab.ToLower() == "all") { classuri = string.Empty; searchtype = "everything"; } else { searchtype = "people"; } while (reader.Read()) { list.Append("<li>"); list.Append("<a href=\"JavaScript:searchThisPhrase('" + reader["phrase"].ToString() + "','" + classuri + "','" + searchtype + "')\">" + reader["phrase"] + "</a>"); list.Append("</li>"); } list.Append("</ul>"); litTopSearchPhrase.Text = list.ToString(); }
private void DrawProfilesModule() { Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); Search.Utilities.DataIO search = new Profiles.Search.Utilities.DataIO(); XmlDocument xml = data.GetSameDepartment(base.RDFTriple); List <ListItem> items = new List <ListItem>(); if (xml.SelectSingleNode("Network/NumberOfConnections").InnerText != "0") { string departmenturi = xml.SelectSingleNode("Network/DepartmentURI").InnerText; string insitutitionuri = xml.SelectSingleNode("Network/InstitutionURI").InnerText; string searchrequest = string.Empty; search.SearchRequest("", "", "", "", insitutitionuri, "", departmenturi, "", "", "", "http://xmlns.com/foaf/0.1/Person", "25", "0", "", "", "", "", false, ref searchrequest); this.SearchRequest = searchrequest; foreach (XmlNode n in xml.SelectNodes("Network/Connection")) { items.Add(new ListItem(n.InnerText, n.SelectSingleNode("@URI").Value)); } rptSameDepartment.DataSource = items; rptSameDepartment.DataBind(); } else { rptSameDepartment.Visible = false; } }
public static string BuildDropdown(string type, string width, string defaultitem) { Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); string output = string.Empty; List <GenericListItem> list = new List <GenericListItem>(); /* * switch (type) * { * case "institution": * list = data.GetInstitutions(); * break; * * case "department": * list = data.GetDepartments(); * break; * case "division": * list = data.GetDivisions(); * break; * } */ list = data.GetCountries(); //if (defaultitem.IsNullOrEmpty()) output += "<option value=\"\">All Countries</option>"; foreach (GenericListItem item in list) { if (!defaultitem.IsNullOrEmpty() && defaultitem == item.Value) { output += "<option selected=\"true\" value=\"" + item.Value + "\">" + item.Text + "</option>"; } else { output += "<option value=\"" + item.Value + "\">" + item.Text + "</option>"; } } return("<select title=\"" + type + "\" name=\"" + type + "\" id=\"" + type + "\" style=\"width:" + width + "px\">" + output + "</select>"); }
private void BuildLinks() { string tab = string.Empty; string searchfor = string.Empty; string searchrequest = string.Empty; tab = Request.QueryString["tab"]; if (Request.QueryString["searchtype"] == "everything") { tab = "all"; } litModifySearch.Text = "<a href=\"javascript:modify('" + Root.Domain + "','" + tab + "','" + base.MasterPage.SearchRequest + "');\">" + "Modify Search" + "</a>"; if (Request.QueryString["searchfor"].IsNullOrEmpty()) { searchfor = Request.Form["txtSearchFor"]; } else { searchfor = Request.QueryString["searchfor"]; } if (searchfor.IsNullOrEmpty()) { Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); XmlDocument xmlsearchrequest = new XmlDocument(); searchrequest = data.DecryptRequest(base.MasterPage.SearchRequest); xmlsearchrequest.LoadXml(searchrequest); if (xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString") != null) { searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText; } } litSearchOtherInstitutions.Text = "<a href='" + Root.Domain + "/direct/default.aspx?keyword=" + searchfor + "&searchrequest=" + base.MasterPage.SearchRequest + "&searchtype=" + Request.QueryString["searchtype"] + "'>" + "Search Other Institutions" + "</a>"; }
private void ModifySearch() { Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); string searchrequest = string.Empty; XmlDocument request = new XmlDocument(); if (base.MasterPage.SearchRequest != null && Request.QueryString["searchrequest"] == null) { searchrequest = base.MasterPage.SearchRequest; } else if (Request.QueryString["searchrequest"].IsNullOrEmpty() == false) { searchrequest = Request.QueryString["searchrequest"]; } request.LoadXml(data.DecryptRequest(searchrequest)); if (request.SelectSingleNode("SearchOptions/MatchOptions/SearchString") != null) { searchfor.Text = request.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText; } if (request.SelectSingleNode("SearchOptions/MatchOptions/SearchString/@ExactMatch") != null) { switch (request.SelectSingleNode("SearchOptions/MatchOptions/SearchString/@ExactMatch").Value.ToLower()) { case "true": chkExactPhrase.Checked = true; break; case "false": chkExactPhrase.Checked = false; break; } } }
public string GetKeyword() { string searchfor = string.Empty; if (Request.QueryString["searchfor"] != null) { searchfor = Request.QueryString["searchfor"]; } else if (Request.Form["txtSearchFor"] != null) { searchfor = Request.Form["txtSearchFor"]; } else { Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); XmlDocument xmlsearchrequest = new XmlDocument(); if (String.IsNullOrEmpty(Request.QueryString["searchrequest"]) == false) { xmlsearchrequest.LoadXml(data.DecryptRequest(Request.QueryString["searchrequest"])); } else if (string.IsNullOrEmpty(base.MasterPage.SearchRequest) == false) { xmlsearchrequest.LoadXml(data.DecryptRequest(base.MasterPage.SearchRequest)); } if (xmlsearchrequest.ChildNodes.Count > 0) { try { searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText; } catch (Exception) { // Do nothing, leave searchfor = null } } } return(searchfor); }
private void DrawProfilesModule() { System.Text.StringBuilder list = new StringBuilder(); Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); SqlDataReader reader = data.TopSearchPhrase(base.GetModuleParamString("TimePeriod")); litDescription.Text = base.GetModuleParamString("Description"); list.Append("<ul>"); string classuri = "http://xmlns.com/foaf/0.1/Person"; string searchtype = string.Empty; if (base.MasterPage.Tab.ToLower() == "all") { classuri = string.Empty; searchtype = "everything"; } else { searchtype = "people"; } while (reader.Read()) { list.Append("<li>"); list.Append("<a href=\"JavaScript:searchThisPhrase('" + reader["phrase"].ToString() + "','" + classuri + "','" + searchtype + "')\">" + reader["phrase"] + "</a>"); list.Append("</li>"); } list.Append("</ul>"); litTopSearchPhrase.Text = list.ToString(); }
private void Search() { XmlDocument searchresults; Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); List <EntityState> es = new List <EntityState>(); string searchuri = string.Empty; searchuri = ddlPropertyList.SelectedValue; searchresults = data.Search(data.SearchRequest(txtKeyword.Text.Trim(), "false", "", searchuri, "100", "0"), true); foreach (XmlNode x in searchresults.SelectNodes("SearchResults/Network/Connection")) { es.Add(new EntityState(x.InnerText, x.SelectSingleNode("@URI").Value)); } gridSearchResults.DataSource = es; gridSearchResults.DataBind(); pnlProxySearchResults.Visible = true; }
public string GetKeyword() { string searchfor = string.Empty; if (Request.QueryString["searchfor"] != null) { searchfor = Request.QueryString["searchfor"]; } else if (Request.Form["txtSearchFor"] != null) { searchfor = Request.Form["txtSearchFor"]; } else { Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); XmlDocument xmlsearchrequest = new XmlDocument(); if (String.IsNullOrEmpty(Request.QueryString["searchrequest"]) == false) { xmlsearchrequest.LoadXml(data.DecryptRequest(Request.QueryString["searchrequest"])); } else if (string.IsNullOrEmpty(base.MasterPage.SearchRequest) == false) { xmlsearchrequest.LoadXml(data.DecryptRequest(base.MasterPage.SearchRequest)); } if (xmlsearchrequest.ChildNodes.Count > 0) { try { searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText; } catch (Exception) { // Do nothing, leave searchfor = null } } } return searchfor; }
private void ModifySearch() { Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); string searchrequest = string.Empty; XmlDocument request = new XmlDocument(); if (base.MasterPage.SearchRequest != null && Request.QueryString["searchrequest"]==null) { searchrequest = base.MasterPage.SearchRequest; } else if (Request.QueryString["searchrequest"].IsNullOrEmpty() == false) { searchrequest = Request.QueryString["searchrequest"]; } request.LoadXml(data.DecryptRequest(searchrequest)); if (request.SelectSingleNode("SearchOptions/MatchOptions/SearchString") != null) { searchfor.Text = request.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText; } if (request.SelectSingleNode("SearchOptions/MatchOptions/SearchString/@ExactMatch") != null) { switch (request.SelectSingleNode("SearchOptions/MatchOptions/SearchString/@ExactMatch").Value.ToLower()) { case "true": chkExactPhrase.Checked = true; break; case "false": chkExactPhrase.Checked = false; break; } } }
private void DrawProfilesModule() { Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); SessionManagement sm = new SessionManagement(); string subject = sm.Session().SessionID.ToString(); if (sm.Session().UserID == 0) Response.Redirect(Root.Domain + "/search"); litBackLink.Text = "<b>Search Proxies</b>"; if (Request.QueryString["fname"] != null) { txtFirstName.Text = Request.QueryString["fname"]; this.Fname = Request.QueryString["fname"]; } if (Request.QueryString["lname"] != null) { txtLastName.Text = Request.QueryString["lname"]; this.Lname = Request.QueryString["lname"]; } drpInstitution.DataSource = data.GetInstitutions(); drpInstitution.DataTextField = "Text"; drpInstitution.DataValueField = "Value"; drpInstitution.DataBind(); drpInstitution.Items.Insert(0, new ListItem("--Select--")); if (Request.QueryString["institution"] != null) { drpInstitution.SelectedIndex = drpInstitution.Items.IndexOf(drpInstitution.Items.FindByText(Request.QueryString["institution"])); this.Institution = Request.QueryString["institution"]; } drpDepartment.DataSource = data.GetDepartments(); drpDepartment.DataTextField = "Text"; drpDepartment.DataValueField = "Value"; drpDepartment.DataBind(); drpDepartment.Items.Insert(0, new ListItem("--Select--")); if (Request.QueryString["department"] != null) { drpDepartment.SelectedIndex = drpDepartment.Items.IndexOf(drpDepartment.Items.FindByText(Request.QueryString["department"])); this.Department = Request.QueryString["department"]; } drpDivision.DataSource = data.GetDivisions(); drpDivision.DataTextField = "Text"; drpDivision.DataValueField = "Value"; drpDivision.DataBind(); drpDivision.Items.Insert(0, new ListItem("--Select--")); if (Request.QueryString["division"] != null) { drpDivision.SelectedIndex = drpDivision.Items.IndexOf(drpDivision.Items.FindByText(Request.QueryString["division"])); this.Division = Request.QueryString["division"]; } this.Subject = Convert.ToInt64(Request.QueryString["subject"]); if (Request.QueryString["offset"] != null && Request.QueryString["totalrows"] != null) { this.ExecuteSearch(); } }
protected void DrawUIOnLoad() { oDataIO = new DIRECT.Utilities.DataIO(); Profiles.DIRECT.Utilities.DataIO searchDataIO; Profiles.Search.Utilities.DataIO profileDataIO; string DirectServiceURL = Root.Domain + "/DIRECT/Modules/DirectSearch/directservice.aspx";// Request.Url.AbsoluteUri.Replace("&", "&"); string ProfilesURL = Root.Domain; string PopulationTypeText = oDataIO.GetDirectConfig().PopulationType; int QueryTimeout = oDataIO.GetDirectConfig().Timeout; XmlDocument query = new XmlDocument(); XmlDocument result; Framework.Utilities.Namespace rdfnamespaces = new Namespace(); XmlNamespaceManager namespaces = null; string sql = string.Empty; string ResultDetailsURL = string.Empty; string strResult = ""; SqlDataReader dr; if (Request["Request"] == null) { return; } string task = Request["Request"].ToLower(); switch (task) { case "getsites": string ResultStr = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + "<site-list>"; dr = oDataIO.GetSitesOrderBySortOrder(); while (dr.Read()) { Int64 SiteID = Convert.ToInt64(dr["SiteID"]); string SiteName = dr["SiteName"].ToString(); string QueryURL = dr["QueryURL"].ToString(); if (SiteName == null) SiteName = ""; if (QueryURL == null) QueryURL = ""; ResultStr = ResultStr + "<site-description><site-id>" + SiteID + "</site-id><name>" + cx(SiteName) + "</name><aggregate-query>" + cx(QueryURL) + "</aggregate-query></site-description>"; } if (!dr.IsClosed) dr.Close(); ResultStr += "</site-list>"; Response.ContentType = "text/xml"; Response.AddHeader("Content-Type", "text/xml;charset=UTF-8"); //Response.ContentEncoding.CodePage = 65001; Response.Charset = "UTF-8"; Response.Write(ResultStr); break; case "incomingcount": string q = Request["SearchPhrase"].Trim(); // Enter log record sql = "insert into [Direct.].LogIncoming(Details,ReceivedDate,RequestIP,QueryString) " + " values (0,GetDate()," + cs(Request.ServerVariables["REMOTE_ADDR"]) + "," + cs(q) + ")"; oDataIO.ExecuteSQLDataCommand(sql); // Execute query string x = "<SearchOptions>" + "<MatchOptions>" + "<SearchString ExactMatch=\"false\">" + cx(q) + "</SearchString> " + "<SearchFiltersList /> " + "<ClassURI>http://xmlns.com/foaf/0.1/Person</ClassURI> " + "</MatchOptions>" + "<OutputOptions>" + "<Offset>0</Offset>" + "<Limit>1</Limit> " + "<SortByList>" + "</SortByList>" + "</OutputOptions>" + "</SearchOptions>"; query.LoadXml(x); profileDataIO = new Profiles.Search.Utilities.DataIO(); result = profileDataIO.Search(query,false); namespaces = rdfnamespaces.LoadNamespaces(result); string ResultCount = result.SelectSingleNode("rdf:RDF/rdf:Description/prns:numberOfConnections", namespaces).InnerText; // Form result message ResultStr = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; ResultStr += "<aggregation-result>"; ResultStr += "<count>" + ResultCount + "</count>"; ResultStr += "<population-type>" + PopulationTypeText + "</population-type>"; ResultStr += "<preview-URL>" + DirectServiceURL + "?Request=IncomingPreview&SearchPhrase=" + cx(q) + "</preview-URL>"; ResultStr += "<search-results-URL>" + DirectServiceURL + "?Request=IncomingDetails&SearchPhrase=" + cx(q) + "</search-results-URL>"; ResultStr += "</aggregation-result>"; // Send result Response.ContentType = "text/xml"; Response.AddHeader("Content-Type", "text/xml;charset=UTF-8"); //Response.ContentEncoding.CodePage = 65001; Response.Charset = "UTF-8"; Response.Write(ResultStr); break; case "incomingdetails": q = Request["SearchPhrase"].Trim(); // Enter log record sql = "insert into [Direct.].LogIncoming(Details,ReceivedDate,RequestIP,QueryString) "; sql += " values (1,GetDate()," + cs(Request.ServerVariables["REMOTE_ADDR"]) + "," + cs(q) + ")"; oDataIO.ExecuteSQLDataCommand(sql); // Execute query query.LoadXml("<SearchOptions>" + "<MatchOptions>" + "<SearchString ExactMatch=\"false\">" + cx(q) + "</SearchString> " + "<SearchFiltersList /> " + "<ClassURI>http://xmlns.com/foaf/0.1/Person</ClassURI> " + "</MatchOptions>" + "<OutputOptions>" + "<Offset>0</Offset>" + "<Limit>1</Limit> " + "<SortByList>" + "</SortByList>" + "</OutputOptions>" + "</SearchOptions>"); profileDataIO = new Profiles.Search.Utilities.DataIO(); result = profileDataIO.Search(query,false); strResult = result.InnerXml; // Parse results XmlDocument objDoc = new XmlDocument(); objDoc = new XmlDocument(); objDoc.LoadXml(strResult); namespaces = rdfnamespaces.LoadNamespaces(result); ResultCount = result.SelectSingleNode("rdf:RDF/rdf:Description/prns:numberOfConnections", namespaces).InnerText; if (ProfilesURL.Substring(ProfilesURL.Length - 1) != "/") { ProfilesURL += "/"; } Response.Redirect(ProfilesURL + "search/default.aspx?searchtype=people&classuri=http://xmlns.com/foaf/0.1/Person&searchfor=" + q); break; case "incomingpreview": q = Request["SearchPhrase"].Trim(); Utilities.DataIO data = new Profiles.DIRECT.Utilities.DataIO(); string searchphrase = Request["SearchPhrase"].Trim(); Response.Write(data.Search(searchphrase)); break; case "outgoingcount": if (Request["blank"] == "y") { Response.Write("<html><body></body></html>"); Response.End(); } string SearchPhrase = Request["SearchPhrase"]; Response.Write("<script>parent.dsLoading=1;</script>" + Environment.NewLine); dr = oDataIO.GetSitesOrderBySiteID(); SiteIDs = new int[1000]; URLs = new string[1000]; FSIDs = new string[1000]; Site site; ListOfSites = new List<Site>(); Int64 sites = 0; List<AsyncProcessing> ListOfThreads = new List<AsyncProcessing>(); AsyncProcessing async; while (dr.Read()) { SiteIDs[sites] = Convert.ToInt32(dr["SiteID"].ToString()); URLs[sites] = dr["QueryURL"] + SearchPhrase; FSIDs[sites] = dr["FSID"].ToString(); site = new Site(URLs[sites], SiteIDs[sites], FSIDs[sites], SearchPhrase, HttpContext.Current); ListOfSites.Add(site); async = new AsyncProcessing(); async.BeginProcessRequest(site); ListOfThreads.Add(async); sites++; } if (!dr.IsClosed) dr.Close(); //eat up the CPU for x number of seconds :) so all the requests can come back. This is set in the web.config file DateTime end = DateTime.Now.AddSeconds(QueryTimeout); while (DateTime.Now < end) { } //close out anything that did not complete in 5 seconds for (int loop = 0; loop < ListOfThreads.Count; loop++) { if (!ListOfThreads[loop].Site.IsDone) { sql = "update [Direct.].LogOutgoing set ResponseTime = datediff(ms,SentDate,GetDate()), " + " ResponseState = " + 1 + " where FSID = " + cs(ListOfThreads[loop].Site.FSID); oDataIO.ExecuteSQLDataCommand(sql); Response.Write("<script>parent.siteResult(" + ListOfThreads[loop].Site.SiteID + ",1,0,'','','','');</script>"); ListOfThreads.Remove(ListOfThreads[loop]); } } try { Response.Flush(); } catch { } break; case "outgoingdetails": string FSID = Request["fsid"].Trim(); string SiteId = string.Empty; if (FSID != "") { dr = oDataIO.GetFsID(cs(FSID)); if (dr.Read()) { SiteId = dr["SiteID"].ToString(); ResultDetailsURL = dr["ResultDetailsURL"].ToString().Replace("\n\t", ""); } if (!dr.IsClosed) dr.Close(); } if ((FSID != "") && (SiteId != "") && (ResultDetailsURL != "")) { // Enter log record oDataIO.ExecuteSQLDataCommand("insert into [Direct.].LogOutgoing(FSID,SiteID,Details,SentDate) " + " values ('" + FSID + "'," + SiteId + ",1,GetDate())"); Response.Redirect(ResultDetailsURL); } else Response.Redirect(ProfilesURL); break; } Response.End(); }
private void DrawProfilesModule() { string output = string.Empty; string tab = string.Empty; tab = Request.QueryString["tab"]; if (Request.QueryString["searchtype"] == "everything") { tab = "all"; } if (Request.QueryString["searchtype"] == "people") { tab = "people"; } Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchString", base.Namespaces) != null) { // output += "<li>" + base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchString", base.Namespaces).InnerText + "</li>"; foreach (XmlNode n in base.BaseData.SelectNodes("rdf:RDF/rdf:Description/vivo:overview/SearchDetails/SearchPhraseList/SearchPhrase", base.Namespaces)) { output += "<li>" + n.InnerText + "</li>"; } } if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://xmlns.com/foaf/0.1/lastName']", base.Namespaces) != null) { output += "<li>" + base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://xmlns.com/foaf/0.1/lastName']", base.Namespaces).InnerText + "</li>"; } if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://xmlns.com/foaf/0.1/firstName']", base.Namespaces) != null) { output += "<li>" + base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://xmlns.com/foaf/0.1/firstName']", base.Namespaces).InnerText + "</li>"; } if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://profiles.catalyst.harvard.edu/ontology/prns#hasPersonFilter']", base.Namespaces) != null) { string s = string.Empty; if (!Request.QueryString["otherfilters"].IsNullOrEmpty()) { s = Request.QueryString["otherfilters"]; if (!s.IsNullOrEmpty()) { foreach (GenericListItem gi in data.GetOtherOptions(s)) { Filters = data.GetConvertedURIListItem(data.GetListOfFilters(), gi.Value); output += "<li>" + Filters + "</li>"; } } } else { List <GenericListItem> g = new List <GenericListItem>(); g = data.GetListOfFilters(); foreach (XmlNode x in base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://profiles.catalyst.harvard.edu/ontology/prns#hasPersonFilter']", base.Namespaces)) { s = data.GetConvertedURIListItem(g, x.InnerText); output += "<li>" + s + "</li>"; } } } if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://vivoweb.org/ontology/core#positionInOrganization']", base.Namespaces) != null) { if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://vivoweb.org/ontology/core#positionInOrganization']/@IsExclude", base.Namespaces).Value == "1") { Institution = "(Except)"; } Institution += data.GetConvertedURIListItem(data.GetInstitutions(), base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://vivoweb.org/ontology/core#positionInOrganization']", base.Namespaces).InnerText); output += "<li>" + Institution + "</li>"; } if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://profiles.catalyst.harvard.edu/ontology/prns#positionInDepartment']", base.Namespaces) != null) { if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://profiles.catalyst.harvard.edu/ontology/prns#positionInDepartment']/@IsExclude", base.Namespaces).Value == "1") { Department = "(Except) "; } Department += data.GetConvertedURIListItem(data.GetDepartments(), base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://profiles.catalyst.harvard.edu/ontology/prns#positionInDepartment']", base.Namespaces).InnerText); output += "<li>" + Department + "</li>"; } if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://profiles.catalyst.harvard.edu/ontology/prns#positionInDivision']", base.Namespaces) != null) { Division = data.GetConvertedURIListItem(data.GetDivisions(), base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property2='http://profiles.catalyst.harvard.edu/ontology/prns#positionInDivision']", base.Namespaces).InnerText); output += "<li>" + Division + "</li>"; } if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:overview/SearchOptions/MatchOptions/SearchFiltersList/SearchFilter[@Property='http://profiles.catalyst.harvard.edu/ontology/prns#hasFacultyRank']", base.Namespaces) != null) { foreach (GenericListItem gi in data.GetFacultyRanks()) { if (base.BaseData.SelectSingleNode(".").InnerXml.Contains(gi.Value) && !gi.Value.IsNullOrEmpty()) { Rank = gi.Text; output += "<li>" + Rank + "</li>"; } } } if (base.BaseData.SelectNodes("rdf:RDF/rdf:Description/vivo:overview/SearchDetails/SearchPhraseList", base.Namespaces).Count > 0 && tab == "people") { litWhyText.Text = "<div style='margin-top:5px;'>Click \"Why?\" to see why a" + (tab == "people" ? " person" : "n item") + " matched the search.</div>"; } else { litWhyText.Visible = false; } litSearchCriteria.Text = output; }
private void DrawProfilesModule() { XsltArgumentList args = new XsltArgumentList(); string searchfor = string.Empty; string classgroupuri = string.Empty; string classuri = string.Empty; string searchrequest = string.Empty; string exactphrase = string.Empty; XmlDocument xmlsearchrequest; if (Request.QueryString["searchfor"] != null) { searchfor = Request.QueryString["searchfor"]; } else { searchfor = Request.Form["txtSearchFor"]; } if (Request.QueryString["classgroupuri"] != null) { classgroupuri = HttpUtility.UrlDecode(Request.QueryString["classgroupuri"]); } else { classgroupuri = HttpUtility.UrlDecode(Request.Form["classgroupuri"]); } if (classgroupuri != null) { if (classgroupuri.Contains("!")) { classgroupuri = classgroupuri.Replace('!', '#'); } } else { classgroupuri = string.Empty; } if (Request.QueryString["classuri"] != null) { classuri = HttpUtility.UrlDecode(Request.QueryString["classuri"]); } else { classuri = HttpUtility.UrlDecode(Request.Form["classuri"]); } if (classuri != null) { if (classuri.Contains("!")) { classuri = classuri.Replace('!', '#'); } } else { classuri = string.Empty; } Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); if (Request.QueryString["searchrequest"] != null) { searchrequest = Request.QueryString["searchrequest"]; if (searchfor == null) { xmlsearchrequest = new XmlDocument(); xmlsearchrequest.LoadXml(data.DecryptRequest(searchrequest)); searchfor = xmlsearchrequest.SelectSingleNode("SearchOptions/MatchOptions/SearchString").InnerText; } } if (Request.QueryString["exactphrase"] != null) { exactphrase = Request.QueryString["exactphrase"]; } else { exactphrase = "false"; } //Grab the full results so I can get the counts, this comes from the cache cloud. this.SearchResults = data.Search(data.SearchRequest(searchfor, exactphrase, "", "", "0", "100"), false); Int64 total = 0; foreach (XmlNode x in this.SearchResults.SelectNodes("rdf:RDF/rdf:Description/vivo:overview/prns:matchesClassGroupsList/prns:matchesClassGroup", this.Namespaces)) { total += Convert.ToInt64(x.SelectSingleNode("prns:numberOfConnections", this.Namespaces).InnerText); } args.AddParam("total", "", total); args.AddParam("searchfor", "", searchfor); args.AddParam("exactphrase", "", exactphrase); args.AddParam("root", "", Root.Domain); args.AddParam("classGrpURIpassedin", "", classgroupuri); args.AddParam("classURIpassedin", "", classuri); XslCompiledTransform xslt = new XslCompiledTransform(); litEverythingPassiveResults.Text = XslHelper.TransformInMemory(Server.MapPath("~/Search/Modules/SearchEverythingFacets/SearchEverythingFacets.xslt"), args, this.SearchResults.OuterXml); }
private void Search() { XmlDocument searchresults; Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); List<EntityState> es = new List<EntityState>(); string searchuri = string.Empty; searchuri = ddlPropertyList.SelectedValue; searchresults = data.Search(data.SearchRequest(txtKeyword.Text.Trim(),"false", "", searchuri, "100", "0"), true); foreach (XmlNode x in searchresults.SelectNodes("SearchResults/Network/Connection")) { es.Add(new EntityState(x.InnerText, x.SelectSingleNode("@URI").Value)); } gridSearchResults.DataSource = es; gridSearchResults.DataBind(); pnlProxySearchResults.Visible = true; }
//public void Page_Load(object sender, EventArgs e) override protected void OnInit(EventArgs e) { masterpage = (Framework.Template)base.Master; string tab = string.Empty; if (Request.QueryString["searchtype"] == null && Request.Form["searchtype"] == null && Session["DIRECTSEARCHTYPE"] != null) { this.SearchType = Session["DIRECTSEARCHTYPE"].ToString(); } else if (Request.QueryString["searchtype"] == null && Request.Form["searchtype"] != null && Session["DIRECTSEARCHTYPE"] == null) { this.SearchType = Request.Form["searchtype"]; } else if (Request.QueryString["searchtype"] != null && Request.Form["searchtype"] == null && Session["DIRECTSEARCHTYPE"] == null) { this.SearchType = Request.QueryString["searchtype"]; } if (Session["DIRECTSEARCHREQUEST"] != null) { masterpage.SearchRequest = Session["DIRECTSEARCHREQUEST"].ToString(); string searchrequest = masterpage.SearchRequest; Session["DIRECTKEYWORD"] = null; Session["DIRECTSEARCHREQUEST"] = null; Session["DIRECTSEARCHTYPE"] = null; Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); data.SearchRequest("", "", "", "", "", "", "", "", "", "", "", "15", "0", "", "", "", "", ref searchrequest); Response.Redirect(Root.Domain + "/search/default.aspx?searchtype=" + this.SearchType + "&searchrequest=" + searchrequest, true); } if (this.SearchType.IsNullOrEmpty()) { this.LoadPresentationXML("searchform"); if (Request.QueryString["tab"] != null) { masterpage.Tab = Request.QueryString["tab"]; } else { masterpage.Tab = ""; } masterpage.RDFData = null; masterpage.RDFNamespaces = null; } else { if (Request.QueryString["tab"] != null) { masterpage.Tab = Request.QueryString["tab"]; } else { masterpage.Tab = ""; } this.LoadPresentationXML(this.SearchType); this.LoadRDFSearchResults(); } this.LoadAssets(); masterpage.PresentationXML = this.PresentationXML; }
private XmlDocument Query(XmlDocument request) { Search.Utilities.DataIO data = new Profiles.Search.Utilities.DataIO(); return data.Search(request,false); }
protected void DrawUIOnLoad() { oDataIO = new DIRECT.Utilities.DataIO(); Profiles.DIRECT.Utilities.DataIO searchDataIO; Profiles.Search.Utilities.DataIO profileDataIO; string DirectServiceURL = Root.Domain + "/DIRECT/Modules/DirectSearch/directservice.aspx";// Request.Url.AbsoluteUri.Replace("&", "&"); string ProfilesURL = Root.Domain; string PopulationTypeText = oDataIO.GetDirectConfig().PopulationType; int QueryTimeout = oDataIO.GetDirectConfig().Timeout; XmlDocument query = new XmlDocument(); XmlDocument result; Framework.Utilities.Namespace rdfnamespaces = new Namespace(); XmlNamespaceManager namespaces = null; string sql = string.Empty; string ResultDetailsURL = string.Empty; string strResult = ""; SqlDataReader dr; if (Request["Request"] == null) { return; } string task = Request["Request"].ToLower(); switch (task) { case "getsites": string ResultStr = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + "<site-list>"; dr = oDataIO.GetSitesOrderBySortOrder(); while (dr.Read()) { Int64 SiteID = Convert.ToInt64(dr["SiteID"]); string SiteName = dr["SiteName"].ToString(); string QueryURL = dr["QueryURL"].ToString(); if (SiteName == null) { SiteName = ""; } if (QueryURL == null) { QueryURL = ""; } ResultStr = ResultStr + "<site-description><site-id>" + SiteID + "</site-id><name>" + cx(SiteName) + "</name><aggregate-query>" + cx(QueryURL) + "</aggregate-query></site-description>"; } if (!dr.IsClosed) { dr.Close(); } ResultStr += "</site-list>"; Response.ContentType = "text/xml"; Response.AddHeader("Content-Type", "text/xml;charset=UTF-8"); //Response.ContentEncoding.CodePage = 65001; Response.Charset = "UTF-8"; Response.Write(ResultStr); break; case "incomingcount": string q = Request["SearchPhrase"].Trim(); // Enter log record sql = "insert into [Direct.].LogIncoming(Details,ReceivedDate,RequestIP,QueryString) " + " values (0,GetDate()," + cs(Request.ServerVariables["REMOTE_ADDR"]) + "," + cs(q) + ")"; oDataIO.ExecuteSQLDataCommand(sql); // Execute query string x = "<SearchOptions>" + "<MatchOptions>" + "<SearchString ExactMatch=\"false\">" + cx(q) + "</SearchString> " + "<SearchFiltersList /> " + "<ClassURI>http://xmlns.com/foaf/0.1/Person</ClassURI> " + "</MatchOptions>" + "<OutputOptions>" + "<Offset>0</Offset>" + "<Limit>1</Limit> " + "<SortByList>" + "</SortByList>" + "</OutputOptions>" + "</SearchOptions>"; query.LoadXml(x); profileDataIO = new Profiles.Search.Utilities.DataIO(); result = profileDataIO.Search(query, false); namespaces = rdfnamespaces.LoadNamespaces(result); string ResultCount = result.SelectSingleNode("rdf:RDF/rdf:Description/prns:numberOfConnections", namespaces).InnerText; // Form result message ResultStr = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; ResultStr += "<aggregation-result>"; ResultStr += "<count>" + ResultCount + "</count>"; ResultStr += "<population-type>" + PopulationTypeText + "</population-type>"; ResultStr += "<preview-URL>" + DirectServiceURL + "?Request=IncomingPreview&SearchPhrase=" + cx(q) + "</preview-URL>"; ResultStr += "<search-results-URL>" + DirectServiceURL + "?Request=IncomingDetails&SearchPhrase=" + cx(q) + "</search-results-URL>"; ResultStr += "</aggregation-result>"; // Send result Response.ContentType = "text/xml"; Response.AddHeader("Content-Type", "text/xml;charset=UTF-8"); //Response.ContentEncoding.CodePage = 65001; Response.Charset = "UTF-8"; Response.Write(ResultStr); break; case "incomingdetails": q = Request["SearchPhrase"].Trim(); // Enter log record sql = "insert into [Direct.].LogIncoming(Details,ReceivedDate,RequestIP,QueryString) "; sql += " values (1,GetDate()," + cs(Request.ServerVariables["REMOTE_ADDR"]) + "," + cs(q) + ")"; oDataIO.ExecuteSQLDataCommand(sql); // Execute query query.LoadXml("<SearchOptions>" + "<MatchOptions>" + "<SearchString ExactMatch=\"false\">" + cx(q) + "</SearchString> " + "<SearchFiltersList /> " + "<ClassURI>http://xmlns.com/foaf/0.1/Person</ClassURI> " + "</MatchOptions>" + "<OutputOptions>" + "<Offset>0</Offset>" + "<Limit>1</Limit> " + "<SortByList>" + "</SortByList>" + "</OutputOptions>" + "</SearchOptions>"); profileDataIO = new Profiles.Search.Utilities.DataIO(); result = profileDataIO.Search(query, false); strResult = result.InnerXml; // Parse results XmlDocument objDoc = new XmlDocument(); objDoc = new XmlDocument(); objDoc.LoadXml(strResult); namespaces = rdfnamespaces.LoadNamespaces(result); ResultCount = result.SelectSingleNode("rdf:RDF/rdf:Description/prns:numberOfConnections", namespaces).InnerText; if (ProfilesURL.Substring(ProfilesURL.Length - 1) != "/") { ProfilesURL += "/"; } Response.Redirect(ProfilesURL + "search/default.aspx?searchtype=people&classuri=http://xmlns.com/foaf/0.1/Person&searchfor=" + q + "&exactPhrase=false"); break; case "incomingpreview": q = Request["SearchPhrase"].Trim(); Utilities.DataIO data = new Profiles.DIRECT.Utilities.DataIO(); string searchphrase = Request["SearchPhrase"].Trim(); Response.Write(data.Search(searchphrase)); break; case "outgoingcount": if (Request["blank"] == "y") { Response.Write("<html><body></body></html>"); Response.End(); } string SearchPhrase = Request["SearchPhrase"]; Response.Write("<script>parent.dsLoading=1;</script>" + Environment.NewLine); dr = oDataIO.GetSitesOrderBySiteID(); SiteIDs = new int[1000]; URLs = new string[1000]; FSIDs = new string[1000]; Site site; ListOfSites = new List <Site>(); Int64 sites = 0; List <AsyncProcessing> ListOfThreads = new List <AsyncProcessing>(); AsyncProcessing async; while (dr.Read()) { SiteIDs[sites] = Convert.ToInt32(dr["SiteID"].ToString()); URLs[sites] = dr["QueryURL"] + SearchPhrase; FSIDs[sites] = dr["FSID"].ToString(); site = new Site(URLs[sites], SiteIDs[sites], FSIDs[sites], SearchPhrase, HttpContext.Current); ListOfSites.Add(site); async = new AsyncProcessing(); async.BeginProcessRequest(site); ListOfThreads.Add(async); sites++; } if (!dr.IsClosed) { dr.Close(); } //eat up the CPU for x number of seconds :) so all the requests can come back. This is set in the web.config file DateTime end = DateTime.Now.AddSeconds(QueryTimeout); while (DateTime.Now < end) { } //close out anything that did not complete in 5 seconds for (int loop = 0; loop < ListOfThreads.Count; loop++) { if (!ListOfThreads[loop].Site.IsDone) { sql = "update [Direct.].LogOutgoing set ResponseTime = datediff(ms,SentDate,GetDate()), " + " ResponseState = " + 1 + " where FSID = " + cs(ListOfThreads[loop].Site.FSID); oDataIO.ExecuteSQLDataCommand(sql); Response.Write("<script>parent.siteResult(" + ListOfThreads[loop].Site.SiteID + ",1,0,'','','','');</script>"); ListOfThreads.Remove(ListOfThreads[loop]); } } try { Response.Flush(); } catch { } break; case "outgoingdetails": string FSID = Request["fsid"].Trim(); string SiteId = string.Empty; if (FSID != "") { dr = oDataIO.GetFsID(cs(FSID)); if (dr.Read()) { SiteId = dr["SiteID"].ToString(); ResultDetailsURL = dr["ResultDetailsURL"].ToString().Replace("\n\t", ""); } if (!dr.IsClosed) { dr.Close(); } } if ((FSID != "") && (SiteId != "") && (ResultDetailsURL != "")) { // Enter log record oDataIO.ExecuteSQLDataCommand("insert into [Direct.].LogOutgoing(FSID,SiteID,Details,SentDate) " + " values ('" + FSID + "'," + SiteId + ",1,GetDate())"); Response.Redirect(ResultDetailsURL); } else { Response.Redirect(ProfilesURL); } break; } Response.End(); }