Exemplo n.º 1
0
        protected override void OnAction(MMCAction action, AsyncStatus status)
        {
            try
            {
                switch ((string)action.Tag)
                {
                case "Create":
                    AppWizardForm appWizForm = new AppWizardForm();
                    appWizForm.TopMost = true;
                    DialogResult ret = appWizForm.ShowDialog();
                    if (ret == DialogResult.OK)
                    {
                        this.RefreshApps();
                        this.OnListViewChanged();
                    }
                    break;

                case "Import":
                    this.Import();
                    this.RefreshApps();
                    this.OnListViewChanged();
                    break;
                }
            }
            catch (Exception ex)
            {
                MsgBoxUtil.Show(this.SnapIn, ex);
            }
        }
        private void PropertyPage_Save(object sender, ResultEventArgs <bool> e)
        {
            if (this.generalPropPage.IsValid() == false || this.accountsPropPage.IsValid() == false)
            {
                MsgBoxUtil.Show(this.generalPropPage.ParentSheet, "Some information is missing or incorrect. Please review and correct the information entered on each page.");
                e.Result = false;
            }
            else
            {
                if (this.generalPropPage.IsDirty() == true || this.accountsPropPage.IsDirty() == true)
                {
                    // load app info from SSO
                    this.appInfo = SSOManager.GetApplicationInfo(this.appInfo.Name);
                    // update it with new information from property pages
                    this.generalPropPage.Update(this.appInfo);
                    this.accountsPropPage.Update(this.appInfo);
                    // save changes into SSO
                    SSOManager.UpdateApplicationInfo(this.appInfo);

                    // notify subscribers the application has been saved
                    this.OnSaved(EventArgs.Empty);
                }
                e.Result = true;
            }
        }
Exemplo n.º 3
0
        protected override void OnDelete(SyncStatus status)
        {
            try
            {
                if (MsgBoxUtil.Confirm(this.SnapIn, Properties.Resources.DeleteFieldMessage) == true)
                {
                    // get SSO application fields
                    SSOAppFieldCollection appFields = SSOManager.GetApplicationFields(this.ScopeNode.DisplayName);

                    // delete selected ones
                    foreach (ResultNode resultNode in this.SelectedNodes)
                    {
                        appFields.Remove(resultNode.DisplayName);
                        this.ResultNodes.Remove(resultNode);
                    }

                    // save fields
                    SSOManager.UpdateApplicationFields(this.ScopeNode.DisplayName, appFields, true);
                    // refresh view
                    this.RefreshFields();
                }
            }
            catch (Exception ex)
            {
                MsgBoxUtil.Show(this.SnapIn, ex);
            }
        }
Exemplo n.º 4
0
        public void RefreshApps()
        {
            try
            {
                // load apps
                List <SSOAppInfo> applications = SSOManager.GetApplications();

                this.ResultNodes.Clear();
                foreach (SSOAppInfo app in applications)
                {
                    ResultNode resultNode = new ResultNode();
                    resultNode.DisplayName = app.Name;
                    resultNode.SubItemDisplayNames.AddRange(new string[5]
                    {
                        app.Status,
                        app.Description,
                        app.AdminAccounts,
                        app.UserAccounts,
                        app.Contact
                    });
                    this.ResultNodes.Add(resultNode);
                }
            }
            catch (Exception ex)
            {
                MsgBoxUtil.Show(this.SnapIn, ex);
            }
        }
Exemplo n.º 5
0
        protected override void OnSelectionAction(MMCAction action, AsyncStatus status)
        {
            try
            {
                switch ((string)action.Tag)
                {
                case "AddField":
                    this.currentPropertyPageTitle = "Add Field";
                    this.SelectionData.ShowPropertySheet("Add Field");
                    break;

                case "Export":
                    string appName = this.SelectedNodes[0].DisplayName;
                    this.Export(appName);
                    break;

                default:
                    this.ProcessMultipleApps((string)action.Tag);
                    base.OnSelectionAction(action, status);
                    this.OnListViewChanged();
                    break;
                }
            }
            catch (Exception ex)
            {
                MsgBoxUtil.Show(this.SnapIn, ex);
            }
        }
Exemplo n.º 6
0
        private void PropertyPage_Save(object sender, ResultEventArgs <bool> e)
        {
            if (this.IsValid() == false)
            {
                MsgBoxUtil.Show(this.ParentSheet, "Some information is missing or incorrect. Please review and correct the information entered on the page.");
                e.Result = false;
            }
            else
            {
                if (this.IsDirty() == true)
                {
                    // get the new field information entered on the page
                    this.Update(this.appField);

                    // get the SSO application fields
                    SSOAppFieldCollection appFields = SSOManager.GetApplicationFields(this.appName);

                    // flag to indicate whether the application must be recreated
                    bool recreate = false;

                    // check if the field is new or was renamed
                    if (string.IsNullOrEmpty(this.originalFieldName) == true ||
                        this.propertyControl.FieldName.Equals(this.originalFieldName, StringComparison.InvariantCultureIgnoreCase) == false)
                    {
                        // the field is new or was renamed, ensure the new field name does not exist
                        if (appFields.Contains(this.propertyControl.FieldName) == true)
                        {
                            MsgBoxUtil.Show(this.ParentSheet, string.Format("The field name {0} already exists.", this.propertyControl.FieldName));
                            e.Result = false;
                            return;
                        }

                        // need to recreate the application
                        recreate = true;

                        // remove the field before writing it using the new name (it will cause to add it)
                        if (appFields.Contains(this.propertyControl.FieldName) == true)
                        {
                            appFields.Remove(this.propertyControl.FieldName);
                        }
                    }

                    // write the field value (if the field was renamed, a new one will be added)
                    appFields.Write(this.propertyControl.FieldName, this.propertyControl.FieldValue);
                    // update the sso application
                    SSOManager.UpdateApplicationFields(this.appName, appFields, recreate);

                    // update the result node
                    ResultNode resultNode = (ResultNode)this.ParentSheet.SelectionObject;
                    this.OnSaved(new EventArgs <SSOAppField>(this.appField));
                }
                e.Result = true;
            }
        }
Exemplo n.º 7
0
 private void step_DataChanged(object sender, System.EventArgs e)
 {
     try
     {
         // update state of the navigation buttons
         this.UpdateButtonsState();
     }
     catch (Exception ex)
     {
         MsgBoxUtil.Show(this, ex);
     }
 }
Exemplo n.º 8
0
 private void btnBack_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (this.stepNumber > 0)
         {
             this.stepNumber--;
             this.ShowStep(this.stepNumber);
         }
     }
     catch (Exception ex)
     {
         MsgBoxUtil.Show(this, ex);
     }
 }
Exemplo n.º 9
0
 protected override void OnDelete(SyncStatus status)
 {
     try
     {
         if (MsgBoxUtil.Confirm(this.SnapIn, Properties.Resources.DeleteApplicationMessge) == true)
         {
             this.ProcessMultipleApps("Delete");
             this.OnListViewChanged();
         }
     }
     catch (Exception ex)
     {
         MsgBoxUtil.Show(this.SnapIn, ex);
     }
 }
Exemplo n.º 10
0
 protected override void OnSelectionAction(MMCAction action, AsyncStatus status)
 {
     try
     {
         switch ((string)action.Tag)
         {
         case "Properties":
             this.SelectionData.ShowPropertySheet("Field Properties");
             break;
         }
     }
     catch (Exception ex)
     {
         MsgBoxUtil.Show(this.SnapIn, ex);
     }
 }
Exemplo n.º 11
0
 private void btnNext_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (this.stepNumber < (this.steps.Length - 1) &&
             this.steps[this.stepNumber].IsValid() == true)
         {
             this.stepNumber++;
             this.ShowStep(this.stepNumber, this.stepNumber - 1);
         }
     }
     catch (Exception ex)
     {
         MsgBoxUtil.Show(this, ex);
     }
 }
 protected override void OnDelete(SyncStatus status)
 {
     GT.BizTalk.SSO.AdminMMC.UI.MsgBoxUtil.Show("Notification from AppScopeNode.OnDelete");
     try
     {
         if (MsgBoxUtil.Confirm(this.SnapIn, Properties.Resources.DeleteApplicationMessge) == true)
         {
             SSOManager.DeleteApplication(this.DisplayName);
             ((AppRootScopeNode)this.Parent).RefreshApps();
         }
         base.OnDelete(status);
     }
     catch (Exception ex)
     {
         MsgBoxUtil.Show(this.SnapIn, ex);
     }
 }
Exemplo n.º 13
0
 public void RefreshApps()
 {
     try
     {
         // load apps
         List <SSOAppInfo> applications = SSOManager.GetApplications();
         this.Children.Clear();
         foreach (SSOAppInfo appInfo in applications)
         {
             AppScopeNode appScopeNode = new AppScopeNode(appInfo.Name);
             this.Children.Add(appScopeNode);
         }
     }
     catch (Exception ex)
     {
         MsgBoxUtil.Show(this.SnapIn, ex);
     }
 }
Exemplo n.º 14
0
        private static void WaitCallbackProcessApps(object objData)
        {
            ProcessAppsData processAppsData = (ProcessAppsData)objData;

            try
            {
                foreach (Node node in processAppsData.SelectedNodes)
                {
                    if (AppListView.cancelProcessMultipleApps)
                    {
                        break;
                    }

                    string displayName = node.DisplayName;
                    switch (processAppsData.Action)
                    {
                    case "Enable":
                        SSOManager.EnableApplication(displayName, true);
                        break;

                    case "Disable":
                        SSOManager.EnableApplication(displayName, false);
                        break;

                    case "Delete":
                        SSOManager.DeleteApplication(displayName);
                        break;

                    case "PurgeCache":
                        SSOManager.PurgeApplicationCache(displayName);
                        break;
                    }
                    ++processAppsData.WaitDialog.WorkProcessed;
                }
            }
            catch (Exception ex)
            {
                MsgBoxUtil.Show(processAppsData.SnapIn, ex);
            }
            finally
            {
                processAppsData.WaitDialog.CompleteDialog();
            }
        }
Exemplo n.º 15
0
        protected override void OnAction(MMCAction action, AsyncStatus status)
        {
            try
            {
                switch ((string)action.Tag)
                {
                case "AddField":
                    this.ScopeNode.ShowPropertySheet("Add Field");
                    break;

                case "Export":
                    string appName = this.ScopeNode.DisplayName;
                    this.Export(appName);
                    break;
                }
            }
            catch (Exception ex)
            {
                MsgBoxUtil.Show(this.SnapIn, ex);
            }
        }
Exemplo n.º 16
0
        private void btnCreate_Click(object sender, System.EventArgs e)
        {
            try
            {
                // create a new instance of an application configuration
                SSOAppConfig appConfig = new SSOAppConfig();
                appConfig.AppInfo.Enabled = true;

                // update the application metadata information with the data entered by the user
                foreach (AppWizardStep step in this.steps)
                {
                    step.Update(appConfig.AppInfo);
                }

                // create the application
                SSOManager.CreateApplication(appConfig);
            }
            catch (Exception ex)
            {
                MsgBoxUtil.Show(this, ex);
            }
        }