Exemple #1
0
 /// <summary>
 ///		Carga los nodos hijo
 /// </summary>
 protected override void LoadChildrenNodes(ExplorerProjectNodeViewModel node)
 {
     switch (node.Tag)
     {
     case DatabaseConnectionModel connection:
         LoadSchemaNodes(node, connection);
         break;
     }
 }
Exemple #2
0
        /// <summary>
        ///		Carga los nodos de conexión
        /// </summary>
        private void LoadConnectionNodes(ExplorerProjectNodeViewModel parent, ProjectModel project)
        {
            ExplorerProjectNodeViewModel root = AddNode(parent, "Conexiones", NodeType.ConnectionsRoot.ToString(), null);

            // Añade las conexiones
            foreach (AbstractConnectionModel connection in project.Connections)
            {
                AddNode(root, connection.Name, NodeType.Connection.ToString(), connection, true);
            }
        }
Exemple #3
0
        /// <summary>
        ///		Carga los nodos de esquema
        /// </summary>
        private void LoadSchemaNodes(ExplorerProjectNodeViewModel node, DatabaseConnectionModel connection)
        {
            try
            {
                SchemaDbModel schema = new Application.Providers.DataProvider().LoadSchema(connection);

                LoadSchemaNodes(node, "Tablas", schema.Tables, NodeType.TablesRoot, NodeType.Table);
                LoadSchemaNodes(node, "Vistas", schema.Views, NodeType.ViewsRoot, NodeType.Connection);
                AddNode(node, "Procedimientos", null, true, MvvmColor.Red, MainViewModel.Instance.ViewsController.GetIcon(NodeType.ProceduresRoot));
            }
            catch (Exception exception)
            {
                MainViewModel.Instance.ControllerWindow.ShowMessage($"Error al cargar el esquema {exception.Message}");
            }
        }
Exemple #4
0
        /// <summary>
        ///		Carga los nodos de distribución
        /// </summary>
        private void LoadDeploymentNodes(ExplorerProjectNodeViewModel parent, ProjectModel project)
        {
            ExplorerProjectNodeViewModel root = AddNode(parent, "Distribuciones", NodeType.DeploymentsRoot.ToString(), null);

            // Añade los nodos de distribución
            foreach (DeploymentModel deployment in project.Deployments)
            {
                ExplorerProjectNodeViewModel node = AddNode(root, deployment.Name, NodeType.Deployment.ToString(), deployment);

                // Añade las conexiones
                foreach (KeyValuePair <string, DatabaseConnectionModel> connectionKey in deployment.Connections)
                {
                    AddNode(node, connectionKey.Value.Name, NodeType.Connection.ToString(), connectionKey.Value, false);
                }
            }
        }
Exemple #5
0
        /// <summary>
        ///		Carga los nodos de esquema de un tipo
        /// </summary>
        private void LoadSchemaNodes(ExplorerProjectNodeViewModel node, string rootText, List <TableDbModel> tables, NodeType iconRoot, NodeType iconItem)
        {
            ExplorerProjectNodeViewModel root = AddNode(node, rootText, null, true, MvvmColor.Red,
                                                        MainViewModel.Instance.ViewsController.GetIcon(iconRoot));

            // Ordena las tablas
            tables.Sort((first, second) => first.Name.CompareTo(second.Name));
            // Añade la información de las tablas
            foreach (TableDbModel table in tables)
            {
                ExplorerProjectNodeViewModel nodeTable = AddNode(root, table.Name, null, true, MvvmColor.Navy,
                                                                 MainViewModel.Instance.ViewsController.GetIcon(iconItem));

                // Ordena los campos
                table.Fields.Sort((first, second) => first.Name.CompareTo(second.Name));
                // Añade los campos
                foreach (FieldDbModel field in table.Fields)
                {
                    AddNode(nodeTable, field.Name, null, false, MvvmColor.Black,
                            MainViewModel.Instance.ViewsController.GetIcon(NodeType.Field));
                }
            }
        }