/// <summary>
        /// Occurs when trigger presentation (magnifying glass) of the object-valued Argument is triggered.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">TriggerEventArgs.</param>
        protected void HandleTriggerExecute(object sender, TriggerEventArgs e)
        {
            // Actualize the context.
            IUContext lContext = null;

            if (Parent != null)
            {
                Parent.UpdateContext();
                lContext = Parent.Context;
            }

            // Initialize class and service name.
            string lClassName     = string.Empty;
            string lContainerName = string.Empty;

            if (IsServiceField)
            {
                IUServiceController lServiceController = Parent as IUServiceController;

                if (lServiceController != null)
                {
                    lClassName     = lServiceController.ClassName;
                    lContainerName = lServiceController.Name;
                }
            }
            else if (IsFilterField)
            {
                IUFilterController lFilterController = Parent as IUFilterController;

                if (lFilterController != null)
                {
                    IUPopulationContext lPopContext = lFilterController.Parent.Context as IUPopulationContext;
                    lClassName     = lPopContext.ClassName;
                    lContainerName = lFilterController.Context.FilterName;
                    lContext       = lPopContext;
                }
            }
            // Create exchange information.
            ExchangeInfoSelectionForward lInfo =
                new ExchangeInfoSelectionForward(
                    Domain,
                    mSelectionScenario,
                    lClassName,
                    lContainerName,
                    Name,
                    MultiSelectionAllowed,
                    IsNavigationalFilter,
                    lContext);

            // Launch scenario.
            ScenarioManager.LaunchSelectionScenario(lInfo, this);
        }
Example #2
0
        /// <summary>
        /// Launchs a selection in an scenario.
        /// </summary>
        /// <param name="selectionForwardInfo">Origin scenario information.</param>
        /// <param name="argument">Selected oid information.</param>
        public static void LaunchSelectionScenario(
            ExchangeInfoSelectionForward selectionForwardInfo,
            ISelectionBackward argument)
        {
            // Instance Scenario, initialize and return the controller instance inside the Scenario.
            Form         lScenario   = CreateScenarioInstance(selectionForwardInfo);
            IUController lController = Initialize(lScenario, selectionForwardInfo);

            if (lController != null)
            {
                if (argument != null)
                {
                    argument.SuscribeSelectionBackward(lController as IInstancesSelector);
                }
            }
            if (lScenario != null)
            {
                lScenario.MdiParent = MainForm;
                LaunchShowState     = ShowState.Showing;
                lScenario.Show();
                LaunchShowState = ShowState.Showed;
            }
        }
        /// <summary>
        /// Launchs a selection in an scenario.
        /// </summary>
        /// <param name="selectionForwardInfo">Origin scenario information.</param>
        /// <param name="argument">Selected oid information.</param>
        public static void LaunchSelectionScenario(
			ExchangeInfoSelectionForward selectionForwardInfo,
			ISelectionBackward argument)
        {
            // Instance Scenario, initialize and return the controller instance inside the Scenario.
            Form lScenario = CreateScenarioInstance(selectionForwardInfo);
            IUController lController = Initialize(lScenario, selectionForwardInfo);

            if (lController!= null)
            {
                if (argument != null)
                {
                    argument.SuscribeSelectionBackward(lController as IInstancesSelector);
                }
            }
            if (lScenario != null)
            {
                lScenario.MdiParent = MainForm;
                LaunchShowState = ShowState.Showing;
                lScenario.Show();
                LaunchShowState = ShowState.Showed;
            }
        }
        public DataGridViewPresentation(
            DataGridView dataGridView,
            ToolStripMenuItem exportToExcel,
            ToolStripMenuItem exportToWord,
            ToolStripMenuItem retriveAll,
            ToolStripMenuItem refresh,
            ToolStripMenuItem help,
            ToolStripMenuItem options,
            ToolStripMenuItem navigations,
            ExchangeInfo exchangeInfo)
        {
            mDataGridViewIT = dataGridView;
            if (mDataGridViewIT != null)
            {
                mDataGridViewIT.SelectionChanged      += new EventHandler(HandleDataGridITCurrentCellChanged);
                mDataGridViewIT.Scroll                += new ScrollEventHandler(HandleDataGridViewITScroll);
                mDataGridViewIT.DataError             += new DataGridViewDataErrorEventHandler(HandleDataDridViewITDataError);
                mDataGridViewIT.KeyDown               += new KeyEventHandler(HandleDataGridViewITKeyDown);
                mDataGridViewIT.DoubleClick           += new EventHandler(HandleDataGridViewITDoubleClick);
                mDataGridViewIT.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(HandleDataGridViewITEditingControlShowing);
                mDataGridViewIT.CellBeginEdit         += new DataGridViewCellCancelEventHandler(HandleDataGridViewITCellBeginEdit);
                mDataGridViewIT.CellEndEdit           += new DataGridViewCellEventHandler(HandleDataGridViewITCellEndEdit);

                if (exportToExcel != null)
                {
                    exportToExcel.Text   = CultureManager.TranslateString(LanguageConstantKeys.L_POP_UP_MENU_EXPORT_TO_EXCEL, LanguageConstantValues.L_POP_UP_MENU_EXPORT_TO_EXCEL);
                    exportToExcel.Click += new EventHandler(HandleExportToExcel);
                }
                if (exportToWord != null)
                {
                    exportToWord.Text   = CultureManager.TranslateString(LanguageConstantKeys.L_POP_UP_MENU_EXPORT_TO_WORD, LanguageConstantValues.L_POP_UP_MENU_EXPORT_TO_WORD);
                    exportToWord.Click += new EventHandler(HandleExportToWord);
                }

                //If the argumet allow multiselection, the grid is configure in multiselection mode,
                //otherwise the grid is configure in simple selection mode.
                ExchangeInfoSelectionForward exchangeInfoSelection = exchangeInfo as ExchangeInfoSelectionForward;
                if (exchangeInfoSelection != null)
                {
                    mDataGridViewIT.MultiSelect = exchangeInfoSelection.MultiSelectionAllowed;
                }

                if (retriveAll != null)
                {
                    retriveAll.Text   = CultureManager.TranslateString(LanguageConstantKeys.L_POP_UP_MENU_RETRIEVE_ALL, LanguageConstantValues.L_POP_UP_MENU_RETRIEVE_ALL);
                    retriveAll.Click += new EventHandler(HandleRetrieveAllClick);
                }

                if (refresh != null)
                {
                    refresh.Text   = CultureManager.TranslateString(LanguageConstantKeys.L_POP_UP_MENU_REFRESH, LanguageConstantValues.L_POP_UP_MENU_REFRESH);
                    refresh.Click += new EventHandler(HandleRefreshClick);
                }

                if (help != null)
                {
                    help.Text = CultureManager.TranslateString(LanguageConstantKeys.L_POP_UP_MENU_HELP, LanguageConstantValues.L_POP_UP_MENU_HELP);
                }

                if (options != null)
                {
                    options.Text = CultureManager.TranslateString(LanguageConstantKeys.L_POP_UP_MENU_OPTIONS, LanguageConstantValues.L_POP_UP_MENU_OPTIONS);
                }

                if (navigations != null)
                {
                    navigations.Text = CultureManager.TranslateString(LanguageConstantKeys.L_POP_UP_MENU_NAVIGATIONS, LanguageConstantValues.L_POP_UP_MENU_NAVIGATIONS);
                }

                Form lContainerForm = mDataGridViewIT.FindForm();
                if (lContainerForm != null)
                {
                    lContainerForm.Shown += new EventHandler(HandleContainerForm_Shown);
                }
                else
                {
                    mRaiseEventCurrentCellChanged = true;
                }
            }
            // Assigns the default texts for boolean values
            AssignDefaultTextForBooleans();
        }
Example #5
0
        /// <summary>
        /// Obtains the NavigationalFiltering contained in a IUContext.
        /// </summary>
        /// <param name="context">Context the NavigationalFiltering is obtained from.</param>
        /// <returns>NavigationalFiltering contained in the context.</returns>
        public static NavigationalFiltering GetNavigationalFiltering(IUContext context)
        {
            NavigationalFiltering lResult = null;

            if (HasNavigationalFiltering(context))
            {
                switch (context.ExchangeInformation.ExchangeType)
                {
                case ExchangeType.Navigation:
                {
                    ExchangeInfoNavigation lExchangeInfo = context.ExchangeInformation as ExchangeInfoNavigation;
                    lResult = new NavigationalFiltering(
                        new SelectedObjectNavigationFiltering(
                            lExchangeInfo.NavigationalFilterIdentity,
                            lExchangeInfo.SelectedOids[0]));
                }
                break;

                case ExchangeType.Action:
                {
                    ExchangeInfoAction lExchangeInfo = context.ExchangeInformation as ExchangeInfoAction;
                    if ((lExchangeInfo.SelectedOids == null) || (lExchangeInfo.SelectedOids.Count == 0) || (lExchangeInfo.SelectedOids[0] == null))
                    {
                        IUServiceContext lServiceContext = context.ExchangeInformation.Previous as IUServiceContext;


                        ArgumentsList lArguments = ArgumentsList.GetArgumentsFromContext(lServiceContext);
                        lResult = new NavigationalFiltering(
                            new ServiceIUNavigationFiltering(
                                lExchangeInfo.NavigationalFilterIdentity,
                                lArguments));
                    }
                    else
                    {
                        lResult = new NavigationalFiltering(
                            new SelectedObjectNavigationFiltering(
                                lExchangeInfo.NavigationalFilterIdentity,
                                lExchangeInfo.SelectedOids[0]));
                    }
                }
                break;

                case ExchangeType.SelectionForward:
                {
                    ExchangeInfoSelectionForward lExchangeInfo = context.ExchangeInformation as ExchangeInfoSelectionForward;
                    ArgumentsList       lArguments             = null;
                    IUServiceContext    lServiceContext        = null;
                    IUPopulationContext lPopulationContext     = null;
                    string lClassName = string.Empty;

                    // context is of IUServiceContext type.
                    if (context.ExchangeInformation.Previous.ContextType == ContextType.Service)
                    {
                        lServiceContext = context.ExchangeInformation.Previous as IUServiceContext;
                        lArguments      = ArgumentsList.GetArgumentsFromContext(lServiceContext);
                        lClassName      = lServiceContext.ClassName;
                        if (string.Compare(lClassName, "Global", true) == 0)
                        {
                            lClassName = string.Empty;
                        }

                        lResult = new NavigationalFiltering(
                            new ArgumentNavigationFiltering(
                                lClassName,
                                lServiceContext.ServiceName,
                                lServiceContext.SelectedInputField,
                                lArguments));
                    }
                    // context is of lPopulationContext type.
                    if (context.ExchangeInformation.Previous.ContextType == ContextType.Population)
                    {
                        lPopulationContext = context.ExchangeInformation.Previous as IUPopulationContext;
                        lClassName         = lPopulationContext.ClassName;
                        string lFilterName         = lExchangeInfo.ServiceName;
                        string lFilterVariableName = lExchangeInfo.ArgumentName;
                        lArguments = ArgumentsList.GetArgumentsFromContext(lPopulationContext.Filters[lFilterName]);

                        lResult = new NavigationalFiltering(
                            new FilterVariableNavigationFiltering(
                                lClassName,
                                lFilterName,
                                lFilterVariableName,
                                lArguments));
                    }
                }
                break;

                case ExchangeType.SelectionBackward:
                    break;

                default:
                    break;
                }
            }
            return(lResult);
        }