Ejemplo n.º 1
0
        public ColumnMetadataResult[] GetMetadataColumns()
        {
            //compute node is not initialized
            if (ComputeNode.Node == null)
            {
                return(new List <ColumnMetadataResult>().ToArray());
            }

            List <ColumnMetadataResult> results = new List <ColumnMetadataResult>();

            ComputeNode.Node.Catalogs.Values.ToList().ForEach(c =>
            {
                Catalog.Catalog catalog = c as Catalog.Catalog;
                catalog.CatalogMetadata.Tables.Values.ToList().ForEach(t =>
                {
                    int OrdinalPosition = 1;
                    t.ColumnsMetadata.Values.ToList().ForEach(col =>
                    {
                        results.Add(new ColumnMetadataResult()
                        {
                            Catalog         = c.Name,
                            Table           = t.TableName,
                            Column          = col.FieldMapping,
                            DataType        = col.ColumnType.ToString(),
                            ColumnLength    = col.ColumnLength,
                            Nullable        = col.Nullable,
                            Visible         = col.Visible,
                            OrdinalPosition = OrdinalPosition++
                        });
                    });
                });
            });

            return(results.ToArray());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// make a copy of catalog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btCopy_Click(object sender, RoutedEventArgs e)
        {
            //get the selected item
            if (lbCatalogs.SelectedItem == null)
            {
                return;
            }
            ICatalog copy = lbCatalogs.SelectedItem as ICatalog;

            //copy fields
            var cat = new Catalog.Catalog(ComputeNode);

            BermudaConfigUtil.CopyCatalog(copy, cat);

            //open the window
            CatalogConfig window = new CatalogConfig(cat, "");
            var           ret    = window.ShowDialog();

            if (!ret.HasValue || ret == false)
            {
                return;
            }

            //add to list
            Catalogs.Add(cat);
            ComputeNode.Catalogs.Add(cat.CatalogName, cat);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// return the table definitions
        /// </summary>
        /// <returns></returns>
        public TableMetadataResult[] GetMetadataTables()
        {
            //compute node is not initialized
            if (ComputeNode.Node == null)
            {
                return(new List <TableMetadataResult>().ToArray());
            }

            List <TableMetadataResult> results = new List <TableMetadataResult>();

            ComputeNode.Node.Catalogs.Values.ToList().ForEach(c =>
            {
                Catalog.Catalog catalog = c as Catalog.Catalog;
                catalog.CatalogMetadata.Tables.Values.ToList().ForEach(t =>
                {
                    results.Add(new TableMetadataResult()
                    {
                        Catalog = catalog.Name,
                        Table   = t.TableName
                    });
                });
            });

            return(results.ToArray());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// create a new catalog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btNew_Click(object sender, RoutedEventArgs e)
        {
            //new item
            var cat = new Catalog.Catalog(ComputeNode);

            cat.CatalogMetadata = new CatalogMetadata(cat);

            //open the window
            CatalogConfig window = new CatalogConfig(cat, "");
            var           ret    = window.ShowDialog();

            if (!ret.HasValue || ret == false)
            {
                return;
            }

            //add to list
            Catalogs.Add(cat);
            ComputeNode.Catalogs.Add(cat.CatalogName, cat);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// handle the double click in the list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var item = sender as ListBoxItem;

            if (item == null || !item.IsSelected)
            {
                return;
            }
            ICatalog sel     = item.Content as ICatalog;
            ICatalog catalog = new Catalog.Catalog(ComputeNode);

            BermudaConfigUtil.CopyCatalog(sel, catalog);
            CatalogConfig window = new CatalogConfig(catalog, catalog.CatalogName);
            var           ret    = window.ShowDialog();

            if (!ret.HasValue || ret == false)
            {
                return;
            }
            BermudaConfigUtil.CopyCatalog(catalog, sel);
            lbCatalogs.Items.Refresh();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// create a new catalog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btNew_Click(object sender, RoutedEventArgs e)
        {
            //new item
            var cat = new Catalog.Catalog(ComputeNode);
            cat.CatalogMetadata = new CatalogMetadata(cat);

            //open the window
            CatalogConfig window = new CatalogConfig(cat, "");
            var ret = window.ShowDialog();
            if (!ret.HasValue || ret == false)
                return;

            //add to list
            Catalogs.Add(cat);
            ComputeNode.Catalogs.Add(cat.CatalogName, cat);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// make a copy of catalog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btCopy_Click(object sender, RoutedEventArgs e)
        {
            //get the selected item
            if (lbCatalogs.SelectedItem == null) return;
            ICatalog copy = lbCatalogs.SelectedItem as ICatalog;

            //copy fields
            var cat = new Catalog.Catalog(ComputeNode);
            BermudaConfigUtil.CopyCatalog(copy, cat);

            //open the window
            CatalogConfig window = new CatalogConfig(cat, "");
            var ret = window.ShowDialog();
            if (!ret.HasValue || ret == false)
                return;

            //add to list
            Catalogs.Add(cat);
            ComputeNode.Catalogs.Add(cat.CatalogName, cat);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// handle the double click in the list
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     var item = sender as ListBoxItem;
     if (item == null || !item.IsSelected) return;
     ICatalog sel = item.Content as ICatalog;
     ICatalog catalog = new Catalog.Catalog(ComputeNode);
     BermudaConfigUtil.CopyCatalog(sel, catalog);
     CatalogConfig window = new CatalogConfig(catalog, catalog.CatalogName);
     var ret = window.ShowDialog();
     if (!ret.HasValue || ret == false)
         return;
     BermudaConfigUtil.CopyCatalog(catalog, sel);
     lbCatalogs.Items.Refresh();
 }