public static void Log(string msg,RDFTriple triple) { //Each error that occurs will trigger this event. try { if (Convert.ToBoolean(ConfigurationSettings.AppSettings["DEBUG"]) == true) { using (StreamWriter w = File.AppendText(ConfigurationSettings.AppSettings["DEBUG_PATH"])) { if (triple.Subject == 0) { // write a line of text to the file w.WriteLine("URI= " + triple.URI + "==>" + msg.Trim() + " at= " + DateTime.Now.ToLongTimeString()); } else { // write a line of text to the file w.WriteLine("SPO= " + triple.Subject.ToString() + " " + triple.Predicate.ToString() + " " + triple.Object.ToString() + "==>" + msg.Trim() + " at= " + DateTime.Now.ToLongTimeString()); } w.Close(); } } } catch (Exception ex) { } }
public void Initialize(XmlDocument basedata, XmlNamespaceManager namespaces, RDFTriple rdftriple) { BaseData = basedata; Namespaces = namespaces; RDFTriple = rdftriple; UploadInfoToORCID1.Initialize(basedata, namespaces, rdftriple); }
public static void Log(string msg, RDFTriple triple) { //Each error that occurs will trigger this event. try { string path = string.Empty; if (Convert.ToBoolean(ConfigurationSettings.AppSettings["DEBUG"]) == true) { if (ConfigurationSettings.AppSettings["DEBUG_PATH"] != null) { path = ConfigurationSettings.AppSettings["DEBUG_PATH"]; using (StreamWriter w = File.AppendText(path)) { if (triple.Subject == 0) { // write a line of text to the file w.WriteLine("URI= " + triple.URI + "==>" + msg.Trim() + " at= " + DateTime.Now.ToLongTimeString()); } else { // write a line of text to the file w.WriteLine("SPO= " + triple.Subject.ToString() + " " + triple.Predicate.ToString() + " " + triple.Object.ToString() + "==>" + msg.Trim() + " at= " + DateTime.Now.ToLongTimeString()); } w.Close(); } } } } catch (Exception ex) { } }
public System.Xml.Linq.XDocument GetConceptMeshInfo(RDFTriple request) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; using (var db = new SqlConnection(connstr)) { SqlCommand dbcommand = new SqlCommand("[Profile.Data].[Concept.Mesh.GetDescriptorXML]", db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@NodeId", request.Subject)); db.Open(); XmlReader xreader = dbcommand.ExecuteXmlReader(); System.Xml.Linq.XDocument xDoc = null; if (xreader.Read()) xDoc = System.Xml.Linq.XDocument.Load(xreader); xreader.Close(); db.Close(); return xDoc; } }
protected void Page_Load(object sender, EventArgs e) { Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); Profiles.Framework.Utilities.RDFTriple request = new RDFTriple(Convert.ToInt32(Request.QueryString["p"])); Response.ContentType = "application/xml; charset=utf-8"; Response.Write(data.GetProfileNetworkForBrowserXML(request).InnerXml); }
protected void InitAssets() { System.Web.UI.HtmlControls.HtmlLink NetworkBrowsercss = new System.Web.UI.HtmlControls.HtmlLink(); NetworkBrowsercss.Href = Root.Domain + "/Profile/CSS/NetworkBrowser.css"; NetworkBrowsercss.Attributes["rel"] = "stylesheet"; NetworkBrowsercss.Attributes["type"] = "text/css"; NetworkBrowsercss.Attributes["media"] = "all"; Page.Header.Controls.Add(NetworkBrowsercss); HtmlGenericControl jsscript0 = new HtmlGenericControl("script"); jsscript0.Attributes.Add("type", "text/javascript"); jsscript0.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/JavaScript/watchdog.js"); Page.Header.Controls.Add(jsscript0); HtmlGenericControl jsscript1 = new HtmlGenericControl("script"); jsscript1.Attributes.Add("type", "text/javascript"); jsscript1.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkCluster/scriptaculous/lib/prototype.js"); Page.Header.Controls.Add(jsscript1); HtmlGenericControl jsscript2 = new HtmlGenericControl("script"); jsscript2.Attributes.Add("type", "text/javascript"); jsscript2.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkCluster/scriptaculous/src/scriptaculous.js"); Page.Header.Controls.Add(jsscript2); HtmlGenericControl jsscript3 = new HtmlGenericControl("script"); jsscript3.Attributes.Add("type", "text/javascript"); jsscript3.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkCluster/JavaScript/networkBrowserClass.js"); Page.Header.Controls.Add(jsscript3); HtmlGenericControl jsscript4 = new HtmlGenericControl("script"); jsscript4.Attributes.Add("type", "text/javascript"); jsscript4.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkCluster/JavaScript/networkClusterLayoutEngine.js"); Page.Header.Controls.Add(jsscript4); HtmlGenericControl jsscript5 = new HtmlGenericControl("script"); jsscript5.Attributes.Add("type", "text/javascript"); jsscript5.Attributes.Add("src", "//cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js"); Page.Header.Controls.Add(jsscript5); HtmlGenericControl script = new HtmlGenericControl("script"); script.Attributes.Add("type", "text/javascript"); script.InnerHtml = "function loadClusterView() {" + " network_browser.Init('" + Root.Domain + "/profile/modules/NetworkCluster/NetworkClusterSvc.aspx?p='); " + " network_browser.loadNetwork('" + Request.QueryString["Subject"].ToString() + "'); " + "};"; Page.Header.Controls.Add(script); Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); XmlDocument x = data.GetProfileNetworkForBrowserXML(request); System.Xml.Xsl.XsltArgumentList args = new System.Xml.Xsl.XsltArgumentList(); args.AddParam("root", "", Root.Domain); DateTime d = DateTime.Now; System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform(); litNetworkText.Text = Profiles.Framework.Utilities.XslHelper.TransformInMemory(Server.MapPath("~/profile/XSLT/NetworkTable.xslt"), args, x.InnerXml); iFrameFlashGraph.Attributes.Add("data-src", Root.Domain + "/profile/Modules/NetworkClusterFlash/Default.aspx?Subject=" + Request.QueryString["subject"] + "&Predicate=" + Request.QueryString["Predicate"]); }
protected void Page_Load(object sender, EventArgs e) { Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); Profiles.Framework.Utilities.RDFTriple request = new RDFTriple(Convert.ToInt32(Request.QueryString["p"])); Response.ContentType = "application/json; charset=utf-8"; Response.AppendHeader("Access-Control-Allow-Origin", "*"); Response.Write(data.GetProfileNetworkForBrowser(request)); }
public XmlDocument QueryHTTPIO(RDFTriple datarequest) { string result = string.Empty; XmlDocument rawdata = new XmlDocument(); try { HttpWebRequest request = null; request = (HttpWebRequest)WebRequest.Create(datarequest.URI); request.Method = "POST"; request.ContentType = "application/rdf+xml"; request.ContentLength = datarequest.URI.Length; if (request.Headers["SessionID"] == null) request.Headers.Add("SessionID", datarequest.Session.SessionID); if (datarequest.Offset != null) if (datarequest.Offset != string.Empty) request.Headers.Add("Offset", datarequest.Offset.ToString()); if (datarequest.Limit != null) if (datarequest.Limit != string.Empty) request.Headers.Add("Limit", datarequest.Limit.ToString()); request.Headers.Add("ShowDetails", datarequest.ShowDetails.ToString()); request.Headers.Add("Expand", datarequest.Expand.ToString()); using (Stream writeStream = request.GetRequestStream()) { UTF8Encoding encoding = new UTF8Encoding(); byte[] bytes = encoding.GetBytes(datarequest.URI); writeStream.Write(bytes, 0, bytes.Length); } using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { using (Stream responseStream = response.GetResponseStream()) { using (StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8)) { result = readStream.ReadToEnd(); } } } rawdata.LoadXml(result); } catch (Exception ex) { Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace); } return rawdata; }
public SqlDataReader GetConceptSimilarMesh(RDFTriple request) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; var db = new SqlConnection(connstr); db.Open(); SqlCommand dbcommand = new SqlCommand("[Profile.Data].[Concept.Mesh.GetSimilarMesh]", db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); // Add parameters dbcommand.Parameters.Add(new SqlParameter("@NodeId", request.Subject)); // Return reader return dbcommand.ExecuteReader(CommandBehavior.CloseConnection); }
public SqlDataReader GetPublications(RDFTriple request) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[CustomViewAuthorInAuthorship.GetList]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", sm.Session().SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); return dbreader; }
public XmlDocument GetProfileNetworkForBrowser(RDFTriple request) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); if (Framework.Utilities.Cache.Fetch(request.Key + "GetProfileNetworkForBrowser") == null) { try { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[NetworkRadial.GetCoauthors]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", request.Session.SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) xmlstr += dbreader[0].ToString(); Framework.Utilities.DebugLogging.Log(xmlstr); if (!dbreader.IsClosed) dbreader.Close(); xmlstr = xmlstr.Replace(" id=", " lid="); xmlstr = xmlstr.Replace(" nodeid=", " id="); xmlstr = xmlstr.Replace(" id1=", " lid1="); xmlstr = xmlstr.Replace(" id2=", " lid2="); xmlstr = xmlstr.Replace(" nodeid1=", " id1="); xmlstr = xmlstr.Replace(" nodeid2=", " id2="); xmlrtn.LoadXml(xmlstr); } catch (Exception ex) { Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace); } } else { xmlrtn = Framework.Utilities.Cache.Fetch(request.Key + "GetProfileNetworkForBrowser"); } return xmlrtn; }
public SqlDataReader GetProfileConnection(RDFTriple request, string storedproc) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; var db = new SqlConnection(connstr); db.Open(); SqlCommand dbcommand = new SqlCommand(storedproc, db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); // Add parameters dbcommand.Parameters.Add(new SqlParameter("@subject", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@object", request.Object)); // Return reader return dbcommand.ExecuteReader(CommandBehavior.CloseConnection); }
public XmlDocument GetPresentationData(RDFTriple request) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); try { xmlrtn = new XmlDocument(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[rdf.].[GetPresentationXML]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@subject", request.Subject)); if (request.Predicate > 0) dbcommand.Parameters.Add(new SqlParameter("@predicate", request.Predicate)); if (request.Object > 0) dbcommand.Parameters.Add(new SqlParameter("@object", request.Object)); dbcommand.Parameters.Add(new SqlParameter("@EditMode", request.Edit ? 1 : 0)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", request.Session.SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) xmlstr += dbreader[0].ToString(); xmlrtn.LoadXml(xmlstr); xmlstr = string.Empty; if (!dbreader.IsClosed) dbreader.Close(); } catch (Exception ex) { } return xmlrtn; }
public XmlDocument GetPresentationData(RDFTriple request) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); try { if (Framework.Utilities.Cache.Fetch(request.Key + "presentation") == null || request.Edit) { SqlCommand dbcommand = new SqlCommand("[rdf.].[GetPresentationXML]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@subject", request.Subject)); if (request.Predicate > 0) dbcommand.Parameters.Add(new SqlParameter("@predicate", request.Predicate)); if (request.Object > 0) dbcommand.Parameters.Add(new SqlParameter("@object", request.Object)); //ZAP, this will need to be worked out on how I tell if its open for edit. dbcommand.Parameters.Add(new SqlParameter("@EditMode", request.Edit ? 1 : 0)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", request.Session.SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) xmlstr += dbreader[0].ToString(); Framework.Utilities.DebugLogging.Log(xmlstr); xmlrtn.LoadXml(xmlstr); Framework.Utilities.Cache.Set(request.Key + "presentation", xmlrtn, -1); //UCSF. No need to load this all the time. It NEVER changes xmlstr = string.Empty; if (!dbreader.IsClosed) dbreader.Close(); } else { xmlrtn = Framework.Utilities.Cache.Fetch(request.Key + "presentation"); } } catch (Exception ex) { } finally { if (dbconnection.State != ConnectionState.Closed) dbconnection.Close(); } return xmlrtn; }
public void Initialize(XmlDocument basedata, XmlNamespaceManager namespaces, RDFTriple rdftriple) { BaseData = basedata; Namespaces = namespaces; RDFTriple = rdftriple; }
public XmlDocument GetSameDepartment(RDFTriple request) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[CustomViewPersonSameDepartment.GetList]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", request.Session.SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) xmlstr += dbreader[0].ToString(); xmlrtn.LoadXml(xmlstr); if (!dbreader.IsClosed) dbreader.Close(); return xmlrtn; }
public void DrawProfilesModule() { XmlDocument document = new XmlDocument(); string xml = string.Empty; Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); document.LoadXml(data.GetNetworkCategory(request).ToString()); XslCompiledTransform xslt = new XslCompiledTransform(); XsltArgumentList args = new XsltArgumentList(); args.AddParam("root", "", Root.Domain); litCategoryList.Text = Framework.Utilities.XslHelper.TransformInMemory(Server.MapPath("~/Profile/modules/NetworkCategories/NetworkCategories.xslt"), args, document.OuterXml); }
protected void InitAssets() { System.Web.UI.HtmlControls.HtmlLink NetworkBrowsercss = new System.Web.UI.HtmlControls.HtmlLink(); NetworkBrowsercss.Href = Root.Domain + "/Profile/CSS/NetworkBrowser.css"; NetworkBrowsercss.Attributes["rel"] = "stylesheet"; NetworkBrowsercss.Attributes["type"] = "text/css"; NetworkBrowsercss.Attributes["media"] = "all"; Page.Header.Controls.Add(NetworkBrowsercss); System.Web.UI.HtmlControls.HtmlLink vizcss = new System.Web.UI.HtmlControls.HtmlLink(); vizcss.Href = Root.Domain + "/Profile/CSS/viz.css"; vizcss.Attributes["rel"] = "stylesheet"; vizcss.Attributes["type"] = "text/css"; vizcss.Attributes["media"] = "all"; Page.Header.Controls.Add(vizcss); HtmlGenericControl jsscript0 = new HtmlGenericControl("script"); jsscript0.Attributes.Add("type", "text/javascript"); jsscript0.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/JavaScript/watchdog.js"); Page.Header.Controls.Add(jsscript0); HtmlGenericControl jsscript1 = new HtmlGenericControl("script"); jsscript1.Attributes.Add("type", "text/javascript"); jsscript1.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/scriptaculous/lib/prototype.js"); Page.Header.Controls.Add(jsscript1); HtmlGenericControl jsscript2 = new HtmlGenericControl("script"); jsscript2.Attributes.Add("type", "text/javascript"); jsscript2.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/scriptaculous/src/scriptaculous.js"); Page.Header.Controls.Add(jsscript2); HtmlGenericControl jsscript3 = new HtmlGenericControl("script"); jsscript3.Attributes.Add("type", "text/javascript"); jsscript3.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/JavaScript/layout_balanced.js"); Page.Header.Controls.Add(jsscript3); HtmlGenericControl jsscript4 = new HtmlGenericControl("script"); jsscript4.Attributes.Add("type", "text/javascript"); jsscript4.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/JavaScript/sliders.js"); Page.Header.Controls.Add(jsscript4); HtmlGenericControl jsscript5 = new HtmlGenericControl("script"); jsscript5.Attributes.Add("type", "text/javascript"); jsscript5.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/JavaScript/viz.js"); Page.Header.Controls.Add(jsscript5); HtmlGenericControl jsscript6 = new HtmlGenericControl("script"); jsscript6.Attributes.Add("type", "text/javascript"); jsscript6.Attributes.Add("src", "//cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js"); Page.Header.Controls.Add(jsscript6); Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); int personID = data.GetPersonId(Int64.Parse(Request.QueryString["Subject"].ToString())); HtmlGenericControl script = new HtmlGenericControl("script"); script.Attributes.Add("type", "text/javascript"); script.InnerHtml = "jQuery(document).ready(function() {try{" + " radial_viz = new RadialGraph_Visualization(jQuery('#radial_view')[0], {radius: 100});" + //" radial_viz.loadNetwork('" + Root.Domain + "/profile/modules/NetworkRadial/NetworkRadialSvc.aspx?p=" + Request.QueryString["Subject"].ToString() + "', '" + Request.QueryString["Subject"].ToString() + "'); " + " radial_viz.loadNetwork('" + Root.Domain + "/profile/modules/NetworkRadial/NetworkRadialSvc.aspx?p=" + Request.QueryString["Subject"].ToString() + "', '" + personID + "'); " + "} catch(e){}});"; Page.Header.Controls.Add(script); //Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); XmlDocument x = data.GetProfileNetworkForBrowserXML(request); System.Xml.Xsl.XsltArgumentList args = new System.Xml.Xsl.XsltArgumentList(); args.AddParam("root", "", Root.Domain); System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform(); lblProfileName.Text = x.SelectSingleNode("LocalNetwork/NetworkPeople/NetworkPerson[@d='0']").Attributes["fn"].Value + " " + x.SelectSingleNode("LocalNetwork/NetworkPeople/NetworkPerson[@d='0']").Attributes["ln"].Value; litNetworkText.Text = Profiles.Framework.Utilities.XslHelper.TransformInMemory(Server.MapPath("~/profile/XSLT/NetworkTable.xslt"), args, x.InnerXml); iFrameFlashGraph.Attributes.Add("data-src", Root.Domain + "/profile/Modules/NetworkRadialFlash/Default.aspx?Subject=" + Request.QueryString["subject"] + "&Predicate=" + Request.QueryString["Predicate"]); }
public void Initialize() { RDFTriple = new RDFTriple(Convert.ToInt64(sm.Session().NodeID.ToString())); RDFTriple.Expand = true; RDFTriple.ShowDetails = true; LoadPresentationXML(); LoadRDFData(); masterpage.RDFData = RDFData; masterpage.RDFNamespaces = RDFNamespaces; masterpage.PresentationXML = PresentationXML; this.LoadAssets(); masterpage.PresentationXML = this.PresentationXML; }
public XmlDocument GetRDFData(RDFTriple request) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); if (Framework.Utilities.Cache.Fetch(request.Key + "data") == null || request.Edit) { if (request.Type != string.Empty) { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand(); try { Framework.Utilities.DebugLogging.Log("{CLOUD} DATA BASE start GetRDFData(RDFTriple request) :" + request.Key + "data", request); dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.CommandText = "[RDF.].[GetDataRDF]"; dbcommand.Parameters.Add(new SqlParameter("@subject", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@predicate", request.Predicate)); dbcommand.Parameters.Add(new SqlParameter("@object", request.Object)); dbcommand.Parameters.Add(new SqlParameter("@returnXMLasStr", true)); if (request.Offset != null && request.Offset != string.Empty) dbcommand.Parameters.Add(new SqlParameter("@offset", request.Offset)); if (request.Limit != null && request.Limit != string.Empty) dbcommand.Parameters.Add(new SqlParameter("@limit", request.Limit)); dbcommand.Parameters.Add(new SqlParameter("@showDetails", request.ShowDetails)); dbcommand.Parameters.Add(new SqlParameter("@expand", request.Expand)); dbcommand.Parameters.Add(new SqlParameter("@SessionID", request.Session.SessionID)); if (request.ExpandRDFList != string.Empty) dbcommand.Parameters.Add(new SqlParameter("@ExpandRDFListXML", request.ExpandRDFList)); dbcommand.Connection = dbconnection; Framework.Utilities.DebugLogging.Log("{CLOUD} DATA BASE preread GetRDFData(RDFTriple request) :" + request.Key + "data", request); using (var dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection)) { while (dbreader.Read()) { xmlstr += dbreader[0].ToString(); } dbreader.Close(); } xmlrtn.LoadXml(xmlstr); Framework.Utilities.DebugLogging.Log("{CLOUD} DATA BASE end GetRDFData(RDFTriple request) :" + request.Key + "data", request); Framework.Utilities.Cache.Set(request.Key + "data", xmlrtn); xmlstr = string.Empty; } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } finally { // UCSF. Trying to close connection instead of clearing it. //SqlConnection.ClearPool(dbconnection); if (dbconnection.State != ConnectionState.Closed) dbconnection.Close(); } } else if (request.URI != string.Empty) { Framework.Utilities.DebugLogging.Log("{CLOUD} HTTP POST start GetRDFData(RDFTriple request) :" + request.Key + "data", request); HTTPIO httpio = new HTTPIO(); xmlrtn = httpio.QueryHTTPIO(request); Framework.Utilities.DebugLogging.Log("{CLOUD} HTTP POST end GetRDFData(RDFTriple request) :" + request.Key + "data", request); Framework.Utilities.Cache.Set(request.Key + "data", xmlrtn); } } else { Framework.Utilities.DebugLogging.Log("{CLOUD} CACHE start GetRDFData(RDFTriple request) :" + request.Key + "data", request); xmlrtn = Framework.Utilities.Cache.Fetch(request.Key + "data"); Framework.Utilities.DebugLogging.Log("{CLOUD} CACHE end GetRDFData(RDFTriple request) :" + request.Key + "data", request); } return xmlrtn; }
public SqlDataReader GetPublicationSupportHtml(RDFTriple request, bool editMode) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; var db = new SqlConnection(connstr); db.Open(); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[Support.GetHTML]", db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); // Add parameters dbcommand.Parameters.Add(new SqlParameter("@NodeId", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@EditMode", (editMode) ? 1 : 0)); // Return reader return dbcommand.ExecuteReader(CommandBehavior.CloseConnection); }
public XmlDocument GetRDFData(RDFTriple request) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); bool UsedCache = true; DateTime timer = DateTime.Now; Framework.Utilities.DebugLogging.Log("GetRDFData START: KEY=" + request.Key + "|data TIME=" + timer.ToLongTimeString()); try { xmlrtn = Framework.Utilities.Cache.Fetch(request.Key + "|data"); if (xmlrtn == null || request.Edit) { xmlrtn = new XmlDocument(); UsedCache = false; if (request.Type != string.Empty) { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand(); dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.CommandText = "[RDF.].[GetDataRDF]"; dbcommand.Parameters.Add(new SqlParameter("@subject", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@predicate", request.Predicate)); dbcommand.Parameters.Add(new SqlParameter("@object", request.Object)); dbcommand.Parameters.Add(new SqlParameter("@returnXMLasStr", true)); if (request.Offset != null && request.Offset != string.Empty) dbcommand.Parameters.Add(new SqlParameter("@offset", request.Offset)); if (request.Limit != null && request.Limit != string.Empty) dbcommand.Parameters.Add(new SqlParameter("@limit", request.Limit)); dbcommand.Parameters.Add(new SqlParameter("@showDetails", request.ShowDetails)); dbcommand.Parameters.Add(new SqlParameter("@expand", request.Expand)); dbcommand.Parameters.Add(new SqlParameter("@SessionID", request.Session.SessionID)); if (request.ExpandRDFList != string.Empty) dbcommand.Parameters.Add(new SqlParameter("@ExpandRDFListXML", request.ExpandRDFList)); Framework.Utilities.DebugLogging.Log("GetRDFData EXPANDRDF: KEY=" + request.ExpandRDFList); dbcommand.Connection = dbconnection; using (var dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection)) { while (dbreader.Read()) { xmlstr += dbreader[0].ToString(); } dbreader.Close(); SqlConnection.ClearPool(dbconnection); } xmlrtn.LoadXml(xmlstr); //Framework.Utilities.Cache.Set(request.Key + "|data", xmlrtn); Framework.Utilities.Cache.Set(request.Key + "|data", xmlrtn, request.Subject, request.Session.SessionID); xmlstr = string.Empty; } else if (request.URI != string.Empty) { HTTPIO httpio = new HTTPIO(); xmlrtn = httpio.QueryHTTPIO(request); Framework.Utilities.Cache.Set(request.Key + "|data", xmlrtn); } } } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } Framework.Utilities.DebugLogging.Log("GetRDFData END : KEY=" + request.Key + "|data USEDCACHE=" + UsedCache.ToString() + " TIME=" + timer.ToLongTimeString() + " DURATION=" + (DateTime.Now - timer).TotalMilliseconds); return xmlrtn; }
// add smart caching of all of these ID lookups! protected void Page_Load(object sender, EventArgs e) { string PersonId = Request["Person"]; string EmployeeID = Request["EmployeeID"]; string FNO = Request["FNO"]; string Subject = Request["Subject"]; string PrettyURL = Request["PrettyURL"]; string Expand = Request["Expand"]; string ShowDetails = Request["ShowDetails"]; string callback = Request["callback"]; Int64 nodeid = -1; if (Subject != null) { nodeid = Convert.ToInt64(Subject); } else if (PrettyURL != null) { nodeid = Framework.Utilities.UCSFIDSet.ByPrettyURL[PrettyURL.ToLower()].NodeId; } else { Profiles.CustomAPI.Utilities.DataIO data = new Profiles.CustomAPI.Utilities.DataIO(); int personid = -1; if (PersonId != null) { personid = Convert.ToInt32(PersonId); } else if (FNO != null) { personid = (int)Profiles.Framework.Utilities.UCSFIDSet.ByFNO[FNO.ToLower()].PersonId; } else if (EmployeeID != null) { personid = (int)Profiles.Framework.Utilities.UCSFIDSet.ByEmployeeID[EmployeeID].PersonId; } nodeid = Framework.Utilities.UCSFIDSet.ByPersonId[personid].NodeId; } RDFTriple request = new RDFTriple(nodeid); //The system default is True and True for showdetails and expand, but if its an external page call to this page, //then its set to false for expand. if (Expand != null) { request.Expand = Convert.ToBoolean(Expand); } else { request.Expand = false; } if (ShowDetails != null) { request.ShowDetails = Convert.ToBoolean(ShowDetails); } else { request.ShowDetails = false; } Response.Clear(); Response.Charset = "charset=UTF-8"; Response.StatusCode = Convert.ToInt16("200"); if ("JSON-LD".Equals(Request["Format"])) { string URL = ConfigurationManager.AppSettings["OpenSocial.ShindigURL"] + "/rest/rdf?userId=" + HttpUtility.UrlEncode(Root.Domain + "/CustomAPI/v2/Default.aspx?Subject=" + nodeid + "&Expand=" + request.Expand + "&ShowDetails=" + request.ShowDetails); WebClient client = new WebClient(); String jsonProfiles = client.DownloadString(URL); if (callback != null && callback.Length > 0) { Response.ContentType = "application/javascript"; Response.Write(callback + "(" + jsonProfiles + ");"); } else { Response.ContentType = "application/json"; Response.Write(jsonProfiles); } } else { Response.ContentType = "text/xml";//"application/rdf+xml"; Response.Write(new Profiles.Profile.Utilities.DataIO().GetRDFData(request).InnerXml); } }
public string GetNetworkCloud(RDFTriple request) { SessionManagement sm = new SessionManagement(); string xml = string.Empty; string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[NetworkCloud.Person.HasResearchArea.GetXML]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) xml += dbreader[0].ToString(); if (!dbreader.IsClosed) dbreader.Close(); return xml; }
public DataView GetNetworkTimeline(RDFTriple request, string storedproc) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlDataAdapter dataAdapter = null; DataSet dataSet = null; DataView dataView = null; var db = new SqlConnection(connstr); dataAdapter = new SqlDataAdapter(storedproc + " " + request.Subject, db); dataSet = new DataSet(); dataAdapter.Fill(dataSet); dataView = new DataView(dataSet.Tables[0]); db.Close(); return dataView; }
public void DrawProfilesCloud() { XmlDocument document = new XmlDocument(); string xml = string.Empty; Profiles.Profile.Utilities.DataIO pdata = new Profiles.Profile.Utilities.DataIO(); RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); document.LoadXml(pdata.GetNetworkCloud(request).ToString().Replace("&", "&")); XslCompiledTransform xslt = new XslCompiledTransform(); XsltArgumentList args = new XsltArgumentList(); args.AddParam("root", "", Root.Domain); litListView.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/NetworkList/NetworkList.xslt"), args, document.OuterXml); }
protected void InitAssets() { System.Web.UI.HtmlControls.HtmlLink NetworkBrowsercss = new System.Web.UI.HtmlControls.HtmlLink(); NetworkBrowsercss.Href = Root.Domain + "/Profile/CSS/NetworkBrowser.css"; NetworkBrowsercss.Attributes["rel"] = "stylesheet"; NetworkBrowsercss.Attributes["type"] = "text/css"; NetworkBrowsercss.Attributes["media"] = "all"; Page.Header.Controls.Add(NetworkBrowsercss); HtmlGenericControl jsscript1 = new HtmlGenericControl("script"); jsscript1.Attributes.Add("type", "text/javascript"); jsscript1.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/scriptaculous/lib/prototype.js"); Page.Header.Controls.Add(jsscript1); HtmlGenericControl jsscript2 = new HtmlGenericControl("script"); jsscript2.Attributes.Add("type", "text/javascript"); jsscript2.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/scriptaculous/src/scriptaculous.js"); Page.Header.Controls.Add(jsscript2); HtmlGenericControl jsscript3 = new HtmlGenericControl("script"); jsscript3.Attributes.Add("type", "text/javascript"); jsscript3.Attributes.Add("src", Root.Domain + "/Profile/Modules/NetworkRadial/javascript/networkBrowserClass.js"); Page.Header.Controls.Add(jsscript3); divSwfScript.InnerHtml = "<script language=\"JavaScript\" type=\"text/javascript\"> " + "AC_FL_RunContent(" + "'codebase', '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0'," + "'width', '600'," + "'height', '600'," + "'src', '" + Root.Domain + "/profile/Modules/NetworkRadial/network_browser.swf'," + "'movie', '" + Root.Domain + "/profile/Modules/NetworkRadial/network_browser'," + "'quality', 'high'," + "'pluginspage', '//www.adobe.com/go/getflashplayer'," + "'align', 'middle'," + "'play', 'true'," + "'loop', 'true'," + "'scale', 'showall'," + "'wmode', 'transparent'," + "'devicefont', 'false'," + "'id', 'network_browserFLASH'," + "'bgcolor', '#ffffff'," + "'name', 'network_browserFLASH'," + "'menu', 'true'," + "'allowFullScreen', 'false'," + "'allowScriptAccess', 'always'," + "'salign', ''" + "); //end AC code" + "</script>"; HtmlGenericControl script = new HtmlGenericControl("script"); script.Attributes.Add("type", "text/javascript"); script.InnerHtml = "window.onload = function() {" + " network_browser._cfg.profile_network_path = '/"+Request.QueryString["Predicate"].ToString()+"/radial'; " + " network_browser.Init('" + Root.Domain + "/profile/modules/NetworkRadial/NetworkRadialSvc.aspx?p='); " + " network_browser.loadNetwork('" + Request.QueryString["Subject"].ToString() + "'); " + "}"; Page.Header.Controls.Add(script); Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); RDFTriple request = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); XmlDocument x = data.GetProfileNetworkForBrowser(request); System.Xml.Xsl.XsltArgumentList args = new System.Xml.Xsl.XsltArgumentList(); args.AddParam("root", "", Root.Domain); System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform(); litNetworkText.Text = Profiles.Framework.Utilities.XslHelper.TransformInMemory(Server.MapPath("~/profile/XSLT/NetworkTable.xslt"), args, x.InnerXml); }