Ejemplo n.º 1
0
        public void ViewToData()
        {
            NodeTables nodeTables = GetNode <NodeTables>();
            var        tables     = file.Parameters.Tables.ToDictionary(p => p.FullName);

            if (nodeTables != null)
            {
                foreach (NodeTable node in nodeTables.Nodes)
                {
                    GenTable table;
                    if (tables.TryGetValue(node.Item.FullName, out table))
                    {
                        table.IsSelected = node.Checked;
                    }
                    else
                    {
                        table.IsSelected = false;
                    }
                }
            }

            NodeViews nodeViews = GetNode <NodeViews>();
            var       views     = file.Parameters.Views.ToDictionary(p => p.FullName);

            if (nodeViews != null)
            {
                foreach (NodeView node in nodeViews.Nodes)
                {
                    GenTable view;
                    if (views.TryGetValue(node.Item.FullName, out view))
                    {
                        view.IsSelected = node.Checked;
                    }
                    else
                    {
                        view.IsSelected = false;
                    }
                }
            }

            NodeProcedure nodeProcs = GetNode <NodeProcedure>();
            var           procs     = file.Parameters.Procedures.ToDictionary(p => p.FullName);

            if (nodeProcs != null)
            {
                foreach (NodeProcedure node in nodeProcs.Nodes)
                {
                    GenProcedure proc;
                    if (procs.TryGetValue(node.Item.FullName, out proc))
                    {
                        node.Checked = proc.IsSelected;
                    }
                    else
                    {
                        node.Checked = false;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void viewToData(SourceGrid.Grid grid)
        {
            // TODO: pra terminar o edit. Não achei que método do grid faz isso
            trv.Focus();
            grdTables.Focus();

            file.Parameters.DataClass     = ctlDataPars.Parameters;
            file.Parameters.BusinessClass = ctlBusPars.Parameters;

            foreach (SourceGrid.GridRow row in grid.Rows)
            {
                var node = row.Tag as NodeTable;
                if (node != null)
                {
                    GenTable tb = node.Item;
                    if (tb.TableName == "ContactType")
                    {
                        ToString();
                    }
                    int r = row.Index;
                    tb.SchemaName        = parseString(grid, r, Col.SchemaName);
                    tb.TableName         = parseString(grid, r, Col.TableName);
                    tb.DataClassName     = parseString(grid, r, Col.DataClassName);
                    tb.BusinessClassName = parseString(grid, r, Col.BusinessClassName);
                    tb.EnumColumnName    = parseString(grid, r, Col.EnumColumnName);
                    tb.EnumColumnId      = parseString(grid, r, Col.EnumColumnId);
                    tb.EnumName          = parseString(grid, r, Col.EnumName);
                    tb.EnumAttributes    = parseString(grid, r, Col.EnumAttributes);
                    tb.SequenceColumn    = parseString(grid, r, Col.SequenceColumn);
                    tb.SequenceName      = parseString(grid, r, Col.SequenceName);
                    tb.Attributes        = parseString(grid, r, Col.Attributes);
                    //tb.SubDirectory = parseString(grid, r, 5);
                }
            }

            if (nodeDb == null)
            {
                return;
            }

            NodeTables nodeTables = GetNode <NodeTables>();
            var        tables     = file.Parameters.Tables.ToDictionary(p => p.FullName);

            if (nodeTables != null)
            {
                foreach (NodeTable node in nodeTables.Nodes)
                {
                    GenTable table;
                    if (tables.TryGetValue(node.Item.FullName, out table))
                    {
                        table.IsSelected        = node.Checked;
                        table.BusinessClassName = node.Item.BusinessClassName;
                        table.DataClassName     = node.Item.DataClassName;
                        table.EnumColumnName    = node.Item.EnumColumnName;
                        table.EnumColumnId      = node.Item.EnumColumnId;
                        table.EnumName          = node.Item.EnumName;
                        table.EnumAttributes    = node.Item.EnumAttributes;
                        table.SequenceColumn    = node.Item.SequenceColumn;
                        table.SequenceName      = node.Item.SequenceName;
                        table.SchemaName        = node.Item.SchemaName;
                        table.SubDirectory      = node.Item.SubDirectory;
                        table.Columns           = node.Item.Columns;
                        table.Attributes        = node.Item.Attributes;
                    }
                    else
                    {
                        node.Checked = false;
                    }
                }
            }

            NodeViews nodeViews = GetNode <NodeViews>();
            var       views     = file.Parameters.Views.ToDictionary(p => p.FullName);

            if (nodeViews != null)
            {
                foreach (NodeView node in nodeViews.Nodes)
                {
                    GenTable view;
                    if (views.TryGetValue(node.Item.FullName, out view))
                    {
                        view.IsSelected        = node.Checked;
                        view.BusinessClassName = node.Item.BusinessClassName;
                        view.DataClassName     = node.Item.DataClassName;
                        view.EnumColumnName    = node.Item.EnumColumnName;
                        view.EnumColumnId      = node.Item.EnumColumnId;
                        view.EnumName          = node.Item.EnumName;
                        view.EnumAttributes    = node.Item.EnumAttributes;
                        view.SequenceColumn    = node.Item.SequenceColumn;
                        view.SequenceName      = node.Item.SequenceName;
                        view.SchemaName        = node.Item.SchemaName;
                        view.SubDirectory      = node.Item.SubDirectory;
                        view.Columns           = node.Item.Columns;
                        view.Attributes        = node.Item.Attributes;
                    }
                    else
                    {
                        view.IsSelected = false;
                    }
                }
            }

            /*
             * NodeProcedure nodeProcs = GetNode<NodeProcedure>();
             * var procs = file.Parameters.Procedures.ToDictionary(p => p.FullName);
             * if (nodeProcs != null)
             * {
             *  foreach (NodeProcedure node in nodeProcs.Nodes)
             *  {
             *      GenProcedure proc;
             *      if (procs.TryGetValue(node.Item.FullName, out proc))
             *          node.Checked = proc.IsSelected;
             *      else
             *          node.Checked = false;
             *  }
             * }
             */
            ctlDataPars.ViewToData();
            ctlBusPars.ViewToData();
        }
Ejemplo n.º 3
0
        public void DataToView()
        {
            isLoading = true;
            if (nodeDb == null)
            {
                return;
            }

            if (file == null)
            {
                return;
            }

            ctlDataPars.Parameters = file.Parameters.DataClass;
            ctlBusPars.Parameters  = file.Parameters.BusinessClass;

            var dicTables = file.Parameters.Tables.ToDictionary(p => p.FullName);

            NodeTables nodeTables = GetNode <NodeTables>();
            // indexa pra performance
            var tables = file.Parameters.Tables.ToDictionary(p => p.FullName);

            foreach (NodeTable node in nodeTables.Nodes)
            {
                GenTable table;
                if (tables.TryGetValue(node.Item.FullName, out table))
                {
                    node.Checked = table.IsSelected;
                    node.Item.BusinessClassName = table.BusinessClassName;
                    node.Item.DataClassName     = table.DataClassName;
                    node.Item.EnumColumnName    = table.EnumColumnName;
                    node.Item.EnumColumnId      = table.EnumColumnId;
                    node.Item.EnumName          = table.EnumName;
                    node.Item.EnumAttributes    = table.EnumAttributes;
                    node.Item.SequenceColumn    = table.SequenceColumn;
                    node.Item.SequenceName      = table.SequenceName;
                    node.Item.SchemaName        = table.SchemaName;
                    node.Item.SubDirectory      = table.SubDirectory;
                    node.Item.Columns           = table.Columns;
                    node.Item.Attributes        = table.Attributes;

                    dicTables.Remove(table.FullName);
                }
                else
                {
                    node.Checked = false;
                    file.Parameters.Tables.Add(node.Item);
                }
            }

            NodeViews nodeViews = GetNode <NodeViews>();
            // indexa pra performance
            var views = file.Parameters.Views.ToDictionary(p => p.FullName);

            foreach (NodeView node in nodeViews.Nodes)
            {
                GenTable view;
                if (views.TryGetValue(node.Item.FullName, out view))
                {
                    node.Checked = view.IsSelected;
                    node.Item.BusinessClassName = view.BusinessClassName;
                    node.Item.DataClassName     = view.DataClassName;
                    node.Item.EnumColumnName    = view.EnumColumnName;
                    node.Item.EnumColumnId      = view.EnumColumnId;
                    node.Item.EnumName          = view.EnumName;
                    node.Item.EnumAttributes    = view.EnumAttributes;
                    node.Item.SequenceColumn    = view.SequenceColumn;
                    node.Item.SequenceName      = view.SequenceName;
                    node.Item.SchemaName        = view.SchemaName;
                    node.Item.SubDirectory      = view.SubDirectory;
                    node.Item.Columns           = view.Columns;
                    node.Item.Attributes        = view.Attributes;
                }
                else
                {
                    node.Checked = false;
                    file.Parameters.Views.Add(node.Item);
                }
            }

            /*
             * NodeProcedures nodeProcs = GetNode<NodeProcedures>();
             * if (nodeProcs != null)
             * {
             *  // indexa pra performance
             *  var procs = file.Parameters.Procedures.ToDictionary(p => p.FullName);
             *  foreach (NodeProcedure node in nodeProcs.Nodes)
             *  {
             *      GenProcedure proc;
             *      if (procs.TryGetValue(node.Item.FullName, out proc))
             *          node.Checked = proc.IsSelected;
             *      else
             *      {
             *          node.Checked = false;
             *          file.Parameters.Procedures.Add(node.Item.ToGenProcedure());
             *      }
             *  }
             * }
             */

            chkRaisePropertyChanged.Checked = file.Parameters.RaisePropertyChanged;
            UpdateGrid();
            isLoading = false;
        }
Ejemplo n.º 4
0
        public void DataToView()
        {
            if (nodeDb == null)
            {
                return;
            }

            NodeTables nodeTables = GetNode <NodeTables>();
            // indexa pra performance
            var tables = file.Parameters.Tables.ToDictionary(p => p.FullName);

            foreach (NodeTable node in nodeTables.Nodes)
            {
                GenTable table;
                if (tables.TryGetValue(node.Item.FullName, out table))
                {
                    node.Checked = table.IsSelected;
                }
                else
                {
                    node.Checked = false;
                    file.Parameters.Tables.Add(node.Item);
                }
            }

            NodeViews nodeViews = GetNode <NodeViews>();
            // indexa pra performance
            var views = file.Parameters.Views.ToDictionary(p => p.FullName);

            foreach (NodeView node in nodeViews.Nodes)
            {
                GenTable view;
                if (views.TryGetValue(node.Item.FullName, out view))
                {
                    node.Checked = view.IsSelected;
                }
                else
                {
                    node.Checked = false;
                    file.Parameters.Views.Add(node.Item);
                }
            }

            NodeProcedures nodeProcs = GetNode <NodeProcedures>();

            if (nodeProcs != null)
            {
                // indexa pra performance
                var procs = file.Parameters.Procedures.ToDictionary(p => p.FullName);
                foreach (NodeProcedure node in nodeProcs.Nodes)
                {
                    GenProcedure proc;
                    if (procs.TryGetValue(node.Item.FullName, out proc))
                    {
                        node.Checked = proc.IsSelected;
                    }
                    else
                    {
                        node.Checked = false;
                        file.Parameters.Procedures.Add(node.Item.ToGenProcedure());
                    }
                }
            }
        }