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 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 LoadLinkBiDefinitionProperties(HttpContext context)
        {
            // Get the full path to the LinkBi definition
            // file from the http request's parameters.
            string fileName = context.Request.Params["FileName"];

            // Set the LinkBi definition file to the currently selected LinkBi definition.
            HttpContext.Current.Session["LinkBiSelectedReport"] = fileName;

            // Create a new LinkBi definition by the file.
            LinkBiDefinition definition = new LinkBiDefinition(
                Global.Core,
                fileName,
                Global.HierarchyFilters[fileName]
                );

            // Create a new properties control by the LinkBi definition.
            LinkBiDefinitionPropertiesControl propertiesControl = new LinkBiDefinitionPropertiesControl(definition);

            // Render the properties control.
            propertiesControl.Render();

            // Write the properties control as html string to the http response.
            context.Response.Write(propertiesControl.ToHtml());

            // Set the content type of the http response to plain text.
            context.Response.ContentType = "text/plain";
        }
        private void CheckLinkBiServerConnection(HttpContext context)
        {
            bool result = false;

            // Get the id of the server connection to
            // check from the http request's parameters.
            Guid idServerConnection = Guid.Parse(
                context.Request.Params["IdServerConnection"]
                );

            // 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]
                );

            if (definition.Properties.ServerConnections.ContainsKey(idServerConnection))
            {
                result = definition.Properties.ServerConnections[idServerConnection].IsValid();
            }

            context.Response.Write(result.ToString().ToLower());
        }
Example #6
0
 public HTML(DatabaseCore.Core core, LinkBiDefinition definition)
     : base(core, definition)
 {
     this.StorageMethod = new DataCore.Classes.StorageMethods.Database(
         this.Core,
         null
         );
 }
        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 GetSelectedWorkflowItems(HttpContext context)
        {
            string workflowSelection         = context.Request.Params["WorkflowSelection"];
            string workflowSelectionSelector = context.Request.Params["WorkflowSelectionSelector"];

            // Get the full path to the current report's definition file.
            string fileName = HttpContext.Current.Session["LinkBiDefinition"].ToString();

            LinkBiDefinition reportDefinition = new LinkBiDefinition(Global.Core, fileName, Global.HierarchyFilters[fileName]);

            List <Guid> selectedItems = reportDefinition.Workflow.Selections[workflowSelection].SelectionVariables[workflowSelectionSelector].Selector.SelectedItems;

            context.Response.Write(string.Join(",", selectedItems.ToArray()));
        }
        private void RemoveMeasure(HttpContext context)
        {
            Guid idVariable = Guid.Parse(
                context.Request.Params["Id"]
                );

            string fileName = HttpContext.Current.Session["LinkBiDefinition"].ToString();

            LinkBiDefinition definition = new LinkBiDefinition(Global.Core, fileName, Global.HierarchyFilters[fileName]);

            definition.Properties.LatestUpdate = DateTime.Now;

            definition.RemoveMeasure(idVariable);
        }
        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 IsOutdated(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]
                );

            context.Response.Write((definition.IsUpToDate() == false).ToString().ToLower());
        }
        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();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(HttpContext.Current.Session["LinkBiDefinition"].ToString()))
            {
                Response.Redirect("LinkBi.aspx");
                return;
            }

            string fileName = HttpContext.Current.Session["LinkBiDefinition"].ToString();

            // Check if the LinkBi definition exists.
            if (!File.Exists(fileName))
            {
                Response.Redirect("LinkBi.aspx");
            }

            this.LinkBiDefinition = new LinkBiDefinition(
                Global.Core,
                fileName,
                Global.HierarchyFilters[fileName]
                );
        }
 public LinkBiServerConnectionFTP(LinkBiDefinition owner, XmlNode xmlNode)
     : base(owner, xmlNode)
 {
 }
Example #18
0
 public LinkBiInterface(DatabaseCore.Core core, LinkBiDefinition definition)
     : this(core)
 {
     this.Definition = definition;
 }
 public TempTableTest(DatabaseCore.Core core, LinkBiDefinition definition)
     : base(core, definition)
 {
 }
        private void InitLinkBiDefinition()
        {
            if (HttpContext.Current.Session["LinkBiDefinition"] == null || File.Exists(HttpContext.Current.Session["LinkBiDefinition"].ToString()) == false)
            {
                string fileName = Path.Combine(
                    Request.PhysicalApplicationPath,
                    "Fileadmin",
                    "LinkBiDefinitions",
                    Global.Core.ClientName,
                    Global.User.Id + ".xml"
                    );

                if (!Directory.Exists(Path.GetDirectoryName(fileName)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(fileName));
                }

                // Check if the LinkBi definition exists.
                if (!File.Exists(fileName))
                {
                    File.Copy(Path.Combine(
                                  Request.PhysicalApplicationPath,
                                  "App_Data",
                                  "LinkBiDefinition.xml"
                                  ), fileName);

                    InitWorkflow(fileName);
                }

                HttpContext.Current.Session["LinkBiDefinition"] = fileName;
            }


            HierarchySelector.FileName = Path.Combine(
                HttpContext.Current.Request.PhysicalApplicationPath,
                "App_Data",
                "HierarchySelectors",
                Global.Core.ClientName + ".xml"
                );

            HierarchySelector.Source  = HttpContext.Current.Session["LinkBiDefinition"].ToString();
            EquationDefinition.Source = HierarchySelector.Source;
            csFilterDefinition.Source = HierarchySelector.Source;

            this.LinkBiDefinition = new LinkBiDefinition(
                Global.Core,
                HttpContext.Current.Session["LinkBiDefinition"].ToString(),
                Global.HierarchyFilters[HttpContext.Current.Session["LinkBiDefinition"].ToString()]
                );

            if (HierarchySelector.Exists)
            {
                HierarchySelector.Parse();

                int optionCount = 0;

                foreach (Classes.Controls.HierarchySelectorSection section in HierarchySelector.Sections.Values)
                {
                    optionCount += section.OptionCount;
                }

                if (optionCount <= 1)
                {
                    pnlRightPanelHierarchy.Visible = false;
                }
                else
                {
                    pnlRightPanelHierarchy.Attributes.Add("onclick", string.Format(
                                                              "InitDragBox('boxHierarchySelectorControl');LoadHierarchySelectedItems('{0}');",
                                                              HierarchySelector.Source
                                                              ));

                    if (this.LinkBiDefinition.XmlDocument.DocumentElement.SelectSingleNode("HierarchyFilter") == null)
                    {
                        Page.ClientScript.RegisterStartupScript(
                            this.GetType(),
                            "ShowHierarchySelector",
                            string.Format("InitDragBox('boxHierarchySelectorControl');LoadHierarchySelectedItems('{0}');", HierarchySelector.Source),
                            true
                            );
                    }
                }
            }
            else
            {
                pnlRightPanelHierarchy.Visible = false;
            }



            if (this.LinkBiDefinition.Dimensions.Count > 0 &&
                this.LinkBiDefinition.Measures.Count > 0)
            {
                pnlGoButton.CssClass = "GoButton2 GreenBackground2I";
                pnlGoButton.Attributes.Add("onclick", "window.location='SelectInterface.aspx';");
            }
            else
            {
                pnlGoButton.CssClass = "GoButton2";
            }
        }
Example #21
0
        public LinkBiDefinitionPropertiesControl(LinkBiDefinition definition)
        {
            this.Definition = definition;

            this.Load += LinkBiDefinitionPropertiesControl_Load;
        }
        private void BuildAPIRequestString(HttpContext context)
        {
            // Get the full path to the current report's definition file.
            string fileName = HttpContext.Current.Session["LinkBiDefinition"].ToString();

            // Check if the report exists.
            if (!File.Exists(fileName))
            {
                return;
            }

            LinkBiDefinition definition = new LinkBiDefinition(
                Global.Core,
                fileName,
                Global.HierarchyFilters[fileName]
                );

            // Create a new string builder to build
            // the result http request url.
            StringBuilder result = new StringBuilder();

            result.Append(context.Request.Url.ToString().
                          Replace(context.Request.Url.Query, "").
                          Replace("LinkBi.ashx", "LinkBiExternal.ashx"));

            result.Append("?Method=ProcessReport");

            // Run through all dimensions of the LinkBi definitions.
            for (int i = 0; i < definition.Dimensions.Count; i++)
            {
                result.Append(string.Format(
                                  "&Dimension{0}={1}",
                                  i + 1,
                                  definition.Dimensions[i].Name
                                  ));
            }

            // Run through all measures of the LinkBi definitions.
            for (int i = 0; i < definition.Measures.Count; i++)
            {
                result.Append(string.Format(
                                  "&Measure{0}={1}",
                                  i + 1,
                                  definition.Measures[i].Name
                                  ));
            }

            result.Append("&Filter=");

            foreach (string workflowSelection in definition.Workflow.Selections.Keys)
            {
                foreach (string workflowSelectionVariable in definition.Workflow
                         .Selections[workflowSelection].SelectionVariables.Keys)
                {
                    foreach (Guid idCategory in definition.Workflow.Selections[workflowSelection]
                             .SelectionVariables[workflowSelectionVariable].Selector.SelectedItems)
                    {
                        result.Append(idCategory.ToString());
                        result.Append(",");
                    }
                }
            }

            result.Append("&ResponseType=TABLE");

            result.Append(string.Format(
                              "&Username={0}&Password=",
                              Global.User.Name
                              ));

            context.Response.Write(result.ToString());

            result.Clear();
        }
        private void Save(HttpContext context)
        {
            // Get the full path to the current report's definition file.
            string fileName = HttpContext.Current.Session["LinkBiDefinition"].ToString();

            // Check if the report exists.
            if (!File.Exists(fileName))
            {
                return;
            }

            LinkBiDefinition definition = new LinkBiDefinition(
                Global.Core,
                fileName,
                Global.HierarchyFilters[fileName]
                );

            if (string.IsNullOrEmpty(definition.Properties.Name) == false)
            {
                return;
            }

            // Build the full path for the saved report file.
            string fileNameDestination = Path.Combine(
                HttpContext.Current.Request.PhysicalApplicationPath,
                "Fileadmin",
                "SavedLinkBiDefinitions",
                Global.Core.ClientName,
                Guid.NewGuid() + ".xml"
                );

            FileInfo fInfo = new FileInfo(fileNameDestination);

            if (!Directory.Exists(fInfo.Directory.FullName))
            {
                Directory.CreateDirectory(fInfo.Directory.FullName);
            }

            // Copy the file to the saved definitions directory.
            File.Copy(
                fileName,
                fileNameDestination
                );

            // Set the currently selected saved report to the new report.
            HttpContext.Current.Session["LinkBiSelectedReport"] = fileNameDestination;

            LinkBiDefinition definition2 = new global::LinkBi1.Classes.LinkBiDefinition(
                Global.Core,
                fileNameDestination,
                Global.HierarchyFilters[fileName]
                );

            definition2.Properties.Name = string.Format(
                Global.LanguageManager.GetText("NewLinkBiSavedReport"),
                Global.User.FirstName,
                Global.User.LastName
                );

            definition2.Properties.LatestUpdate = DateTime.Now;

            definition2.Save();
        }