private void AddServerConnection(HttpContext context) { // Get the full path to the LinkBi definition // file from the http request's parameters. string fileName = context.Request.Params["FileName"]; // Create a new LinkBi definition by the file. LinkBiDefinition definition = new LinkBiDefinition( Global.Core, fileName, Global.HierarchyFilters[fileName] ); // Select the xml node that contains the server connection definitions. XmlNode xmlNodeServerConnections = definition.XmlDocument.DocumentElement. SelectSingleNode("Properties/ServerConnections"); // Check if the xml node exists. if (xmlNodeServerConnections == null) { return; } // Add a new server connection xml node. xmlNodeServerConnections.InnerXml += string.Format( "<ServerConnection Id=\"{0}\"></ServerConnection>", Guid.NewGuid() ); // Save the LinkBi definition. definition.Save(); }
private void DeleteServerConnection(HttpContext context) { // Get the full path to the LinkBi definition // file from the http request's parameters. string fileName = context.Request.Params["FileName"]; // Get the xPath to the server connection xml // node from the http request's parameters. string xPath = context.Request.Params["XPath"]; // Create a new LinkBi definition by the file. LinkBiDefinition definition = new LinkBiDefinition( Global.Core, fileName, Global.HierarchyFilters[fileName] ); // Select the server connection xml node. XmlNode xmlNodeServerConnection = definition.XmlDocument.SelectSingleNode(xPath); // Check if the server connection exists. if (xmlNodeServerConnection == null) { return; } // Delete the server connection xml node. xmlNodeServerConnection.ParentNode.RemoveChild(xmlNodeServerConnection); // Save the LinkBi definition. definition.Save(); }
private void UpdateLinkBiSetting(HttpContext context) { // Get the name of the setting to update // from the http request's parameters. string name = context.Request.Params["Name"]; // Get the new value for the setting // from the http request's parameters. string value = context.Request.Params["Value"]; // Get the full path to the current report's definition file. string fileName = HttpContext.Current.Session["LinkBiDefinition"].ToString(); LinkBiDefinition linkBiDefinition = new LinkBiDefinition(Global.Core, fileName, Global.HierarchyFilters[fileName]); if (linkBiDefinition.Settings.Values.ContainsKey(name)) { linkBiDefinition.Settings.Values[name] = value; } else { linkBiDefinition.Settings.Values.Add(name, value); } linkBiDefinition.Properties.LatestUpdate = DateTime.Now; linkBiDefinition.Save(); }
private void ToggleLinkBiSelectorCategory(HttpContext context) { // Parse the id of the category to toggle. Guid idCategory = Guid.Parse( context.Request.Params["IdCategory"] ); // Get the xPath to the LinkBi filter item's xml node. string xPath = context.Request.Params["XPath"]; // Get the full path to the current report's definition file. string fileName = HttpContext.Current.Session["LinkBiDefinition"].ToString(); LinkBiDefinition linkBiDefinition = new LinkBiDefinition(Global.Core, fileName, Global.HierarchyFilters[fileName]); XmlNode xmlNode = linkBiDefinition.XmlDocument.SelectSingleNode(xPath); if (xmlNode == null) { return; } XmlNode xmlNodeCategory = xmlNode.SelectSingleNode(string.Format( "*[@Id=\"{0}\"]", idCategory )); string result = ""; if (xmlNodeCategory == null) { xmlNode.InnerXml += string.Format( "<{0} Id=\"{1}\"></{0}>", "TaxonomyCategory", idCategory ); result = "BackgroundColor2"; } else { xmlNode.RemoveChild(xmlNodeCategory); result = "Color1"; } linkBiDefinition.Save(); context.Response.Write(result); context.Response.ContentType = "text/plain"; }
private void SelectWorkflowSelectorItem(HttpContext context) { // Get the full path to the current report's definition file. string fileName = HttpContext.Current.Session["LinkBiDefinition"].ToString(); string workflowSelection = context.Request.Params["WorkflowSelection"]; string workflowSelectionVariable = context.Request.Params["WorkflowSelectionVariable"]; string action = context.Request.Params["Action"]; Guid idItem = Guid.Parse( context.Request.Params["IdItem"] ); LinkBiDefinition reportDefinition = new LinkBiDefinition(Global.Core, fileName, Global.HierarchyFilters[fileName]); bool isDefault = reportDefinition.Workflow.Selections[workflowSelection].SelectionVariables[workflowSelectionVariable].IsDefaultSelection; if (action == "Select") { reportDefinition.Workflow.Selections[workflowSelection].SelectionVariables[workflowSelectionVariable].Select(idItem); } else if (action == "DeSelect") { reportDefinition.Workflow.Selections[workflowSelection].SelectionVariables[workflowSelectionVariable].DeSelect(idItem); } bool hasSelection = false; foreach (WorkflowSelectionSelector selectionVariable in reportDefinition.Workflow.Selections[workflowSelection].SelectionVariables.Values) { if (selectionVariable.Selector.SelectedItems.Count > 0) { hasSelection = true; break; } } string result = "BackgroundColor8"; if (hasSelection) { result = "BackgroundColor1"; } context.Response.Write(result); context.Response.ContentType = "text/plain"; reportDefinition.Save(); }
private void UpdateServerConnectionProperty(HttpContext context) { // Get the full path to the LinkBi definition // file from the http request's parameters. string fileName = context.Request.Params["FileName"]; // Get the xPath to the server connection's xml // node from the http request's parameters. string xPath = context.Request.Params["XPath"]; // Create a new LinkBi definition by the file. LinkBiDefinition definition = new LinkBiDefinition( Global.Core, fileName, Global.HierarchyFilters[fileName] ); // Select the xml node that contains the server connection definitions. XmlNode xmlNodeServerConnection = definition.XmlDocument.SelectSingleNode(xPath); // Get the name of the field to update // from the http request's parameters. string name = context.Request.Params["Name"]; // Get the value of the field to update // from the http request's parameters. string value = context.Request.Params["Value"]; // Select the xml node that contains the field definition. XmlNode xmlNodeField = xmlNodeServerConnection.SelectSingleNode(name); // Check if the property exists. if (xmlNodeField == null) { xmlNodeServerConnection.InnerXml += string.Format( "<{0}>{1}</{0}>", name, value ); } else { xmlNodeField.InnerXml = value; } // Save the LinkBi definition. definition.Save(); }
private void DeployLinkBiReport(HttpContext context) { // Get the full path to the LinkBi definition // file from the http request's parameters. string fileName = context.Request.Params["FileName"]; // Create a new LinkBi definition by the file. LinkBiDefinition definition = new LinkBiDefinition( Global.Core, fileName, Global.HierarchyFilters[fileName] ); Guid?idServerConnection = null; // Check if the report should be deployed to a certain server connection. if (context.Request.Params["IdServerConnection"] != null) { idServerConnection = Guid.Parse(context.Request.Params["IdServerConnection"]); } bool success = false; if (idServerConnection.HasValue) { success = definition.Deploy(idServerConnection.Value); } else { // Deploy the LinkBi definition to all server connections. success = definition.Deploy(); } definition.Save(); if (idServerConnection.HasValue) { context.Response.Write(idServerConnection.Value.ToString() + "|" + success.ToString().ToLower()); } else { context.Response.Write(success.ToString().ToLower()); } }
private void UpdateLinkBiSavedReportName(HttpContext context) { // Get the full path to the LinkBi definition // file from the http request's parameters. string fileName = context.Request.Params["FileName"]; // Create a new LinkBi definition by the file. LinkBiDefinition definition = new LinkBiDefinition( Global.Core, fileName, Global.HierarchyFilters[fileName] ); // Change the name of the saved report. definition.Properties.Name = context.Request.Params["Value"]; // Save the LinkBi definition. definition.Save(); }
private void UpdateLinkBiWeightingVariable(HttpContext context) { // Get the full path to the current report's definition file. string fileName = HttpContext.Current.Session["LinkBiDefinition"].ToString(); LinkBiDefinition linkBiDefinition = new LinkBiDefinition(Global.Core, fileName, Global.HierarchyFilters[fileName]); Guid idVariable; if (Guid.TryParse(context.Request.Params["IdVariable"], out idVariable)) { linkBiDefinition.WeightingFilters.DefaultWeighting = idVariable; } else { linkBiDefinition.WeightingFilters.DefaultWeighting = null; } linkBiDefinition.Save(); }