/// <summary>
        /// Preferences Trigger Handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HandlePreferencesTriggered(object sender, TriggerEventArgs e)
        {
            IUQueryController queryController = Parent as IUQueryController;

            if (queryController == null)
            {
                return;
            }

            if (!queryController.CheckPendingChanges(true, true))
            {
                return;
            }

            bool lRefresh = false;

            lRefresh = ScenarioManager.LaunchPreferencesScenario(queryController);

            if (!lRefresh)
            {
                return;
            }

            // Refresh all data
            OnExecuteCommand(new ExecuteCommandEventArgs(ExecuteCommandType.ExecuteRefresh));
        }
        /// <summary>
        /// Process the Display Service execute event
        /// </summary>
        protected virtual void ProcessExecuteServiceTriggered(object sender, TriggerEventArgs e)
        {
            // Before executing the DisplaySet Service it is needed to check for pending changes in associated Service IU.
            IUQueryController queryController = Parent as IUQueryController;

            if (queryController != null && !queryController.CheckPendingChanges(false, true))
            {
                return;
            }
            if (CurrentDisplaySet.ServiceInfo == null)
            {
                return;
            }

            // Gets modified rows from the viewer
            DataTable modifiedRows = Viewer.GetModifiedRows();

            if (modifiedRows == null)
            {
                return;
            }

            // Validate the modified data
            if (!ValidateModifiedRows(modifiedRows))
            {
                return;
            }

            // Error datatable
            DataTable errorReport = new DataTable();
            // Column for the OID
            string instanceColumnsName = CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentAlias;

            errorReport.Columns.Add(instanceColumnsName);
            // Column for the error message
            string lReportMessage = CultureManager.TranslateString(LanguageConstantKeys.L_MULTIEXE_EXECUTION, LanguageConstantValues.L_MULTIEXE_EXECUTION);

            errorReport.Columns.Add(lReportMessage);

            IUServiceContext lServiceContext = null;

            // For every modified row do...
            foreach (DataRow rowValues in modifiedRows.Rows)
            {
                // Create new IUServiceContext.
                lServiceContext = new IUServiceContext(null, CurrentDisplaySet.ServiceInfo.ClassServiceName, CurrentDisplaySet.ServiceInfo.ServiceName, null);
                // Add argunment this to the service context.
                List <Oid> instanceOIDs = new List <Oid>();
                Oid        instanceOID  = Adaptor.ServerConnection.GetOid(modifiedRows, rowValues);
                instanceOIDs.Add(instanceOID);
                lServiceContext.InputFields.Add(CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentName, new IUContextArgumentInfo(CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentName, instanceOIDs, true, null));

                // Fill the collections for the other inbound arguments.
                foreach (DisplaySetServiceArgumentInfo argumentInfo in CurrentDisplaySet.ServiceInfo.ArgumentDisplaySetPairs.Values)
                {
                    object value = rowValues[argumentInfo.DSElementName];
                    if (value.GetType() == typeof(System.DBNull))
                    {
                        value = null;
                    }
                    //Add input arguments with context.
                    lServiceContext.InputFields.Add(argumentInfo.Name, new IUContextArgumentInfo(argumentInfo.Name, value, true, null));
                }
                try
                {
                    // Execute service.
                    Logic.ExecuteService(lServiceContext);
                }
                catch (Exception exc)
                {
                    string lAlternateKeyName = CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentAlternateKeyName;
                    if (lAlternateKeyName != string.Empty)
                    {
                        instanceOID = Logic.GetAlternateKeyFromOid(instanceOID, lAlternateKeyName);
                    }

                    // Add a new row in the error datatable.
                    DataRow newReportRow = errorReport.NewRow();
                    newReportRow[lReportMessage]      = exc.Message;
                    newReportRow[instanceColumnsName] = UtilFunctions.OidFieldsToString(instanceOID, ' ');
                    errorReport.Rows.Add(newReportRow);
                }
            }

            // If errors have been found, show them
            if (errorReport.Rows.Count > 0)
            {
                // Show error message to the user
                ScenarioManager.LaunchMultiExecutionReportScenario(errorReport, CurrentDisplaySet.ServiceInfo.ServiceAlias, null, null);
            }

            // Remove the Pending changes mark
            PendingChanges = false;

            // Refresh the data
            OnExecuteCommand(new ExecuteCommandRefreshEventArgs(null));
        }