public bool Deploy(Guid idServerConnection)
        {
            bool result = true;

            string export = null;

            if (!this.Properties.ServerConnections.ContainsKey(idServerConnection))
            {
                return(false);
            }

            LinkBiServerConnection serverConnection = this.Properties.ServerConnections[idServerConnection];

            LinkBiInterface exportInterface = null;

            switch (serverConnection.InterfaceType)
            {
            case LinkBiInterfaceType.PowerBI:
                exportInterface = new Excel(this.Core, this);
                break;

            case LinkBiInterfaceType.CustomCharts:
                exportInterface = new CustomCharts(this.Core, this);
                break;
            }

            if (exportInterface != null)
            {
                // Create the export for the server connection's provider.
                export = exportInterface.Render();

                // Deploy the file to the server.
                if (serverConnection.Deploy(
                        export
                        ) == false)
                {
                    result = false;
                }
            }
            else
            {
                return(false);
            }

            return(result);
        }
Ejemplo n.º 2
0
        private void InitServerConnections()
        {
            this.ServerConnections = new Dictionary <Guid, LinkBiServerConnection>();

            // Select all server connection xml nodes.
            XmlNodeList xmlNodes = this.XmlNode.SelectNodes("ServerConnections/ServerConnection");

            // Run through all server connection xml nodes.
            foreach (XmlNode xmlNode in xmlNodes)
            {
                LinkBiServerConnectionType connectionType = LinkBiServerConnectionType.FileSystem;

                // Get the xml node that contains the connection type definition.
                XmlNode xmlNodeConnectionType = xmlNode.SelectSingleNode("Type");

                Guid id = Guid.Parse(xmlNode.Attributes["Id"].Value);

                // Check if a connection type is set.
                if (xmlNodeConnectionType != null)
                {
                    connectionType = (LinkBiServerConnectionType)Enum.Parse(
                        typeof(LinkBiServerConnectionType),
                        xmlNodeConnectionType.InnerXml
                        );
                }

                LinkBiServerConnection connection = null;

                switch (connectionType)
                {
                case LinkBiServerConnectionType.FileSystem:

                    connection = new LinkBiServerConnections.LinkBiServerConnectionFileSystem(
                        this.Owner,
                        xmlNode
                        );

                    break;

                case LinkBiServerConnectionType.FTP:

                    connection = new LinkBiServerConnections.LinkBiServerConnectionFTP(
                        this.Owner,
                        xmlNode
                        );

                    break;

                    /*case LinkBiServerConnectionType.WebUpload:
                     *  break;*/
                }

                if (connection == null)
                {
                    continue;
                }

                // Add the server connection to the server connections.
                this.ServerConnections.Add(id, connection);
            }
        }