コード例 #1
0
        /// <summary>
        /// Called when the <see cref="F:Microsoft.ManagementConsole.StandardVerbs.Delete"></see> standard verb is triggered.
        /// </summary>
        /// <param name="status">An object that holds the status information.</param>
        protected override void OnDelete(SyncStatus status)
        {
            string companyId  = this.CompanyInfo.Id;
            string domainName = this.DisplayName;

            DeleteCompanyForm form = new DeleteCompanyForm(GetCompanyConfigurator(), companyId, domainName);

            if (this.SnapIn.Console.ShowDialog(form) == DialogResult.OK)
            {
                status.ReportProgress(0, 0, string.Format(SnapInResources.CompanyScopeNode_Action_Delete_Progress, domainName));

                //Thread.Sleep(10000);
                GetCompanyConfigurator().DeleteCompany(companyId, form.DeleteDatabase);

                // Refresh ServerFormView
                ServerScopeNode serverScopeNode = ((ServerScopeNode)this.Parent.Parent);

                if (serverScopeNode.ServerFormView != null && serverScopeNode.ServerFormView.ServerFeaturesControl != null)
                {
                    serverScopeNode.ServerFormView.ServerFeaturesControl.LoadDataFromConfigurator();
                }

                // Remove Current Element From Tree
                this.Parent.Children.Remove(this);
            }
        }
コード例 #2
0
        /// <summary>
        /// Oms the start company.
        /// </summary>
        /// <param name="status">The status.</param>
        public void OmStartCompany(SyncStatus status)
        {
            status.ReportProgress(0, 0, string.Format(SnapInResources.CompanyScopeNode_Action_Start_Progress, this.DisplayName));

            //Thread.Sleep(10000);
            GetCompanyConfigurator().ActivateCompany(this.CompanyInfo.Id, true, true);

            this.IsActive = true;
            RefreshCompanyStatus();
        }
コード例 #3
0
ファイル: CompaniesScopeNode.cs プロジェクト: alex765022/IBN
        /// <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
            }
        }
コード例 #4
0
ファイル: ServerFormView.cs プロジェクト: alex765022/IBN
        private void OnDeleteAspAction(SyncStatus status)
        {
            DeleteAspForm form = new DeleteAspForm();

            if (this.SnapIn.Console.ShowDialog(form) == DialogResult.OK)
            {
                status.ReportProgress(0, 0, SnapInResources.ServerFormView_Action_AspDelete_Progress);

                this.GetConfigurator().DeleteAspSite(form.DeleteDatabase);
                //Thread.Sleep(10000);
            }
        }
コード例 #5
0
        private void OnChangePortalPool(SyncStatus status)
        {
            IConfigurator configurator = GetCompanyConfigurator();

            EditPortalPoolForm form = new EditPortalPoolForm(configurator, this.ApplicationPool);

            if (this.SnapIn.Console.ShowDialog(form) == DialogResult.OK)
            {
                status.ReportProgress(0, 0,
                                      string.Format(SnapInResources.CompanyScopeNode_Action_ChangePortalPool_Progress, this.CompanyInfo.Host));

                this.ApplicationPool        = configurator.ChangeCompanyApplicationPool(this.CompanyInfo.Id, form.PortalPool);
                this.SubItemDisplayNames[9] = this.ApplicationPool;

                RefreshCompanyStatus();
            }
        }
コード例 #6
0
ファイル: ServerFormView.cs プロジェクト: alex765022/IBN
        internal static void CreateAspSite(IConfigurator configurator, Microsoft.ManagementConsole.Advanced.Console console, SyncStatus status)
        {
            // Check Sql Settings
            ISqlServerSettings sqlSettings = configurator.SqlSettings;
            bool sqlSettingsOK             = !string.IsNullOrEmpty(sqlSettings.Server);

            if (!sqlSettingsOK)
            {
                // TODO: Show Warning
                EditSqlServerSettingsForm editSqlSettinnsForm = new EditSqlServerSettingsForm(configurator);

                if (console.ShowDialog(editSqlSettinnsForm) == DialogResult.OK)
                {
                    configurator.ChangeSqlServerSettings(
                        editSqlSettinnsForm.SqlServerName,
                        editSqlSettinnsForm.UseWindowsAuth ? AuthenticationType.Windows : AuthenticationType.SqlServer,
                        editSqlSettinnsForm.SqlServerUser,
                        editSqlSettinnsForm.SqlServerPassword,
                        editSqlSettinnsForm.IbnUserName,
                        editSqlSettinnsForm.IbnUserPassword);

                    sqlSettingsOK = true;
                }
            }

            if (sqlSettingsOK)
            {
                CreateAspForm createAspForm = new CreateAspForm(configurator);

                if (console.ShowDialog(createAspForm) == DialogResult.OK)
                {
                    if (status != null)
                    {
                        status.ReportProgress(0, 0, SnapInResources.ServerFormView_Action_AspCreate_Progress);
                    }

                    configurator.CreateAspSite(createAspForm.textBoxHost.Text
                                               , createAspForm.IisIPAddress
                                               , int.Parse(createAspForm.textBoxIisPort.Text)
                                               , createAspForm.IisPool
                                               );
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Called when [change domain].
        /// </summary>
        /// <param name="status">The status.</param>
        private void OnChangeDomain(SyncStatus status)
        {
            string companyId = this.CompanyInfo.Id;


            EditDefaultAddressForm form = new EditDefaultAddressForm(GetCompanyConfigurator(), companyId);

            if (this.SnapIn.Console.ShowDialog(form) == DialogResult.OK)
            {
                status.ReportProgress(0, 0, SnapInResources.CompanyScopeNode_Action_UpdateAddress_Progress);

                //Thread.Sleep(10000);
                GetCompanyConfigurator().ChangeCompanyAddress(companyId, form.NewSchema, form.NewHost, form.NewPort, true);

                // Refresh Element
                this.DisplayName = form.NewHost;

                this.SubItemDisplayNames[1] = form.NewSchema;
                this.SubItemDisplayNames[2] = form.NewHost;
                this.SubItemDisplayNames[3] = form.NewPort;
            }
        }
コード例 #8
0
ファイル: CompanyListView.cs プロジェクト: alex765022/IBN
        protected override void OnSyncSelectionAction(SyncAction action, SyncStatus status)
        {
            status.CanCancel = true;

            string newPortalPoolName = string.Empty;
            int    versionId         = 0;

            // Request Information
            if (action == this.ChangePortalPool)
            {
                EditPortalPoolForm form = new EditPortalPoolForm(GetConfigurator(), SnapInResources.CompanyScopeNode_Action_ChangePortalPool_Select);

                if (this.SnapIn.Console.ShowDialog(form) != DialogResult.OK ||
                    string.IsNullOrEmpty(form.PortalPool))
                {
                    return;
                }

                newPortalPoolName = form.PortalPool;
            }
            else if (action == this.UpgradeAction)
            {
                CompanyScopeNode[] upgradeCompanyItems = (CompanyScopeNode[])this.SelectionData.SelectionObject;

                UpdateCompanyListForm form = new UpdateCompanyListForm(GetConfigurator(), upgradeCompanyItems);

                if (DialogResult.Retry == this.SnapIn.Console.ShowDialog(form))
                {
                    Process currentProcess = Process.GetCurrentProcess();

                    // Start a new Process
                    ProcessStartInfo start = GetConfigurator().BuildUpdateCommandForCommonComponents(form.GetUpdateId(), currentProcess.Id);

                    // Run Update Common Components
                    Process.Start(start);

                    // Close current process
                    currentProcess.CloseMainWindow();
                }

                return;
            }

            // Read Selected nodes
            CompanyScopeNode[] companyItems = (CompanyScopeNode[])this.SelectionData.SelectionObject;

            int workProcessed = 0;
            int totalWork     = companyItems.Length;

            // ReportProgress 0, Len
            status.ReportProgress(workProcessed, totalWork, string.Empty);

            foreach (CompanyScopeNode company in companyItems)
            {
                string companyId   = (string)company.Tag;
                string companyName = company.DisplayName;

                if (action == this.StartAction)
                {
                    // ReportProgress Item, Len
                    status.ReportProgress(workProcessed, totalWork,
                                          string.Format(SnapInResources.CompanyScopeNode_Action_Start_Progress, companyName));

                    OnStartCompany(companyId);

                    company.IsActive = true;
                }
                else if (action == this.StopAction)
                {
                    // ReportProgress Item, Len
                    status.ReportProgress(workProcessed, totalWork,
                                          string.Format(SnapInResources.CompanyScopeNode_Action_Stop_Progress, companyName));

                    OnStopCompany(companyId);

                    company.IsActive = false;
                }
                else if (action == this.EnableSchedulerServiceAction)
                {
                    status.ReportProgress(workProcessed, totalWork,
                                          string.Format(SnapInResources.CompanyScopeNode_Action_EnableSchedulerService_Progress, companyName));

                    OnEnableSchedulerService(companyId);

                    company.IsEnableShedulerService = true;
                }
                else if (action == this.DisableSchedulerServiceAction)
                {
                    status.ReportProgress(workProcessed, totalWork,
                                          string.Format(SnapInResources.CompanyScopeNode_Action_DisableSchedulerService_Progress, companyName));

                    OnDisableSchedulerService(companyId);

                    company.IsEnableShedulerService = false;
                }
                else if (action == this.ChangePortalPool)
                {
                    status.ReportProgress(workProcessed, totalWork,
                                          string.Format(SnapInResources.CompanyScopeNode_Action_ChangePortalPool_Progress, companyName));

                    company.SubItemDisplayNames[9] = OnChangePortalPool(companyId, newPortalPoolName);
                }
                else if (action == this.UpgradeAction)
                {
                    status.ReportProgress(workProcessed, totalWork,
                                          string.Format(SnapInResources.CompanyScopeNode_Action_Upgrade_Progress, companyName));

                    OnUpgradeAction(companyId, versionId);
                }

                company.RefreshCompanyStatus();

                // Process Cancel
                if (status.IsCancelSignaled)
                {
                    break;
                }

                // Increase Progress
                workProcessed++;
            }

            // ReportProgress Len, Len
            status.ReportProgress(totalWork, totalWork, string.Empty);

            // Refresh Selection Button
            OnSelectionChanged(null);
        }