Example #1
0
        /// <summary>
        /// Called when [create new company].
        /// </summary>
        /// <param name="status">The status.</param>
        private void OnCreateNewCompany(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;
                }
            }

            CreateCompanyForm createCompanyForm = new CreateCompanyForm(this.Configurator);

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

                string newCompanyId = string.Empty;

                //Thread.Sleep(10000);

                newCompanyId = this.Configurator.CreateCompany(createCompanyForm.textBoxCompanyName.Text,
                                                               createCompanyForm.textBoxHost.Text,
                                                               ((ILanguageInfo)createCompanyForm.comboBoxDefaultLanguage.SelectedItem).Locale,
                                                               createCompanyForm.checkBoxIsActive.Checked,
                                                               createCompanyForm.IisIPAddress,
                                                               int.Parse(createCompanyForm.textBoxIisPort.Text),
                                                               createCompanyForm.IisPool,
                                                               createCompanyForm.textBoxAdminAccountName.Text,
                                                               createCompanyForm.textBoxAdminPassword.Text,
                                                               createCompanyForm.textBoxAdminFirstName.Text,
                                                               createCompanyForm.textBoxAdminLastName.Text,
                                                               createCompanyForm.textBoxAdminEmail.Text);

                // Refresh Company List
                Refresh();

                // TODO: Navigate browser to form.NewCompanyId Url
            }
        }
Example #2
0
        /// <summary>
        /// Called when [create new company].
        /// </summary>
        /// <param name="status">The status.</param>
        private void OnCreateNewCompany(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;
            }

            CreateCompanyForm createCompanyForm = new CreateCompanyForm(this.Configurator);

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

                string newCompanyId = string.Empty;

                //Thread.Sleep(10000);

                newCompanyId = this.Configurator.CreateCompany(createCompanyForm.textBoxCompanyName.Text,
                        createCompanyForm.textBoxHost.Text,
                        ((ILanguageInfo)createCompanyForm.comboBoxDefaultLanguage.SelectedItem).Locale,
                        createCompanyForm.checkBoxIsActive.Checked,
                        createCompanyForm.IisIPAddress,
                        int.Parse(createCompanyForm.textBoxIisPort.Text),
                        createCompanyForm.IisPool,
                        createCompanyForm.textBoxAdminAccountName.Text,
                        createCompanyForm.textBoxAdminPassword.Text,
                        createCompanyForm.textBoxAdminFirstName.Text,
                        createCompanyForm.textBoxAdminLastName.Text,
                        createCompanyForm.textBoxAdminEmail.Text);

                // Refresh Company List
                Refresh();

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