Exemplo n.º 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (SelectedDialog != null)
            {
                try
                {
                    // Find all actions connected to this Dialog/CustomDialog/ServiceMethod
                    IList <UXAction> FoundActions = actionService.GetUXActionForMappableObject(SelectedDialog);

                    // If any actions is found for this object then show another dialog where you can select
                    // to reuse the actions or create new ones.
                    if (FoundActions != null && FoundActions.Count > 0)
                    {
                        using (SelectCreateUXAction selectCreateAction = new SelectCreateUXAction())
                        {
                            selectCreateAction.FrontendApplication = FrontendApplication;
                            selectCreateAction.BackendApplication  = BackendApplication;
                            selectCreateAction.FoundActions        = FoundActions;
                            selectCreateAction.MappableUXObject    = SelectedDialog;

                            if (selectCreateAction.ShowDialog() == DialogResult.OK)
                            {
                                SelectedAction = selectCreateAction.SelectedAction;
                            }
                        }
                    }
                    else
                    {
                        // Create the action and interface
                        SelectedAction = MetaManagerServices.Helpers.UXActionHelper.CreateUXActionForMappableObject(SelectedDialog, FrontendApplication, null, null);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                return;
            }

            DialogResult = DialogResult.OK;
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (SelectedMappableUXObject != null)
                {
                    SelectedAction = null;

                    // Check if a servicemethod is selected. Then we need to do additional
                    // select from database to retrieve correct data.
                    if (SelectedMappableUXObject is ServiceMethod)
                    {
                        ServiceMethod readServiceMethod = appService.GetServiceMethodWithRequestMap((SelectedMappableUXObject as ServiceMethod).Id);

                        SelectedMappableUXObject = readServiceMethod;
                    }

                    // Find all actions connected to this Dialog/CustomDialog/ServiceMethod
                    IList <UXAction> FoundActions = null;

                    FoundActions = actionService.GetUXActionForMappableObject(SelectedMappableUXObject);

                    // If any actions is found for this object then show another dialog where you can select
                    // to reuse the actions or create new ones.
                    if (FoundActions != null && FoundActions.Count > 0)
                    {
                        // In all other cases show the dialog to select or create a new action
                        using (SelectCreateUXAction selectCreateAction = new SelectCreateUXAction())
                        {
                            selectCreateAction.FrontendApplication = FrontendApplication;
                            selectCreateAction.BackendApplication  = BackendApplication;
                            selectCreateAction.FoundActions        = FoundActions;
                            selectCreateAction.MappableUXObject    = SelectedMappableUXObject;

                            if (selectCreateAction.ShowDialog() == DialogResult.OK)
                            {
                                SelectedAction = selectCreateAction.SelectedAction;
                            }
                        }
                    }
                    else
                    {
                        if (SelectedMappableUXObject != null)
                        {
                            FrontendApplication = modelService.GetInitializedDomainObject <DataAccess.Domain.Application>(FrontendApplication.Id);

                            if (rbtnJumpTo.Checked)
                            {
                                Dialog d = SelectedMappableUXObject as Dialog;
                                // Create the action and interface
                                SelectedAction = MetaManagerServices.Helpers.UXActionHelper.CreateUXActionForMappableObject(SelectedMappableUXObject, FrontendApplication, string.Format("JumpTo{0}", d.Name), string.Format("Jump To {0}", d.Title));
                            }
                            else
                            {
                                // Create the action and interface
                                SelectedAction = MetaManagerServices.Helpers.UXActionHelper.CreateUXActionForMappableObject(SelectedMappableUXObject, FrontendApplication, null, null);
                            }

                            // Leave the action as checked out
                            CheckOutInObject(SelectedAction, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SelectedAction = null;
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (SelectedAction != null)
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }