protected virtual void OkClicked(object sender, EventArgs e)
        {
            if (context.IsTemporary)
            {
                try {
                    //make it a real connection context and fill in the database
                    IConnectionPool pool = DbFactoryService.CreateConnectionPool(DatabaseConnection);
                    pool.Initialize();
                    ISchemaProvider provider = DbFactoryService.CreateSchemaProvider(DatabaseConnection,
                                                                                     pool);

                    DatabaseSchema db = provider.CreateDatabaseSchema(settingsWidget.ConnectionSettings.Database);
                    OnBeforeDatabaseCreation(db);
                    ((AbstractEditSchemaProvider)provider).CreateDatabase(db);

                    context.ConnectionSettings.Database = settingsWidget.ConnectionSettings.Database;
                    context.ConnectionSettings.Name     = settingsWidget.ConnectionSettings.Name;
                    context.IsTemporary = false;
                    MessageService.ShowMessage(AddinCatalog.GetString("Database has been created."));
                    ConnectionContextService.AddDatabaseConnectionContext(context);
                } catch (Exception ex) {
                    QueryService.RaiseException(ex);
                    Respond(ResponseType.Close);
                    return;
                }
            }
            Respond(ResponseType.Ok);
        }
        protected void OnAddConnection()
        {
            DatabaseConnectionSettingsDialog dlg = new DatabaseConnectionSettingsDialog();

            if (dlg.Run() == (int)ResponseType.Ok)
            {
                ConnectionContextService.AddDatabaseConnectionContext(dlg.ConnectionSettings);
            }
            dlg.Destroy();
        }
Пример #3
0
        protected virtual void OnOkClicked(object sender, System.EventArgs e)
        {
            if (!isEditMode)
            {
                ConnectionContextService.AddDatabaseConnectionContext(ConnectionSettings);
            }
            settings = settingsWidget.ConnectionSettings;

            Respond(ResponseType.Ok);
            Hide();
        }
Пример #4
0
        protected void OnEditConnection()
        {
            DatabaseConnectionContext  context = (DatabaseConnectionContext)CurrentNode.DataItem;
            DatabaseConnectionSettings newSettings;

            if (context.DbFactory.GuiProvider.ShowEditConnectionDialog(context.DbFactory,
                                                                       context.ConnectionSettings,
                                                                       out newSettings))
            {
                DatabaseConnectionContext newContext = new DatabaseConnectionContext(newSettings);
                ConnectionContextService.RemoveDatabaseConnectionContext(context);
                ConnectionContextService.AddDatabaseConnectionContext(newContext);
                newContext.Refresh();
            }
        }
        private void OnCreateDatabaseThreaded(object state)
        {
            DatabaseConnectionContext context = state as DatabaseConnectionContext;

            ISchemaProvider schemaProvider = context.SchemaProvider;
            DatabaseSchema  db             = new DatabaseSchema(schemaProvider);

            db.Name = context.ConnectionSettings.Database;

            schemaProvider.CreateDatabase(db);

            DispatchService.GuiDispatch(delegate() {
                WaitDialog.HideDialog();
                ConnectionContextService.AddDatabaseConnectionContext(context);
            });
        }
        protected virtual void OnButtonEditClicked(object sender, System.EventArgs e)
        {
            DatabaseConnectionSettings settings = null;
            DatabaseConnectionContext  ctx;

            if (comboConnection.DatabaseConnection != null)
            {
                ctx = comboConnection.DatabaseConnection;
                if (ctx.DbFactory.GuiProvider.ShowEditConnectionDialog(comboConnection.DatabaseConnection.DbFactory,
                                                                       comboConnection.DatabaseConnection.ConnectionSettings,
                                                                       out settings))
                {
                    DatabaseConnectionContext newContext = new DatabaseConnectionContext(settings);
                    ConnectionContextService.RemoveDatabaseConnectionContext(ctx);
                    ConnectionContextService.AddDatabaseConnectionContext(newContext);
                }
            }
        }