コード例 #1
0
ファイル: CompaniesScopeNode.cs プロジェクト: alex765022/IBN
        /// <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
            }
        }
コード例 #2
0
ファイル: CompaniesScopeNode.cs プロジェクト: 0anion0/IBN
        /// <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
            }
        }