示例#1
0
 public void LoadSettingsFromXml()
 {
     ClientConfiguration   = ConfigurationDocument.Clients.Find(c => c.ClientName == ClientName);
     TransferConfiguration = ClientConfiguration.Transfers.Find(t => t.TransferName == TransferName);
     LoadAllEndPoints();
     cmbSource.Text            = TransferConfiguration.SourceEndpointName;
     cmbDestination.Text       = TransferConfiguration.TargetEndpointName;
     txtSourceFilter.Text      = TransferConfiguration.SourceFilter;
     txtDestinationFilter.Text = TransferConfiguration.TargetFilter;
     SetSourceEndpoint();
     SetDestinationEndpoint();
     PopulateSourceList();
     PopulateTargetList();
 }
示例#2
0
        private void amMoveTo_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            string selectedClient     = e.ClickedItem.Text;
            string originalPath       = tvClients.SelectedNode.FullPath;
            string originalClientName = originalPath.Split('\\')[0];
            string originalActionType = originalPath.Split('\\')[1];
            string originalActionName = originalPath.Split('\\')[2];
            string selectedPath       = selectedClient + '\\' + originalActionType + '\\' + originalActionName;

            if (!String.IsNullOrWhiteSpace(selectedClient))
            {
                EasyETLClient oldClient = configXmlDocument.GetClientConfiguration(originalClientName);
                EasyETLClient newClient = configXmlDocument.GetClientConfiguration(selectedClient);
                if ((oldClient != null) && (newClient != null))
                {
                    switch (originalActionType.ToLower())
                    {
                    case "actions":
                        EasyETLAction action = oldClient.Actions.Find(a => a.ActionName == originalActionName);
                        oldClient.Actions.Remove(action);
                        newClient.Actions.Add(action);
                        break;

                    case "datasources":
                        EasyETLDatasource datasource = oldClient.Datasources.Find(d => d.ActionName == originalActionName);
                        oldClient.Datasources.Remove(datasource);
                        newClient.Datasources.Add(datasource);
                        break;

                    case "exports":
                        EasyETLWriter writer = oldClient.Writers.Find(w => w.ActionName == originalActionName);
                        oldClient.Writers.Remove(writer);
                        newClient.Writers.Add(writer);
                        break;

                    case "endpoints":
                        EasyETLEndpoint endpoint = oldClient.Endpoints.Find(ep => ep.ActionName == originalActionName);
                        oldClient.Endpoints.Remove(endpoint);
                        newClient.Endpoints.Add(endpoint);
                        break;

                    case "parsers":
                        EasyETLParser parser = oldClient.Parsers.Find(p => p.ActionName == originalActionName);
                        oldClient.Parsers.Remove(parser);
                        newClient.Parsers.Add(parser);
                        break;

                    case "transfers":
                        EasyETLTransfer transfer = oldClient.Transfers.Find(t => t.TransferName == originalActionName);
                        oldClient.Transfers.Remove(transfer);
                        newClient.Transfers.Add(transfer);
                        break;

                    case "etls":
                        EasyETLJobConfiguration etl = oldClient.ETLs.Find(et => et.ETLName == originalActionName);
                        oldClient.ETLs.Remove(etl);
                        newClient.ETLs.Add(etl);
                        break;
                    }
                    configXmlDocument.Save();
                    LoadConfiguration(selectedPath);
                }
            }
        }
示例#3
0
        private void cmDelete_Click(object sender, EventArgs e)
        {
            bool     allowDelete = (tvClients.SelectedNode != null) && ((tvClients.SelectedNode.Parent == null) || (tvClients.SelectedNode.Nodes.Count == 0));
            TreeNode node        = tvClients.SelectedNode;

            if (allowDelete)
            {
                foreach (TabPage p in MainTablControl.TabPages)
                {
                    if (p.Text == node.FullPath)
                    {
                        MessageBox.Show("This configuration is open.  Please close window before attempting to delete the node.");
                        allowDelete = false;
                        break;
                    }
                }
            }

            if ((allowDelete) && (MessageBox.Show("Deleted nodes cannot be recovered.  Are you sure to delete ?", "Deleting Configuration", MessageBoxButtons.YesNo) == DialogResult.Yes))
            {
                string xPath = "//clients/client[@name='" + node.FullPath + "']";
                if (node.FullPath.Contains('\\'))
                {
                    string clientName   = node.FullPath.Split('\\')[0];
                    string nodeCategory = node.FullPath.Split('\\')[1];
                    string nodeName     = node.FullPath.Split('\\')[2];
                    xPath = "//clients/client[@name='" + clientName + "']/" + nodeCategory + "/" + nodeCategory.TrimEnd('s') + "[@name='" + nodeName + "']";
                }
                string selectedNodePath = "";
                if (node.NextNode != null)
                {
                    selectedNodePath = node.NextNode.FullPath;
                }
                if (node.PrevNode != null)
                {
                    selectedNodePath = node.PrevNode.FullPath;
                }
                if ((selectedNodePath == "") && (node.Parent != null))
                {
                    selectedNodePath = node.Parent.FullPath;
                }

                if (!tvClients.SelectedNode.FullPath.Contains('\\'))
                {
                    //This is a client
                    EasyETLClient client = configXmlDocument.GetClientConfiguration(tvClients.SelectedNode.Text);
                    if (client != null)
                    {
                        configXmlDocument.Clients.Remove(client);
                    }
                    configXmlDocument.Save();
                    LoadConfiguration(selectedNodePath);
                }
                else
                {
                    if (tvClients.SelectedNode.FullPath.Split('\\').Length == 3)
                    {
                        //This is leaf node...
                        string        clientName   = tvClients.SelectedNode.FullPath.Split('\\')[0];
                        string        nodeCategory = tvClients.SelectedNode.FullPath.Split('\\')[1];
                        string        nodeName     = tvClients.SelectedNode.FullPath.Split('\\')[2];
                        EasyETLClient selectedClientConfiguration = configXmlDocument.GetClientConfiguration(clientName);
                        if (selectedClientConfiguration != null)
                        {
                            switch (nodeCategory.ToLower())
                            {
                            case "actions":
                                EasyETLAction action = selectedClientConfiguration.Actions.Find(a => a.ActionName == nodeName);
                                selectedClientConfiguration.Actions.Remove(action);
                                break;

                            case "datasources":
                                EasyETLDatasource datasource = selectedClientConfiguration.Datasources.Find(d => d.ActionName == nodeName);
                                selectedClientConfiguration.Datasources.Remove(datasource);
                                break;

                            case "exports":
                                EasyETLWriter writer = selectedClientConfiguration.Writers.Find(w => w.ActionName == nodeName);
                                selectedClientConfiguration.Writers.Remove(writer);
                                break;

                            case "endpoints":
                                EasyETLEndpoint endpoint = selectedClientConfiguration.Endpoints.Find(ep => ep.ActionName == nodeName);
                                selectedClientConfiguration.Endpoints.Remove(endpoint);
                                break;

                            case "parsers":
                                EasyETLParser parser = selectedClientConfiguration.Parsers.Find(p => p.ActionName == nodeName);
                                selectedClientConfiguration.Parsers.Remove(parser);
                                break;

                            case "transfers":
                                EasyETLTransfer transfer = selectedClientConfiguration.Transfers.Find(t => t.TransferName == nodeName);
                                selectedClientConfiguration.Transfers.Remove(transfer);
                                break;

                            case "etls":
                                EasyETLJobConfiguration etl = selectedClientConfiguration.ETLs.Find(et => et.ETLName == nodeName);
                                selectedClientConfiguration.ETLs.Remove(etl);
                                break;
                            }
                        }
                        configXmlDocument.Save();
                        LoadConfiguration(selectedNodePath);
                    }
                }
            }
        }
示例#4
0
        private void cmClone_Click(object sender, EventArgs e)
        {
            string newPath = "";

            if (!tvClients.SelectedNode.FullPath.Contains('\\'))
            {
                //This is a client
                EasyETLClient client = configXmlDocument.GetClientConfiguration(tvClients.SelectedNode.Text);
                if (client != null)
                {
                    newPath = "Copy Of " + client.ClientName;
                    EasyETLClient newClient     = new EasyETLClient();
                    XmlElement    clientElement = configXmlDocument.CreateElement("client");
                    client.WriteSettings(clientElement);
                    newClient.ReadSettings(clientElement);
                    newClient.AttributesDictionary = new Dictionary <string, string>(client.AttributesDictionary);
                    newClient.ClientID             = newPath;
                    newClient.ClientName           = newPath;
                    configXmlDocument.Clients.Add(newClient);
                }
            }
            else
            {
                if (tvClients.SelectedNode.FullPath.Split('\\').Length == 3)
                {
                    //This is leaf node...
                    string clientName   = tvClients.SelectedNode.FullPath.Split('\\')[0];
                    string nodeCategory = tvClients.SelectedNode.FullPath.Split('\\')[1];
                    string nodeName     = tvClients.SelectedNode.FullPath.Split('\\')[2];
                    string newNodeName  = "Copy Of " + nodeName;
                    newPath = clientName + '\\' + nodeCategory + '\\' + newNodeName;
                    EasyETLClient selectedClientConfiguration = configXmlDocument.GetClientConfiguration(clientName);
                    if (selectedClientConfiguration != null)
                    {
                        XmlElement element = null;
                        switch (nodeCategory.ToLower())
                        {
                        case "actions":
                            EasyETLAction action    = selectedClientConfiguration.Actions.Find(a => a.ActionName == nodeName);
                            EasyETLAction newAction = new EasyETLAction();
                            element = configXmlDocument.CreateElement("action");
                            action.WriteSettings(element);
                            newAction.ReadSettings(element);
                            newAction.ActionName = newNodeName;
                            newAction.ActionID   = newNodeName;
                            selectedClientConfiguration.Actions.Add(newAction);
                            break;

                        case "datasources":
                            EasyETLDatasource datasource    = selectedClientConfiguration.Datasources.Find(d => d.ActionName == nodeName);
                            EasyETLDatasource newdatasource = new EasyETLDatasource();
                            element = configXmlDocument.CreateElement("datasource");
                            datasource.WriteSettings(element);
                            newdatasource.ReadSettings(element);
                            newdatasource.ActionName = newNodeName;
                            newdatasource.ActionID   = newNodeName;
                            selectedClientConfiguration.Datasources.Add(newdatasource);
                            break;

                        case "exports":
                            EasyETLWriter writer    = selectedClientConfiguration.Writers.Find(w => w.ActionName == nodeName);
                            EasyETLWriter newwriter = new EasyETLWriter();
                            element = configXmlDocument.CreateElement("export");
                            writer.WriteSettings(element);
                            newwriter.ReadSettings(element);
                            newwriter.ActionName = newNodeName;
                            newwriter.ActionID   = newNodeName;
                            selectedClientConfiguration.Writers.Add(newwriter);
                            break;

                        case "endpoints":
                            EasyETLEndpoint endpoint    = selectedClientConfiguration.Endpoints.Find(ep => ep.ActionName == nodeName);
                            EasyETLEndpoint newendpoint = new EasyETLEndpoint();
                            element = configXmlDocument.CreateElement("endpoint");
                            endpoint.WriteSettings(element);
                            newendpoint.ReadSettings(element);
                            newendpoint.ActionName = newNodeName;
                            newendpoint.ActionID   = newNodeName;
                            selectedClientConfiguration.Endpoints.Add(newendpoint);
                            break;

                        case "parsers":
                            EasyETLParser parser    = selectedClientConfiguration.Parsers.Find(p => p.ActionName == nodeName);
                            EasyETLParser newparser = new EasyETLParser();
                            element = configXmlDocument.CreateElement("parser");
                            parser.WriteSettings(element);
                            newparser.ReadSettings(element);
                            newparser.ActionName = newNodeName;
                            newparser.ActionID   = newNodeName;
                            selectedClientConfiguration.Parsers.Add(newparser);
                            break;

                        case "transfers":
                            EasyETLTransfer transfer    = selectedClientConfiguration.Transfers.Find(t => t.TransferName == nodeName);
                            EasyETLTransfer newtransfer = new EasyETLTransfer();
                            element = configXmlDocument.CreateElement("transfer");
                            transfer.WriteSettings(element);
                            newtransfer.ReadSettings(element);
                            newtransfer.TransferName = newNodeName;
                            selectedClientConfiguration.Transfers.Add(newtransfer);
                            break;

                        case "etls":
                            EasyETLJobConfiguration etl    = selectedClientConfiguration.ETLs.Find(et => et.ETLName == nodeName);
                            EasyETLJobConfiguration newetl = new EasyETLJobConfiguration();
                            element = configXmlDocument.CreateElement("etl");
                            etl.WriteSettings(element);
                            newetl.ReadSettings(element);
                            newetl.ETLID   = newNodeName;
                            newetl.ETLName = newNodeName;
                            selectedClientConfiguration.ETLs.Add(newetl);
                            break;
                        }
                    }
                }
            }
            configXmlDocument.Save();
            LoadConfiguration(newPath);
        }
示例#5
0
        private void SaveXmlFile(TreeNode node, string newLabel)
        {
            if (configXmlDocument.GetClientConfiguration(node.Text) != null)
            {
                configXmlDocument.GetClientConfiguration(node.Text).ClientName = newLabel;
            }
            if (node.FullPath.Contains('\\'))
            {
                string        clientName   = node.FullPath.Split('\\')[0];
                string        nodeCategory = node.FullPath.Split('\\')[1];
                string        nodeName     = node.FullPath.Split('\\')[2];
                string        nodeLabel    = newLabel;
                EasyETLClient selectedClientConfiguration = configXmlDocument.GetClientConfiguration(clientName);
                if (selectedClientConfiguration != null)
                {
                    switch (nodeCategory.ToLower())
                    {
                    case "actions":
                        EasyETLAction action = selectedClientConfiguration.Actions.Find(a => a.ActionName == nodeName);
                        if (action == null)
                        {
                            action = new EasyETLAction()
                            {
                                ActionID = newLabel, ActionName = newLabel
                            };
                            selectedClientConfiguration.Actions.Add(action);
                        }
                        action.ActionName = newLabel;
                        break;

                    case "datasources":
                        EasyETLDatasource datasource = selectedClientConfiguration.Datasources.Find(d => d.ActionName == nodeName);
                        if (datasource == null)
                        {
                            datasource = new EasyETLDatasource()
                            {
                                ActionID = newLabel, ActionName = newLabel
                            };
                            selectedClientConfiguration.Datasources.Add(datasource);
                        }
                        datasource.ActionName = newLabel;
                        break;

                    case "exports":
                        EasyETLWriter writer = selectedClientConfiguration.Writers.Find(w => w.ActionName == nodeName);
                        if (writer == null)
                        {
                            writer = new EasyETLWriter()
                            {
                                ActionID = newLabel, ActionName = newLabel
                            };
                            selectedClientConfiguration.Writers.Add(writer);
                        }
                        writer.ActionName = newLabel;
                        break;

                    case "endpoints":
                        EasyETLEndpoint endpoint = selectedClientConfiguration.Endpoints.Find(ep => ep.ActionName == nodeName);
                        if (endpoint == null)
                        {
                            endpoint = new EasyETLEndpoint()
                            {
                                ActionID = newLabel, ActionName = newLabel
                            };
                            selectedClientConfiguration.Endpoints.Add(endpoint);
                        }
                        endpoint.ActionName = newLabel;
                        break;

                    case "parsers":
                        EasyETLParser parser = selectedClientConfiguration.Parsers.Find(p => p.ActionName == nodeName);
                        if (parser == null)
                        {
                            parser = new EasyETLParser()
                            {
                                ActionID = newLabel, ActionName = newLabel
                            };
                            selectedClientConfiguration.Parsers.Add(parser);
                        }
                        parser.ActionName = newLabel;
                        break;

                    case "transfers":
                        EasyETLTransfer transfer = selectedClientConfiguration.Transfers.Find(t => t.TransferName == nodeName);
                        if (transfer == null)
                        {
                            transfer = new EasyETLTransfer()
                            {
                                TransferName = newLabel
                            };
                            selectedClientConfiguration.Transfers.Add(transfer);
                        }
                        transfer.TransferName = newLabel;
                        break;

                    case "etls":
                        EasyETLJobConfiguration etl = selectedClientConfiguration.ETLs.Find(e => e.ETLName == nodeName);
                        if (etl == null)
                        {
                            etl = new EasyETLJobConfiguration()
                            {
                                ETLID = newLabel, ETLName = newLabel
                            };
                            selectedClientConfiguration.ETLs.Add(etl);
                        }
                        etl.ETLName = newLabel;
                        break;
                    }
                }
            }
            configXmlDocument.Save();
        }