Exemplo n.º 1
0
        /// <summary>
        /// Called when [create new company for database].
        /// </summary>
        /// <param name="status">The status.</param>
        private void OnCreateNewCompanyForDatabase(SyncStatus status)
        {
            // Check Sql Settings
            ISqlServerSettings sqlSettings = this.Configurator.SqlSettings;

            if (string.IsNullOrEmpty(sqlSettings.Server))
            {
                // TODO: Show Warning
                EditSqlServerSettingsForm editSqlSettinnsForm = new EditSqlServerSettingsForm(this.Configurator);

                if (this.SnapIn.Console.ShowDialog(editSqlSettinnsForm) == DialogResult.OK)
                {
                    this.Configurator.ChangeSqlServerSettings(
                        editSqlSettinnsForm.SqlServerName,
                        editSqlSettinnsForm.UseWindowsAuth ? AuthenticationType.Windows : AuthenticationType.SqlServer,
                        editSqlSettinnsForm.SqlServerUser,
                        editSqlSettinnsForm.SqlServerPassword,
                        editSqlSettinnsForm.IbnUserName,
                        editSqlSettinnsForm.IbnUserPassword);
                }
                else
                {
                    return;
                }
            }

            CreateCompanyForDatabaseForm createCompanyForDatabaseForm = new CreateCompanyForDatabaseForm(this.Configurator);

            if (this.SnapIn.Console.ShowDialog(createCompanyForDatabaseForm) == DialogResult.OK)
            {
                status.ReportProgress(0, 0, string.Format(SnapInResources.CompanyScopeNode_Action_CreateForDatabase_Progress, createCompanyForDatabaseForm.textBoxHost.Text));

                string newCompanyId = string.Empty;

                //Thread.Sleep(10000);

                newCompanyId = this.Configurator.CreateCompanyForDatabase(
                    createCompanyForDatabaseForm.comboBoxSqlDatabase.Text,
                    DateTime.UtcNow,
                    createCompanyForDatabaseForm.checkBoxIsActive.Checked,
                    createCompanyForDatabaseForm.textBoxHost.Text,
                    createCompanyForDatabaseForm.IisIPAddress,
                    int.Parse(createCompanyForDatabaseForm.textBoxIisPort.Text),
                    createCompanyForDatabaseForm.IisPool,
                    true);

                // Refresh Company List
                Refresh();

                // TODO: Navigate browser to form.NewCompanyId Url
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called when [create new company for database].
        /// </summary>
        /// <param name="status">The status.</param>
        private void OnCreateNewCompanyForDatabase(SyncStatus status)
        {
            // Check Sql Settings
            ISqlServerSettings sqlSettings = this.Configurator.SqlSettings;

            if (string.IsNullOrEmpty(sqlSettings.Server))
            {
                // TODO: Show Warning
                EditSqlServerSettingsForm editSqlSettinnsForm = new EditSqlServerSettingsForm(this.Configurator);

                if (this.SnapIn.Console.ShowDialog(editSqlSettinnsForm) == DialogResult.OK)
                {
                    this.Configurator.ChangeSqlServerSettings(
                    editSqlSettinnsForm.SqlServerName,
                    editSqlSettinnsForm.UseWindowsAuth ? AuthenticationType.Windows : AuthenticationType.SqlServer,
                    editSqlSettinnsForm.SqlServerUser,
                    editSqlSettinnsForm.SqlServerPassword,
                    editSqlSettinnsForm.IbnUserName,
                    editSqlSettinnsForm.IbnUserPassword);
                }
                else
                    return;
            }

            CreateCompanyForDatabaseForm createCompanyForDatabaseForm = new CreateCompanyForDatabaseForm(this.Configurator);

            if (this.SnapIn.Console.ShowDialog(createCompanyForDatabaseForm) == DialogResult.OK)
            {
                status.ReportProgress(0, 0, string.Format(SnapInResources.CompanyScopeNode_Action_CreateForDatabase_Progress, createCompanyForDatabaseForm.textBoxHost.Text));

                string newCompanyId = string.Empty;

                //Thread.Sleep(10000);

                newCompanyId = this.Configurator.CreateCompanyForDatabase(
                    createCompanyForDatabaseForm.comboBoxSqlDatabase.Text,
                    DateTime.UtcNow,
                    createCompanyForDatabaseForm.checkBoxIsActive.Checked,
                    createCompanyForDatabaseForm.textBoxHost.Text,
                    createCompanyForDatabaseForm.IisIPAddress,
                    int.Parse(createCompanyForDatabaseForm.textBoxIisPort.Text),
                    createCompanyForDatabaseForm.IisPool,
                    true);

                // Refresh Company List
                Refresh();

                // TODO: Navigate browser to form.NewCompanyId Url
            }
        }