Example #1
0
        /// <summary>
        /// copy table
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btCopyTable_Click(object sender, RoutedEventArgs e)
        {
            //get the selected item
            if (lbTables.SelectedItem == null)
            {
                return;
            }
            ITableMetadata copy = lbTables.SelectedItem as ITableMetadata;

            //create the new item
            ITableMetadata table = new TableMetadata(Catalog.CatalogMetadata);

            BermudaConfigUtil.CopyTable(copy, table);

            //open the window
            TableConfig window = new TableConfig(table, "");
            var         ret    = window.ShowDialog();

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

            //add to list
            Tables.Add(table);
            Catalog.CatalogMetadata.Tables.Add(table.TableName, table);
        }
Example #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);
        }
Example #3
0
        /// <summary>
        /// copy a relationship
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btCopyRel_Click(object sender, RoutedEventArgs e)
        {
            //get the selected item
            if (lbRelations.SelectedItem == null)
            {
                return;
            }
            IRelationshipMetadata copy = lbRelations.SelectedItem as IRelationshipMetadata;

            //create the new item
            IRelationshipMetadata rel = new RelationshipMetadata(Catalog.CatalogMetadata);

            BermudaConfigUtil.CopyRelationship(copy, rel);

            //open the window
            RelationshipConfig window = new RelationshipConfig(rel, "");
            var ret = window.ShowDialog();

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

            //add to list
            Relationships.Add(rel);
            Catalog.CatalogMetadata.Relationships.Add(rel.RelationshipName, rel);
        }
Example #4
0
        /// <summary>
        /// constructor with table
        /// </summary>
        public TableConfig(ITableMetadata copy, string original)
        {
            //init properties
            SystemTypes     = BermudaConfigUtil.GetSystemTypes();
            Comparators     = BermudaConfigUtil.GetComparators();
            PurgeOperations = BermudaConfigUtil.GetPurgeOperations();
            BoolValues      = BermudaConfigUtil.GetBoolValues();

            //get the table
            Table         = copy;
            TableOriginal = original;

            //init the column collection
            _Columns = new ObservableCollection <IColumnMetadata>();
            Table.ColumnsMetadata.Values.ToList().ForEach(c => _Columns.Add(c));
            int position = 0;

            _Columns.OrderBy(c => c.OrdinalPosition).ToList().ForEach(c => c.OrdinalPosition = position++);
            Columns = new CollectionViewSource()
            {
                Source = _Columns
            };
            Columns.SortDescriptions.Add(new System.ComponentModel.SortDescription("OrdinalPosition", System.ComponentModel.ListSortDirection.Ascending));

            //init gui
            InitializeComponent();
        }
Example #5
0
        /// <summary>
        /// constructor with column data
        /// </summary>
        /// <param name="column"></param>
        public ColumnConfig(IColumnMetadata copy, string original)
        {
            //init properties
            SystemTypes = BermudaConfigUtil.GetSystemTypes();
            BoolValues  = BermudaConfigUtil.GetBoolValues();

            //init column
            Column         = copy;
            ColumnOriginal = original;

            //init gui
            InitializeComponent();
        }
Example #6
0
        /// <summary>
        /// constructor with relationship
        /// </summary>
        /// <param name="relationship"></param>
        public RelationshipConfig(IRelationshipMetadata copy, string original)
        {
            //init relationship
            Relationship         = copy;
            RelationshipOriginal = original;

            //init properties
            Tables = new ObservableCollection <string>();
            Relationship.CatalogMetadata.Tables.Values.ToList().ForEach(t => Tables.Add(t.TableName));
            BoolValues      = BermudaConfigUtil.GetBoolValues();
            ParentColumns   = new ObservableCollection <string>();
            ChildColumns    = new ObservableCollection <string>();
            RelationColumns = new ObservableCollection <string>();

            //init gui
            InitializeComponent();
        }
Example #7
0
        /// <summary>
        /// constructor with catalog
        /// </summary>
        /// <param name="catalog"></param>
        public CatalogConfig(ICatalog copy, string original)
        {
            //inti properties
            Tables        = new ObservableCollection <ITableMetadata>();
            Relationships = new ObservableCollection <IRelationshipMetadata>();

            //get the catalog
            Catalog         = copy;
            CatalogOriginal = original;

            //get the lists
            Catalog.CatalogMetadata.Tables.Values.ToList().ForEach(t => Tables.Add(t));
            Catalog.CatalogMetadata.Relationships.Values.ToList().ForEach(r => Relationships.Add(r));
            ConnectionTypes = BermudaConfigUtil.GetConnectionTypes();

            //inti gui
            InitializeComponent();
        }
Example #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();
        }
Example #9
0
        /// <summary>
        /// double click on relationship for edit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbRealtions_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var item = sender as ListBoxItem;

            if (item == null || !item.IsSelected)
            {
                return;
            }
            IRelationshipMetadata sel          = item.Content as IRelationshipMetadata;
            IRelationshipMetadata relationship = new RelationshipMetadata(Catalog.CatalogMetadata);

            BermudaConfigUtil.CopyRelationship(sel, relationship);
            RelationshipConfig window = new RelationshipConfig(relationship, relationship.RelationshipName);
            var ret = window.ShowDialog();

            if (!ret.HasValue || ret.Value == false)
            {
                return;
            }
            BermudaConfigUtil.CopyRelationship(relationship, sel);
            lbRelations.Items.Refresh();
        }
Example #10
0
        /// <summary>
        /// double click on table for edit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbTables_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var item = sender as ListBoxItem;

            if (item == null || !item.IsSelected)
            {
                return;
            }
            ITableMetadata sel   = item.Content as ITableMetadata;
            ITableMetadata table = new TableMetadata(Catalog.CatalogMetadata);

            BermudaConfigUtil.CopyTable(sel, table);
            TableConfig window = new TableConfig(table, table.TableName);
            var         ret    = window.ShowDialog();

            if (!ret.HasValue || ret.Value == false)
            {
                return;
            }
            BermudaConfigUtil.CopyTable(table, sel);
            lbTables.Items.Refresh();
        }
Example #11
0
        /// <summary>
        /// handle double click on column for edit
        /// </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;
            }
            IColumnMetadata sel    = item.Content as IColumnMetadata;
            IColumnMetadata column = new ColumnMetadata(Table);

            BermudaConfigUtil.CopyColumn(sel, column);
            ColumnConfig window = new ColumnConfig(column, column.ColumnName);
            var          ret    = window.ShowDialog();

            if (!ret.HasValue || ret.Value == false)
            {
                return;
            }
            BermudaConfigUtil.CopyColumn(column, sel);
            lbColumns.Items.Refresh();
        }
Example #12
0
        /// <summary>
        /// copy a column
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btCopy_Click(object sender, RoutedEventArgs e)
        {
            //get the column position
            int position = 0;

            if (_Columns.Count > 0)
            {
                position = _Columns.Max(c => c.OrdinalPosition) + 1;
            }

            //get the selected item
            if (lbColumns.SelectedItem == null)
            {
                return;
            }
            IColumnMetadata copy = lbColumns.SelectedItem as IColumnMetadata;

            //copy fields
            var col = new ColumnMetadata(Table);

            BermudaConfigUtil.CopyColumn(copy, col);
            col.OrdinalPosition = position;

            //open the window
            ColumnConfig window = new ColumnConfig(col, "");
            var          ret    = window.ShowDialog();

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

            //add to list
            _Columns.Add(col);
            Table.ColumnsMetadata.Add(col.ColumnName, col);
        }