Exemplo n.º 1
0
        public void OpenSqlEditorToolWindow(MenuCommandParameters menuInfo, string script, List <string> tables = null, List <SqlCeScripting.Column> columns = null)
        {
            try
            {
                var pkg = _parentWindow.Package as SqlCeToolboxPackage;
                Debug.Assert(pkg != null, "Package property of the Explorere Tool Window should never be null, have you tried to create it manually and not through FindToolWindow()?");

                var sqlEditorWindow = pkg.CreateWindow <SqlEditorWindow>();
                if (sqlEditorWindow == null)
                {
                    return;
                }
                var control = sqlEditorWindow.Content as SqlEditorControl;
                if (control != null)
                {
                    control.DatabaseInfo    = menuInfo.DatabaseInfo;
                    control.ExplorerControl = _parentWindow.Content as ExplorerControl;
                    control.SqlText         = script;
                }
            }
            catch (Exception ex)
            {
                Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType);
            }
        }
        private void OpenSubscriptionToolWindow(MenuCommandParameters menuInfo)
        {
            SubscriptionControl control = new SubscriptionControl();

            if (string.IsNullOrWhiteSpace(menuInfo.Name))
            {
                menuInfo.Name = "Add";
            }
            if (menuInfo.MenuItemType == MenuCommandParameters.MenuType.Manage)
            {
                control.Publication = menuInfo.Name;
                control.IsNew       = false;
                menuInfo.Caption    = menuInfo.Name;
            }
            else
            {
                control.IsNew    = true;
                menuInfo.Caption = "New Subscription";
            }
            control.Database = menuInfo.Connectionstring;
            FabTabItem tab = new FabTabItem();

            tab.Content = control;
            tab.Header  = menuInfo.Caption;
            _parent.FabTab.Items.Add(tab);
            _parent.FabTab.SelectedIndex = _parent.FabTab.Items.Count - 1;
            return;
        }
Exemplo n.º 3
0
        private void OpenSubscriptionToolWindow(MenuCommandParameters menuInfo)
        {
            var pkg = _parentWindow.Package as SqlCeToolboxPackage;

            Debug.Assert(pkg != null, "Package property of the Explorere Tool Window should never be null, have you tried to create it manually and not through FindToolWindow()?");

            try
            {
                if (string.IsNullOrWhiteSpace(menuInfo.Name))
                {
                    menuInfo.Name = "Add";
                }
                var subsWindow = pkg.CreateWindow <SubscriptionWindow>(Math.Abs(menuInfo.DatabaseInfo.ConnectionString.GetHashCode() - menuInfo.Name.GetHashCode()));
                var control    = subsWindow.Content as SubscriptionControl;
                control.DatabaseInfo = menuInfo.DatabaseInfo;
                if (menuInfo.MenuItemType == MenuType.Manage)
                {
                    control.Publication = menuInfo.Name;
                    control.IsNew       = false;
                    subsWindow.Caption  = menuInfo.Name;
                }
                else
                {
                    control.IsNew      = true;
                    subsWindow.Caption = "New Subscription";
                }
                Helpers.DataConnectionHelper.LogUsage("SubscriptionManage");
            }
            catch (Exception ex)
            {
                Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType);
            }
        }
        private void OpenSubscriptionToolWindow(MenuCommandParameters menuInfo)
        {
            SubscriptionControl control = new SubscriptionControl();

            if (string.IsNullOrWhiteSpace(menuInfo.Name))
            {
                menuInfo.Name = "Add";
            }
            if (menuInfo.MenuItemType == MenuCommandParameters.MenuType.Manage)
            {
                control.Publication = menuInfo.Name;
                control.IsNew = false;
                menuInfo.Caption = menuInfo.Name;
            }
            else
            {
                control.IsNew = true;
                menuInfo.Caption = "New Subscription";
            }
            control.Database = menuInfo.Connectionstring;
            FabTabItem tab = new FabTabItem();
            tab.Content = control;
            tab.Header = menuInfo.Caption;
            _parent.FabTab.Items.Add(tab);
            _parent.FabTab.SelectedIndex = _parent.FabTab.Items.Count - 1; 
            return;
        }
Exemplo n.º 5
0
        private static string BuildSqlClrScript(MenuCommandParameters menuInfo, string script)
        {
            var sqlClrScript = new StringBuilder(Resources.InstallSqlClr);

            sqlClrScript.AppendLine();

            sqlClrScript.AppendFormat(
                "EXEC dbo.GetSqlCeTable 'Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;OLE DB Services=-4;{0}', '{1}'",
                menuInfo.DatabaseInfo.ConnectionString,
                menuInfo.Name);
            sqlClrScript.AppendLine();
            sqlClrScript.AppendLine();
            sqlClrScript.Append("-- Sample 2: Load data into SQL Server table");
            sqlClrScript.AppendLine();
            sqlClrScript.Append(script);
            sqlClrScript.AppendLine();
            sqlClrScript.AppendFormat("INSERT INTO {0}", menuInfo.Name);
            sqlClrScript.AppendLine();
            sqlClrScript.AppendFormat(
                "EXEC dbo.GetSqlCeTable 'Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;OLE DB Services=-4;{0}', '{1}'",
                menuInfo.DatabaseInfo.ConnectionString,
                menuInfo.Name);
            sqlClrScript.AppendLine();
            sqlClrScript.Append("GO");
            return(sqlClrScript.ToString());
        }
Exemplo n.º 6
0
 internal void UpdateDescriptions(MenuCommandParameters menuInfo, string name)
 {
     try
     {
         using (var repository = DataConnectionHelper.CreateRepository(menuInfo.DatabaseInfo))
         {
             var tableDesc = ExplorerControl.DescriptionCache.Where(d => d.Object == name && d.Parent == null).Select(d => d.Description).SingleOrDefault();
             var ro        = new DescriptionDialog(tableDesc)
             {
                 ColumnsInfo = GetSiblingColumnInfo(repository, name)
             };
             ro.ShowModal();
             if (!ro.DialogResult.HasValue || ro.DialogResult.Value != true)
             {
                 return;
             }
             //save table description
             new Helpers.DescriptionHelper().SaveDescription(menuInfo.DatabaseInfo, ExplorerControl.DescriptionCache, ro.TableDescription, null, menuInfo.Name);
             //save all columns
             foreach (var item in ro.ColumnsInfo)
             {
                 new Helpers.DescriptionHelper().SaveDescription(menuInfo.DatabaseInfo, ExplorerControl.DescriptionCache, item.Description, name, item.Name);
             }
             ExplorerControl.DescriptionCache = new Helpers.DescriptionHelper().GetDescriptions(menuInfo.DatabaseInfo);
             ((ExplorerControl)ParentWindow.Content).RefreshTables(menuInfo.DatabaseInfo);
             DataConnectionHelper.LogUsage("TableUpdateDescriptions");
         }
     }
     catch (Exception ex)
     {
         DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType, false);
     }
 }
        private void OpenSubscriptionToolWindow(MenuCommandParameters menuInfo)
        {
            var pkg = _parentWindow.Package as SqlCeToolboxPackage;
            Debug.Assert(pkg != null, "Package property of the Explorere Tool Window should never be null, have you tried to create it manually and not through FindToolWindow()?");

            try
            {
                if (string.IsNullOrWhiteSpace(menuInfo.Name))
                {
                    menuInfo.Name = "Add";
                }
                var subsWindow = pkg.CreateWindow<SubscriptionWindow>(Math.Abs(menuInfo.DatabaseInfo.ConnectionString.GetHashCode() - menuInfo.Name.GetHashCode()));
                var control = subsWindow.Content as SubscriptionControl;
                control.DatabaseInfo = menuInfo.DatabaseInfo;
                if (menuInfo.MenuItemType == MenuType.Manage)
                {
                    control.Publication = menuInfo.Name;
                    control.IsNew = false;
                    subsWindow.Caption = menuInfo.Name;
                }
                else
                {
                    control.IsNew = true;
                    subsWindow.Caption = "New Subscription";
                }
                Helpers.DataConnectionHelper.LogUsage("SubscriptionManage");
            }
            catch (Exception ex)
            {
                Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType);
            }
        }
Exemplo n.º 8
0
        public ScopesContextMenu(MenuCommandParameters scopeMenuCommandParameters, ExplorerToolWindow parent)
        {
            var dcmd = new ScopesMenuCommandsHandler(parent);

            if (scopeMenuCommandParameters.MenuItemType == MenuType.Manage)

            {

                var dropScopeCommandBinding = new CommandBinding(ScopesMenuCommands.ScopeCommand,
                            dcmd.DropScope);

                var dropScopeMenuItem = new MenuItem
                {
                    Header = "Deprovision Scope...",
                    Icon = ImageHelper.GetImageFromResource("../resources/action_Cancel_16xLG.png"),
                    Command = ScopesMenuCommands.ScopeCommand,
                    CommandParameter = scopeMenuCommandParameters,
                };
                dropScopeMenuItem.CommandBindings.Add(dropScopeCommandBinding);
                Items.Add(dropScopeMenuItem);            
            }
            else
            {
            }
        }
Exemplo n.º 9
0
 public IndexContextMenu(MenuCommandParameters menuCommandParameters, ExplorerToolWindow parent)
 {
     var tcmd = new IndexMenuCommandsHandler(parent);
     CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsDropMenuItem(tcmd, menuCommandParameters);
     Items.Add(new Separator());
     CreateScriptAsStatisticsMenuItem(tcmd, menuCommandParameters);
 }
Exemplo n.º 10
0
 public ViewContextMenu(MenuCommandParameters menuCommandParameters, ExplorerToolWindow parent)
 {
     var tcmd = new ViewMenuCommandsHandler(parent);
     //TODO Why does the Report Viewer fail?
     //ReportDataMenuItem(tcmd, menuCommandParameters);
     //Items.Add(new Separator());
     CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsDropMenuItem(tcmd, menuCommandParameters);
 }
Exemplo n.º 11
0
 public ColumnContextMenu(MenuCommandParameters menuCommandParameters, ExplorerControl parent)
 {
     var tcmd = new ColumnMenuCommandsHandler(parent);
     CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsDropMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsAlterMenuItem(tcmd, menuCommandParameters);
     Items.Add(new Separator());
     CreateDescriptionMenuItem(tcmd, menuCommandParameters);
 }
 private void OpenSqlEditorToolWindow(MenuCommandParameters menuInfo, string script)
 {
     SqlEditorControl editor = new SqlEditorControl();
     editor.Database = menuInfo.Connectionstring;
     editor.SqlText = script;
     FabTabItem tab = new FabTabItem();
     tab.Content = editor;
     tab.Header = menuInfo.Caption;
     _parentWindow.FabTab.Items.Add(tab);
     _parentWindow.FabTab.SelectedIndex = _parentWindow.FabTab.Items.Count - 1; 
     return;
 }
Exemplo n.º 13
0
 private void CreateScriptAsAlterMenuItem(ColumnMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.ScriptAsAlter);
     var scriptMenuItem = new MenuItem
     {
         Header = "Script as ALTER",
         Icon = ImageHelper.GetImageFromResource("../resources/sp.png"),
         Command = TableMenuCommands.TableCommand,
         CommandParameter = menuCommandParameters
     };
     scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
     Items.Add(scriptMenuItem);
 }
Exemplo n.º 14
0
 private void ReportDataMenuItem(ViewMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.ReportTableData);
     var scriptMenuItem = new MenuItem
     {
         Header = "View Data as Report",
         Icon = ImageHelper.GetImageFromResource("../resources/Tables_8928.png"),
         Command = TableMenuCommands.TableCommand,
         CommandParameter = menuCommandParameters
     };
     scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
     Items.Add(scriptMenuItem);
 }
Exemplo n.º 15
0
 private void CreateScriptAsDropMenuItem(ViewMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var scriptCommandBinding = new CommandBinding(IndexMenuCommands.IndexCommand, tcmd.ScriptAsDrop);
     var scriptMenuItem = new MenuItem
     {
         Header = "Script as DROP",
         Icon = ImageHelper.GetImageFromResource("../resources/script_16xLG.png"),
         Command = IndexMenuCommands.IndexCommand,
         CommandParameter = menuCommandParameters
     };
     scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
     Items.Add(scriptMenuItem);
 }
         public SubscriptionsContextMenu(MenuCommandParameters subsMenuCommandParameters, ExplorerControl parent)
        {
            var dcmd = new SubscriptionsMenuCommandsHandler(parent);

            if (subsMenuCommandParameters.MenuItemType == MenuCommandParameters.MenuType.Manage)

            {
                var newSubsCommandBinding = new CommandBinding(SubscriptionsMenuCommands.SubscriptionCommand,
                                            dcmd.NewSubscription);

                var newSubsMenuItem = new MenuItem
                {
                    Header = "Manage Subscription...",
                    Icon = ImageHelper.GetImageFromResource("../resources/subs.png"),
                    Command = SubscriptionsMenuCommands.SubscriptionCommand,
                    CommandParameter = subsMenuCommandParameters,
                };
                newSubsMenuItem.CommandBindings.Add(newSubsCommandBinding);
                Items.Add(newSubsMenuItem);


                var dropSubsCommandBinding = new CommandBinding(SubscriptionsMenuCommands.SubscriptionCommand,
                            dcmd.DropSubscription);

                var dropSubsMenuItem = new MenuItem
                {
                    Header = "Drop Subscription...",
                    Icon = ImageHelper.GetImageFromResource("../resources/subs.png"),
                    Command = SubscriptionsMenuCommands.SubscriptionCommand,
                    CommandParameter = subsMenuCommandParameters,
                };
                dropSubsMenuItem.CommandBindings.Add(dropSubsCommandBinding);
                Items.Add(dropSubsMenuItem);            
            }
            else
            {
                var newSubsCommandBinding = new CommandBinding(SubscriptionsMenuCommands.SubscriptionCommand,
                                            dcmd.NewSubscription);

                var newSubsMenuItem = new MenuItem
                {
                    Header = "New Subscription...",
                    Icon = ImageHelper.GetImageFromResource("../resources/subs.png"),
                    Command = SubscriptionsMenuCommands.SubscriptionCommand,
                    CommandParameter = subsMenuCommandParameters,
                };
                newSubsMenuItem.CommandBindings.Add(newSubsCommandBinding);
                Items.Add(newSubsMenuItem);
            }
        }
Exemplo n.º 17
0
 private void CreateModifyColumnMenuItem(ColumnMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var modifyColumnCommandBinding = new CommandBinding(TableMenuCommands.TableCommand,
                                             tcmd.ModifyColumn);
     var modifyColumnMenuItem = new MenuItem
     {
         Header = "Edit column... (beta)",
         Icon = ImageHelper.GetImageFromResource("../resources/table_16xLG.png"),
         Command = TableMenuCommands.TableCommand,
         CommandParameter = menuCommandParameters
     };
     modifyColumnMenuItem.CommandBindings.Add(modifyColumnCommandBinding);
     Items.Add(modifyColumnMenuItem);
 }
Exemplo n.º 18
0
 private void CreateDescriptionMenuItem(ColumnMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var addDescriptionCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                             tcmd.AddDescription);
     var addDescriptionMenuItem = new MenuItem
     {
         Header = "Edit description",
         Icon = ImageHelper.GetImageFromResource("../resources/propes.png"),
         Command = DatabaseMenuCommands.DatabaseCommand,
         CommandParameter = menuCommandParameters
     };
     addDescriptionMenuItem.CommandBindings.Add(addDescriptionCommandBinding);
     Items.Add(addDescriptionMenuItem);
 }
Exemplo n.º 19
0
 private void CreateEditTableDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var editTableCommandBinding = new CommandBinding(TableMenuCommands.TableCommand,
                                             tcmd.EditTableData);
     var editTableMenuItem = new MenuItem
     {
         Header = string.Format("Edit Top {0} Rows", Properties.Settings.Default.MaxRowsToEdit),
         Icon = ImageHelper.GetImageFromResource("../resources/Editdatasetwithdesigner_8449.png"),
         Command = TableMenuCommands.TableCommand,
         CommandParameter = menuCommandParameters
     };
     editTableMenuItem.CommandBindings.Add(editTableCommandBinding);
     Items.Add(editTableMenuItem);
 }
Exemplo n.º 20
0
        public ColumnContextMenu(MenuCommandParameters menuCommandParameters, ExplorerToolWindow parent)
        {
            if (menuCommandParameters.DatabaseInfo.DatabaseType == DatabaseType.SQLite)
                return;

            var tcmd = new ColumnMenuCommandsHandler(parent);
            CreateModifyColumnMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDropMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsAlterMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            CreateDescriptionMenuItem(tcmd, menuCommandParameters);            
        }
        private void OpenSqlEditorToolWindow(MenuCommandParameters menuInfo, string script)
        {
            SqlEditorControl editor = new SqlEditorControl();

            editor.Database = menuInfo.Connectionstring;
            editor.SqlText  = script;
            FabTabItem tab = new FabTabItem();

            tab.Content = editor;
            tab.Header  = menuInfo.Caption;
            _parentWindow.FabTab.Items.Add(tab);
            _parentWindow.FabTab.SelectedIndex = _parentWindow.FabTab.Items.Count - 1;
            return;
        }
Exemplo n.º 22
0
        public void OpenSqlEditorToolWindow(MenuCommandParameters menuInfo, string script)
        {
            SqlEditorControl editor = new SqlEditorControl();

            editor.Database = menuInfo.Connectionstring;
            editor.SqlText  = script;
            FabTabItem tab = new FabTabItem();

            tab.Content = editor;
            string tabTitle = System.IO.Path.GetFileNameWithoutExtension(menuInfo.Caption) + "-" + menuInfo.Name;

            tab.Header = tabTitle;

            int i        = -1;
            int insertAt = -1;

            foreach (var item in _parent.FabTab.Items)
            {
                i++;
                if (item is FabTabItem)
                {
                    FabTabItem ftItem = (FabTabItem)item;
                    if (ftItem.Header.ToString().StartsWith(tabTitle))
                    {
                        insertAt = i;
                    }
                }
            }
            if (insertAt > -1)
            {
                _parent.FabTab.Items.Insert(insertAt + 1, tab);
                if (_parent.FabTab.Items.Count == 3)
                {
                    insertAt = insertAt + 1;
                }
                _parent.FabTab.SelectedIndex = insertAt + 1;
            }
            else
            {
                _parent.FabTab.Items.Add(tab);
                _parent.FabTab.SelectedIndex = _parent.FabTab.Items.Count - 1;
            }
            return;
        }
Exemplo n.º 23
0
        public TableContextMenu(MenuCommandParameters menuCommandParameters, ExplorerToolWindow parent)
        {
            var isSqlCe = menuCommandParameters.DatabaseInfo.DatabaseType == DatabaseType.SQLCE35
                || menuCommandParameters.DatabaseInfo.DatabaseType == DatabaseType.SQLCE40;

            var tcmd = new TableMenuCommandsHandler(parent);
            //Edit menu
            CreateEditTableDataMenuItem(tcmd, menuCommandParameters);
            ReportDataMenuItem(tcmd, menuCommandParameters);
            AddSqlEditorItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            if (isSqlCe)
            {
                AddColumnMenuItem(tcmd, menuCommandParameters);
                AddIndexMenuItem(tcmd, menuCommandParameters);
                AddFkMenuItem(tcmd, menuCommandParameters);
                Items.Add(new Separator());
            }
            CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDropMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDropAndCreateMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            CreateScriptAsSelectMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsInsertMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsUpdateMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDeleteMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDataMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            ImportDataMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            if (isSqlCe)
            {
                CompareDataMenuItem(tcmd, menuCommandParameters);
                Items.Add(new Separator());
            }
            RenameMenuItem(tcmd, menuCommandParameters);
            if (isSqlCe)
            {
                DescriptionMenuItem(tcmd, menuCommandParameters);
            }
        }
Exemplo n.º 24
0
        public void OpenSqlEditorToolWindow(MenuCommandParameters menuInfo, string script, List<string> tables = null, List<ErikEJ.SqlCeScripting.Column> columns = null)
        {
            try
            {
                var pkg = _parentWindow.Package as SqlCeToolboxPackage;
                Debug.Assert(pkg != null, "Package property of the Explorere Tool Window should never be null, have you tried to create it manually and not through FindToolWindow()?");

                var sqlEditorWindow = pkg.CreateWindow<SqlEditorWindow>();
                var control = sqlEditorWindow.Content as SqlEditorControl;
                control.DatabaseInfo = menuInfo.DatabaseInfo;
                control.ExplorerControl = _parentWindow.Content as ExplorerControl;
                //TODO For intellisense
                //control.TableNames = tables;
                //control.Columns = columns;
                control.SqlText = script;
            }
            catch (Exception ex)
            {
                Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType);
            }
        }
Exemplo n.º 25
0
 public TableContextMenu(MenuCommandParameters menuCommandParameters, ExplorerControl parent)
 {
     var tcmd = new TableMenuCommandsHandler(parent);
     CreateEditDataMenuItem(tcmd, menuCommandParameters);
     CreateViewReportMenuItem(tcmd, menuCommandParameters);
     Items.Add(new Separator());
     CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsDropMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsDropAndCreateMenuItem(tcmd, menuCommandParameters);
     Items.Add(new Separator());
     CreateScriptAsSelectMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsInsertMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsUpdateMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsDeleteMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsDataMenuItem(tcmd, menuCommandParameters);
     Items.Add(new Separator());
     ImportDataMenuItem(tcmd, menuCommandParameters);
     Items.Add(new Separator());
     DescriptionMenuItem(tcmd, menuCommandParameters);
     Items.Add(new Separator());
     RenameMenuItem(tcmd, menuCommandParameters);
 }
Exemplo n.º 26
0
 private void CreateScriptAsDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.ScriptAsData);
     var scriptMenuItem = new MenuItem
     {
         Header = "Script as Data (INSERTs)",
         Icon = ImageHelper.GetImageFromResource("../resources/script_16xLG.png"),
         Command = TableMenuCommands.TableCommand,
         CommandParameter = menuCommandParameters
     };
     scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
     Items.Add(scriptMenuItem);
 }
Exemplo n.º 27
0
 private void ImportDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.ImportData);
     var scriptMenuItem = new MenuItem
     {
         Header = "Import Data from CSV...",
         Icon = ImageHelper.GetImageFromResource("../resources/TypeDefinition_521.png"),
         Command = TableMenuCommands.TableCommand,
         CommandParameter = menuCommandParameters
     };
     scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
     Items.Add(scriptMenuItem);
 }
Exemplo n.º 28
0
 private void CompareDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.GenerateDataDiffScript);
     var scriptMenuItem = new MenuItem
     {
         Header = "Compare Data (beta)...",
         Icon = ImageHelper.GetImageFromResource("../resources/DataCompare_9880.png"),
         Command = TableMenuCommands.TableCommand,
         CommandParameter = menuCommandParameters
     };
     scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
     Items.Add(scriptMenuItem);
 }
Exemplo n.º 29
0
 private void RenameMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.Rename);
     var scriptMenuItem = new MenuItem
     {
         Header = "Rename...",
         Icon = ImageHelper.GetImageFromResource("../resources/Rename_6779.png"),
         Command = TableMenuCommands.TableCommand,
         CommandParameter = menuCommandParameters
     };
     scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
     Items.Add(scriptMenuItem);
 }
Exemplo n.º 30
0
        private void DescriptionMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            Items.Add(new Separator());

            var addDescriptionCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                                    tcmd.AddDescription);
            var addDescriptionMenuItem = new MenuItem
            {
                Header = "Edit descriptions...",
                Icon = ImageHelper.GetImageFromResource("../resources/properties_16xLG.png"),
                Command = DatabaseMenuCommands.DatabaseCommand,
                CommandParameter = menuCommandParameters
            };
            addDescriptionMenuItem.CommandBindings.Add(addDescriptionCommandBinding);
            Items.Add(addDescriptionMenuItem);
        }
Exemplo n.º 31
0
 private void AddIndexMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var addIndexCommandBinding = new CommandBinding(TableMenuCommands.TableCommand,
                                             tcmd.AddIndex);
     var addIndexMenuItem = new MenuItem
     {
         Header = "Add index... (beta)",
         Icon = ImageHelper.GetImageFromResource("../resources/table_16xLG.png"),
         Command = TableMenuCommands.TableCommand,
         CommandParameter = menuCommandParameters
     };
     addIndexMenuItem.CommandBindings.Add(addIndexCommandBinding);
     Items.Add(addIndexMenuItem);
 }
Exemplo n.º 32
0
 private void CreateViewReportMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var viewReportCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                             tcmd.SpawnReportViewerWindow);
     var reportMenuItem = new MenuItem
     {
         Header = "View Data as Report",
         Icon = ImageHelper.GetImageFromResource("../resources/sqlEditor.png"),
         Command = DatabaseMenuCommands.DatabaseCommand,
         CommandParameter = menuCommandParameters
     };
     reportMenuItem.CommandBindings.Add(viewReportCommandBinding);
     Items.Add(reportMenuItem);
 }
Exemplo n.º 33
0
 private void CreateEditDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var editTableCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                             tcmd.SpawnDataEditorWindow);
     var editTableMenuItem = new MenuItem
     {
         Header = string.Format("Edit Top {0} Rows", Properties.Settings.Default.MaxRowsToEdit),
         Icon = ImageHelper.GetImageFromResource("../resources/sqlEditor.png"),
         Command = DatabaseMenuCommands.DatabaseCommand,
         CommandParameter = menuCommandParameters
     };
     editTableMenuItem.CommandBindings.Add(editTableCommandBinding);
     Items.Add(editTableMenuItem);
 }
Exemplo n.º 34
0
 public TriggerContextMenu(MenuCommandParameters menuCommandParameters, ExplorerToolWindow parent)
 {
     var tcmd = new TriggerMenuCommandsHandler(parent);
     CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters);
     CreateScriptAsDropMenuItem(tcmd, menuCommandParameters);
 }
Exemplo n.º 35
0
 internal void UpdateDescriptions(MenuCommandParameters menuInfo, string name)
 {
     try
     {
         using (IRepository repository = Helpers.DataConnectionHelper.CreateRepository(menuInfo.DatabaseInfo))
         {
             var tableDesc = ExplorerControl.DescriptionCache.Where(d => d.Object == name && d.Parent == null).Select(d => d.Description).SingleOrDefault();
             DescriptionDialog ro = new DescriptionDialog(tableDesc);
             ro.ColumnsInfo = GetSiblingColumnInfo(repository, name);
             ro.ShowModal();
             if (ro.DialogResult.HasValue && ro.DialogResult.Value == true)
             {
                 //save table description
                 new Helpers.DescriptionHelper().SaveDescription(menuInfo.DatabaseInfo, ExplorerControl.DescriptionCache, ro.TableDescription, null, menuInfo.Name);
                 //save all columns
                 foreach (var item in ro.ColumnsInfo)
                 {
                     new Helpers.DescriptionHelper().SaveDescription(menuInfo.DatabaseInfo, ExplorerControl.DescriptionCache, item.Description, name, item.Name);
                 }
                 ExplorerControl.DescriptionCache = new Helpers.DescriptionHelper().GetDescriptions(menuInfo.DatabaseInfo);
                 ((ExplorerControl)ParentWindow.Content).RefreshTables(menuInfo.DatabaseInfo);
                 Helpers.DataConnectionHelper.LogUsage("TableUpdateDescriptions");
             }
         }
     }
     catch (Exception ex)
     {
         Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType, false);
     }
 }
Exemplo n.º 36
0
        public void OpenSqlEditorToolWindow(MenuCommandParameters menuInfo, string script)
        {
            SqlEditorControl editor = new SqlEditorControl();
            editor.Database = menuInfo.Connectionstring;
            editor.SqlText = script;
            FabTabItem tab = new FabTabItem();
            tab.Content = editor;
            string tabTitle = System.IO.Path.GetFileNameWithoutExtension(menuInfo.Caption) + "-" + menuInfo.Name;
            tab.Header = tabTitle;

            int i = -1;
            int insertAt = -1;
            foreach (var item in _parent.FabTab.Items)
            {
                i++;
                if (item is FabTabItem)
                {
                    FabTabItem ftItem = (FabTabItem)item;
                    if (ftItem.Header.ToString().StartsWith(tabTitle))
                    {
                        insertAt = i;
                    }
                }
            }
            if (insertAt > -1)
            {
                _parent.FabTab.Items.Insert(insertAt + 1, tab);
                if (_parent.FabTab.Items.Count == 3)
                    insertAt = insertAt + 1;
                _parent.FabTab.SelectedIndex = insertAt + 1;
            }
            else
            {
                _parent.FabTab.Items.Add(tab);
                _parent.FabTab.SelectedIndex = _parent.FabTab.Items.Count - 1;
            }
            return;
        }
Exemplo n.º 37
0
 private void AddSqlEditorItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
 {
     var showSqlEditorCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                                         tcmd.SpawnSqlEditorWindow);
     var showSqlEditorMenuItem = new MenuItem
     {
         Header = "New Query",
         Icon = ImageHelper.GetImageFromResource("../resources/NewQuery.png"),
         Command = DatabaseMenuCommands.DatabaseCommand,
         CommandParameter = menuCommandParameters
     };
     showSqlEditorMenuItem.CommandBindings.Add(showSqlEditorCommandBinding);
     Items.Add(showSqlEditorMenuItem);
 }