Esempio n. 1
0
 private void cmNewClient_Click(object sender, EventArgs e)
 {
     if ((tvClients.SelectedNode == null) || (tvClients.SelectedNode.Parent == null))
     {
         string        newPath   = "Client_" + tvClients.Nodes.Count + 1;
         EasyETLClient newClient = new EasyETLClient();
         newClient.ClientID   = newPath;
         newClient.ClientName = newPath;
         configXmlDocument.Clients.Add(newClient);
         configXmlDocument.Save();
         LoadConfiguration(newPath);
     }
 }
Esempio n. 2
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();
 }
Esempio n. 3
0
        public void LoadSettingsFromConfig()
        {
            ClientConfiguration = ConfigXmlDocument.Clients.Find(c => c.ClientName == ClientName);

            switch (ClassType.ToLower())
            {
            case "action":
                ActionConfiguration = ClientConfiguration.Actions.Find(a => a.ActionName == ActionName);
                break;

            case "export":
                ActionConfiguration = ClientConfiguration.Writers.Find(a => a.ActionName == ActionName);
                break;

            case "endpoint":
                ActionConfiguration = ClientConfiguration.Endpoints.Find(a => a.ActionName == ActionName);
                break;

            case "datasource":
                ActionConfiguration = ClientConfiguration.Datasources.Find(a => a.ActionName == ActionName);
                break;

            case "parser":
                ActionConfiguration = ClientConfiguration.Parsers.Find(a => a.ActionName == ActionName);
                break;

            default:
                ActionConfiguration = null;
                break;
            }
            txtActionName.Text        = ActionConfiguration.ActionName;
            cmbClassName.SelectedItem = ActionConfiguration.ClassName;
            SelectedClassSettings     = ActionConfiguration.Fields;
            RefreshGridView();
            UpdateColorOfLabel();
        }
Esempio n. 4
0
        public void LoadSettingsFromXml()
        {
            #region load profiles
            cmbParserProfile.Items.Clear();
            cbTextExtractor.Items.Clear();
            ClientConfiguration = ConfigXmlDocument.Clients.Find(c => c.ClientName == ClientName);
            JobConfiguration    = ClientConfiguration.ETLs.Find(etl => etl.ETLName == ETLName);
            foreach (ClassMapping extractorMapping in EasyETLEnvironment.Extractors)
            {
                cbTextExtractor.Items.Add(extractorMapping.DisplayName);
            }

            foreach (ClassMapping classMapping in EasyETLEnvironment.Parsers)
            {
                if ((classMapping.Class.GetEasyFields().Count() == 0) || (!classMapping.Class.GetEasyFields().Select(p => p.Value.DefaultValue).Contains(null)))
                {
                    cmbParserProfile.Items.Add(classMapping.DisplayName);
                }
            }

            foreach (EasyETLParser easyETLParser in ClientConfiguration.Parsers)
            {
                cmbParserProfile.Items.Add(easyETLParser.ActionName);
            }
            #endregion


            #region load all available actions
            chkAvailableActions.Items.Clear();
            fpActions.Controls.Clear();
            foreach (EasyETLAction etlAction in ClientConfiguration.Actions)
            {
                string actionName = etlAction.ActionName;
                string className  = etlAction.ClassName;
                if (EasyETLEnvironment.Actions.Where(a => a.DisplayName == className).Count() > 0)
                {
                    ClassMapping cMapping = EasyETLEnvironment.Actions.Where(a => a.DisplayName == className).First();
                    chkAvailableActions.Items.Add(etlAction.ActionName);
                    Button btnControl = new Button
                    {
                        AutoSize = true,
                        Text     = etlAction.ActionName
                    };
                    btnControl.Click += btnControl_Click;
                    fpActions.Controls.Add(btnControl);
                }
            }

            #endregion

            #region load all available exports

            chkAvailableExports.Items.Clear();
            cmbExport.Items.Clear();

            foreach (EasyETLWriter easyETLWriter in ClientConfiguration.Writers)
            {
                string       actionName         = easyETLWriter.ActionName;
                string       className          = easyETLWriter.ClassName;
                ClassMapping exportClassMapping = EasyETLEnvironment.Writers.Find(w => w.DisplayName == className);
                if (exportClassMapping != null)
                {
                    chkAvailableExports.Items.Add(actionName);
                }
            }
            #endregion

            #region load all available data sources
            cmbDatasource.Items.Clear();
            foreach (EasyETLDatasource easyETLDatasource in ClientConfiguration.Datasources)
            {
                cmbDatasource.Items.Add(easyETLDatasource.ActionName);
            }
            #endregion

            #region load all available endpoints
            cmbEndpoint.Items.Clear();
            foreach (EasyETLEndpoint easyETLEndpoint in ClientConfiguration.Endpoints)
            {
                cmbEndpoint.Items.Add(easyETLEndpoint.ActionName);
            }
            #endregion


            #region Actions Load
            foreach (EasyETLJobAction easyETLJobAction in JobConfiguration.Actions)
            {
                int  loadIndex = chkAvailableActions.Items.IndexOf(easyETLJobAction.ActionName);
                bool toCheck   = (easyETLJobAction.IsEnabled);
                if (loadIndex >= 0)
                {
                    chkAvailableActions.SetItemChecked(loadIndex, toCheck);
                }
                if (easyETLJobAction.IsDefault)
                {
                    cmbDefaultAction.Text = easyETLJobAction.ActionName;
                }
            }

            DisplayActionButtonsAsNeeded();
            #endregion

            #region Transformations Load
            cbOnLoadProfiles.Text  = JobConfiguration.Transformations.DuringLoad.SaveProfileName;
            txtOnLoadFileName.Text = JobConfiguration.Transformations.DuringLoad.SaveFileName;
            txtOnLoadContents.Text = String.Join(Environment.NewLine, JobConfiguration.Transformations.DuringLoad.SettingsCommands);

            chkUseXsltTemplate.Checked = JobConfiguration.Transformations.AfterLoad.UseXslt;
            cbTransformProfiles.Text   = JobConfiguration.Transformations.AfterLoad.SaveProfileName;
            txtTransformFileName.Text  = JobConfiguration.Transformations.AfterLoad.SaveFileName;
            txtXsltFileName.Text       = JobConfiguration.Transformations.AfterLoad.XsltFileName;
            txtTransformText.Text      = String.Join(Environment.NewLine, JobConfiguration.Transformations.AfterLoad.SettingsCommands);

            rbUseDatasetLoad.Checked     = !JobConfiguration.Transformations.Dataset.UseCustom;
            rbUseCustomTableLoad.Checked = JobConfiguration.Transformations.Dataset.UseCustom;
            txtNodeMapping.Text          = String.Join(Environment.NewLine, JobConfiguration.Transformations.Dataset.SettingsCommands);

            #endregion

            #region ParserOptions Load
            cmbParserProfile.Text = JobConfiguration.ParseOptions.ProfileName;
            #endregion

            #region Output Settings Load
            foreach (EasyETLJobExport easyETLJobExport in JobConfiguration.Exports)
            {
                int  loadIndex = chkAvailableExports.Items.IndexOf(easyETLJobExport.ExportName);
                bool toCheck   = (easyETLJobExport.IsEnabled);
                if (loadIndex >= 0)
                {
                    chkAvailableExports.SetItemChecked(loadIndex, toCheck);
                }
            }
            #endregion

            #region Permissions Settings
            btnSaveSettings.Visible = false;
            EasyETLPermission etlPermission = JobConfiguration.DefaultPermission;
            chkCanEditConfiguration.Checked    = etlPermission.CanEditSettings;
            chkShowConfigurationOnLoad.Checked = etlPermission.DisplaySettingsOnLoad;
            chkCanAddData.Checked    = etlPermission.CanAddData;
            chkCanEditData.Checked   = etlPermission.CanEditData;
            chkCanDeleteData.Checked = etlPermission.CanDeleteData;
            chkCanExportData.Checked = etlPermission.CanExportData;

            ToggleDisplayConfigurationSection(chkShowConfigurationOnLoad.Checked && etlPermission.CanViewSettings);

            chkAutoRefresh.Visible  = chkCanEditConfiguration.Checked;
            btnSaveSettings.Visible = chkCanEditConfiguration.Checked;
            pnlExport.Visible       = chkCanExportData.Checked;
            #endregion

            #region Datasource Node Load
            if (!String.IsNullOrWhiteSpace(JobConfiguration.Datasource.SourceType))
            {
                tabDataSource.SelectTab("tabDatasource" + JobConfiguration.Datasource.SourceType);
            }
            cmbEndpoint.Text            = JobConfiguration.Datasource.Endpoint;
            txtFileName.Text            = JobConfiguration.Datasource.FileName;
            chkUseTextExtractor.Checked = JobConfiguration.Datasource.UseTextExtractor;
            cbTextExtractor.Text        = JobConfiguration.Datasource.TextExtractor;
            chkHasMaxRows.Checked       = JobConfiguration.Datasource.HasMaxRows;
            nudMaxRows.Value            = JobConfiguration.Datasource.MaxRows;
            cmbDatasource.Text          = JobConfiguration.Datasource.DataSource;
            txtTextContents.Text        = JobConfiguration.Datasource.TextContents;
            txtDatabaseQuery.Text       = JobConfiguration.Datasource.Query;
            #endregion

            chkAutoRefresh.Checked = JobConfiguration.AutoRefresh; // (xNode.Attributes.GetNamedItem("autorefresh") == null) ? false : Boolean.Parse(xNode.Attributes.GetNamedItem("autorefresh").Value);
        }
Esempio n. 5
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);
                }
            }
        }
Esempio n. 6
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);
                    }
                }
            }
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        private void tvClients_DoubleClick(object sender, EventArgs e)
        {
            if (tvClients.SelectedNode == null)
            {
                return;
            }
            foreach (TabPage p in MainTablControl.TabPages)
            {
                if (p.Text == tvClients.SelectedNode.FullPath)
                {
                    MainTablControl.SelectedTab = p;
                    return;
                }
            }

            Form currentForm = null;

            if (tvClients.SelectedNode.Parent == null)
            {
                //this is the top level node...
                EasyETLClient selectClientConfiguration = configXmlDocument.GetClientConfiguration(tvClients.SelectedNode.Text);
                if (selectClientConfiguration != null)
                {
                    ClientSettingsConfiguration cForm = new ClientSettingsConfiguration
                    {
                        clientConfiguration = selectClientConfiguration,
                        configDocument      = configXmlDocument
                    };
                    cForm.LoadConfiguration();
                    currentForm = cForm;
                }
            }

            if ((tvClients.SelectedNode.Parent != null) && (tvClients.SelectedNode.Parent.Parent != null))
            {
                string clientName = tvClients.SelectedNode.Parent.Parent.Text;
                string nodeName   = tvClients.SelectedNode.Text;
                if ("actions;exports;datasources;endpoints;parsers;etls;transfers".Split(';').Contains(tvClients.SelectedNode.Parent.Text))
                {
                    switch (tvClients.SelectedNode.Parent.Text)
                    {
                    case "etls":
                        ETLForm mForm = new ETLForm
                        {
                            ConfigXmlDocument = configXmlDocument,
                            ClientName        = clientName,
                            ETLName           = nodeName
                        };
                        mForm.LoadControls();
                        mForm.LoadSettingsFromXml();
                        currentForm = mForm;
                        break;

                    case "transfers":
                        TransferForm tForm = new TransferForm()
                        {
                            ConfigurationDocument = configXmlDocument,
                            ClientName            = clientName,
                            TransferName          = nodeName
                        };
                        tForm.LoadSettingsFromXml();
                        currentForm = tForm;
                        break;

                    case "actions":
                    case "exports":
                    case "endpoints":
                    case "datasources":
                    case "parsers":
                        ClassConfigurationForm aForm = new ClassConfigurationForm
                        {
                            ClassType         = tvClients.SelectedNode.Parent.Text.TrimEnd('s'),
                            ConfigXmlDocument = configXmlDocument,
                            ClientName        = clientName,
                            ActionName        = nodeName
                        };
                        switch (tvClients.SelectedNode.Parent.Text)
                        {
                        case "actions":
                            aForm.BaseClassType = typeof(AbstractEasyAction);
                            aForm.lstClasses    = EasyETLEnvironment.Actions;
                            break;

                        case "exports":
                            aForm.BaseClassType = typeof(DatasetWriter);
                            aForm.lstClasses    = EasyETLEnvironment.Writers;
                            break;

                        case "endpoints":
                            aForm.BaseClassType = typeof(AbstractEasyEndpoint);
                            aForm.lstClasses    = EasyETLEnvironment.Endpoints;
                            break;

                        case "datasources":
                            aForm.BaseClassType = typeof(DatasourceEasyParser);
                            aForm.lstClasses    = EasyETLEnvironment.Datasources;
                            break;

                        case "parsers":
                            aForm.BaseClassType = typeof(ContentEasyParser);
                            aForm.lstClasses    = EasyETLEnvironment.Parsers;
                            break;

                        default:
                            break;
                        }
                        aForm.LoadFormControls();
                        aForm.LoadSettingsFromConfig();
                        //aForm.LoadSettingsFromXml(tvClients.SelectedNode.FullPath);
                        currentForm = aForm;
                        break;
                    }
                }
            }
            if (currentForm != null)
            {
                currentForm.TopLevel  = false;
                currentForm.MdiParent = this;
                MainTablControl.TabPages.Add(tvClients.SelectedNode.FullPath);
                TabPage newTabPage = MainTablControl.TabPages[MainTablControl.TabCount - 1];
                newTabPage.Controls.Add(currentForm);
                currentForm.Dock = DockStyle.Fill;
                currentForm.Show();
                currentForm.FormBorderStyle = FormBorderStyle.None;
                MainTablControl.SelectedTab = newTabPage;
            }
        }
Esempio n. 9
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();
        }