Пример #1
0
        /// <summary>
        /// Отобразить конфигурацию
        /// </summary>
        private void ConfigToControls()
        {
            // обнуление выбранного объекта
            selExpDest     = null;
            selExpDestNode = null;

            // очистка и заполнение дерева
            treeView.BeginUpdate();
            treeView.Nodes.Clear();

            foreach (Config.ExportDestination expDest in config.ExportDestinations)
            {
                treeView.Nodes.Add(NewExpDestNode(expDest));
            }

            treeView.ExpandAll();
            treeView.EndUpdate();

            // выбор первого узла дерева
            if (treeView.Nodes.Count > 0)
            {
                treeView.SelectedNode = treeView.Nodes[0];
            }

            SetControlsEnabled();
        }
Пример #2
0
        /// <summary>
        /// Display configuration
        /// </summary>
        private void ConfigToControls()
        {
            // resetting the selected object
            selExpDest     = null;
            selExpDestNode = null;

            // cleaning and filling wood
            treeView.BeginUpdate();
            treeView.Nodes.Clear();

            foreach (var expDest in config.ExportDestinations)
            {
                treeView.Nodes.Add(NewExpDestNode(expDest));
            }

            treeView.ExpandAll();
            treeView.EndUpdate();

            // selection of the first tree node
            if (treeView.Nodes.Count > 0)
            {
                treeView.SelectedNode = treeView.Nodes[0];
            }

            SetControlsEnabled();
        }
Пример #3
0
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            // определение и отображение свойств выбранного объекта
            TreeNode selNode = e.Node;

            selExpDest     = selNode.Tag as Config.ExportDestination;
            selExpDestNode = selExpDest == null ? null : selNode;
            ShowSelectedExportParams();
        }
Пример #4
0
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            // definition and display of properties of the selected object
            var selNode = e.Node;

            selExpDest     = selNode.Tag as Config.ExportDestination;
            selExpDestNode = selExpDest == null ? null : selNode;
            ShowSelectedExportParams();
        }
Пример #5
0
        private TreeNode selExpDestNode;             // узел дерева выбранного назначения экспорта


        /// <summary>
        /// Конструктор, ограничивающий создание формы без параметров
        /// </summary>
        private FrmDBExportConfig()
        {
            InitializeComponent();

            config         = null;
            configCopy     = null;
            modified       = false;
            changing       = false;
            selExpDest     = null;
            selExpDestNode = null;
        }
Пример #6
0
        private void miAddDataSource_Click(object sender, EventArgs e)
        {
            // добавление назначения экспорта
            DataSource dataSource = null;

            if (sender == miAddSqlDataSource)
            {
                dataSource = new SqlDataSource();
            }
            else if (sender == miAddOraDataSource)
            {
                dataSource = new OraDataSource();
            }
            else if (sender == miAddPgSqlDataSource)
            {
                dataSource = new PgSqlDataSource();
            }
            else if (sender == miAddMySqlDataSource)
            {
                dataSource = new MySqlDataSource();
            }
            else if (sender == miAddOleDbDataSource)
            {
                dataSource = new OleDbDataSource();
            }

            if (dataSource != null)
            {
                Config.ExportDestination expDest = new Config.ExportDestination(dataSource, new Config.ExportParams());
                TreeNode treeNode = NewExpDestNode(expDest);

                int ind = config.ExportDestinations.BinarySearch(expDest);
                if (ind >= 0)
                {
                    ind++;
                }
                else
                {
                    ind = ~ind;
                }

                config.ExportDestinations.Insert(ind, expDest);
                treeView.Nodes.Insert(ind, treeNode);
                treeView.SelectedNode = treeNode;

                SetConnectionString();
                SetControlsEnabled();
                Modified = true;
            }
        }
Пример #7
0
        /// <summary>
        /// Конструктор
        /// </summary>
        public Exporter(Config.ExportDestination expDest, Log log)
        {
            if (expDest == null)
            {
                throw new ArgumentNullException("expDest");
            }

            this.log     = log;
            curSrezQueue = new Queue <SrezTableLight.Srez>(MaxQueueSize);
            arcSrezQueue = new Queue <SrezTableLight.Srez>(MaxQueueSize);
            evQueue      = new Queue <EventTableLight.Event>(MaxQueueSize);
            thread       = null;
            terminated   = false;
            running      = false;

            ResetStats();

            DataSource   = expDest.DataSource;
            ExportParams = expDest.ExportParams;
        }
Пример #8
0
        /// <summary>
        /// Create a tree node corresponding to the export destination
        /// </summary>
        private TreeNode NewExpDestNode(Config.ExportDestination expDest)
        {
            var node = new TreeNode(expDest.DataSource.Name)
            {
                Tag = expDest
            };

            string imageKey;

            switch (expDest.DataSource.DBType)
            {
            case DBTypes.MSSQL:
                imageKey = "mssql.png";
                break;

            case DBTypes.Oracle:
                imageKey = "oracle.png";
                break;

            case DBTypes.PostgreSQL:
                imageKey = "postgresql.png";
                break;

            case DBTypes.MySQL:
                imageKey = "mysql.png";
                break;

            case DBTypes.OLEDB:
                imageKey = "oledb.png";
                break;

            default:
                imageKey = "";
                break;
            }

            node.ImageKey = node.SelectedImageKey = imageKey;
            return(node);
        }
Пример #9
0
        private void btnDelDataSource_Click(object sender, EventArgs e)
        {
            // удаление назначения экспорта
            if (selExpDestNode != null)
            {
                TreeNode prevNode = selExpDestNode.PrevNode;
                TreeNode nextNode = selExpDestNode.NextNode;

                int ind = selExpDestNode.Index;
                config.ExportDestinations.RemoveAt(ind);
                treeView.Nodes.RemoveAt(ind);

                treeView.SelectedNode = nextNode == null ? prevNode : nextNode;
                if (treeView.SelectedNode == null)
                {
                    selExpDest     = null;
                    selExpDestNode = null;
                }

                SetControlsEnabled();
                Modified = true;
            }
        }
Пример #10
0
        private void btnDelDataSource_Click(object sender, EventArgs e)
        {
            // delete export destination
            if (selExpDestNode != null)
            {
                var prevNode = selExpDestNode.PrevNode;
                var nextNode = selExpDestNode.NextNode;

                int ind = selExpDestNode.Index;
                config.ExportDestinations.RemoveAt(ind);
                treeView.Nodes.RemoveAt(ind);

                treeView.SelectedNode = nextNode ?? prevNode;
                if (treeView.SelectedNode == null)
                {
                    selExpDest     = null;
                    selExpDestNode = null;
                }

                SetControlsEnabled();
                Modified = true;
            }
        }
Пример #11
0
        /// <summary>
        /// Отобразить форму модально
        /// </summary>
        public static bool ShowDialog(ServerComm serverComm,
                                      List <Config.ExportDestination> expDests, Config.ExportDestination selExpDest,
                                      ref int curDataCtrlCnlNum, ref int arcDataCtrlCnlNum, ref int eventsCtrlCnlNum)
        {
            FrmManualExport frmManualExport = new FrmManualExport();

            frmManualExport.ServerComm = serverComm;

            // заполнение списка источников данных
            foreach (Config.ExportDestination expDest in expDests)
            {
                int ind = frmManualExport.cbDataSource.Items.Add(expDest.DataSource);
                if (expDest == selExpDest)
                {
                    frmManualExport.cbDataSource.SelectedIndex = ind;
                }
            }

            // установка каналов управления
            frmManualExport.CurDataCtrlCnlNum = curDataCtrlCnlNum;
            frmManualExport.ArcDataCtrlCnlNum = arcDataCtrlCnlNum;
            frmManualExport.EventsCtrlCnlNum  = eventsCtrlCnlNum;

            if (frmManualExport.ShowDialog() == DialogResult.OK)
            {
                // возврат каналов управления
                curDataCtrlCnlNum = frmManualExport.CurDataCtrlCnlNum;
                arcDataCtrlCnlNum = frmManualExport.ArcDataCtrlCnlNum;
                eventsCtrlCnlNum  = frmManualExport.EventsCtrlCnlNum;
                return(true);
            }
            else
            {
                return(false);
            }
        }