/// <summary>
        /// Shows specified data on DataGrid and select the rows
        /// </summary>
        /// <param name="data"></param>
        /// <param name="selectedOids"></param>
        public void ShowData(DataTable data, List <Oid> selectedOids)
        {
            if (data == null)
            {
                return;
            }

            // Previous selection
            List <Oid> lPreviousSelection = Values;

            mDataGridViewIT.SuspendLayout();
            mDataGridViewIT.AutoGenerateColumns = false;
            // To avoid innecesary SelectionChanged events.
            bool lPreviousEventFlagValue = mRaiseEventCurrentCellChanged;

            mRaiseEventCurrentCellChanged = false;
            mDataGridViewIT.DataSource    = data.DefaultView;
            mDataGridViewIT.ClearSelection();
            mDataGridViewIT.ResumeLayout();
            SelectRowsByOid(selectedOids);
            mRaiseEventCurrentCellChanged = lPreviousEventFlagValue;

            // If selection has change, raise the event
            if (!UtilFunctions.OidListEquals(lPreviousSelection, selectedOids))
            {
                ProcessDataGridITCurrentCellChanged(null, null);
            }
        }
        /// <summary>
        /// Handles the Selected Instance Changed event from Editors
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">SelectedInstanceChangedEventArgs.</param>
        private void HandleEditorsSelectedInstanceChanged(object sender, SelectedInstanceChangedEventArgs e)
        {
            // If flag is set, do nothing.
            if (IgnoreEditorsValueChangeEvent)
            {
                return;
            }

            // Check if the value has changed.
            List <Oid> lLastValue = LastValueListOids;
            List <Oid> lValue     = mEditor.Values;
            bool       lEquals    = UtilFunctions.OidListEquals(lLastValue, lValue);

            // If there is no change, do nothing.
            if (lEquals)
            {
                return;
            }

            // Assign the current value as last value
            LastValueListOids = lValue;

            // If the values are the different, raise the change event.
            OnValueChanged(new ValueChangedEventArgs(this, lLastValue, lValue, DependencyRulesAgentLogic.User));
        }
        /// <summary>
        /// Handles the InstancesHasBeenSelected event from the Selector
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HandleSelectorInstancesHasBeenSelected(object sender, InstancesSelectedEventArgs e)
        {
            // Set flag.
            IgnoreEditorsValueChangeEvent = true;

            // Set values.
            List <Oid> lLastValue = LastValueListOids;

            SetValue(e.OidList);

            // Remove flag.
            IgnoreEditorsValueChangeEvent = false;

            // Set focus to the button.
            if (this.Trigger != null)
            {
                this.Trigger.Focused = true;
            }

            if (!UtilFunctions.OidListEquals(lLastValue, e.OidList))
            {
                // If more than one instance is selected, the dependency Rules should not be thrown.
                if ((e.OidList != null) && (e.OidList.Count > 1))
                {
                    return;
                }

                OnValueChanged(new ValueChangedEventArgs(this, lLastValue, e.OidList, DependencyRulesAgentLogic.User));
            }
        }
        /// <summary>
        /// Event handler for ValueChanged event in the object-valued Argument.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HandleOIDValueChanged(object sender, ValueChangedEventArgs e)
        {
            // If flag is set, do nothing.
            if (IgnoreEditorsValueChangeEvent)
            {
                return;
            }

            // If the parent controller is an OutboundArgument controller, do nothing.
            IUServiceController lParentController = this.Parent as IUServiceController;

            if ((lParentController != null) && (lParentController.IsOutboundArgumentController))
            {
                return;
            }
            // Check if the value have changed.
            List <Oid> lLastValue = LastValueListOids;
            List <Oid> lValue     = BuildOidsFromEditorsValue(false);
            bool       lEquals    = UtilFunctions.OidListEquals(lLastValue, lValue);

            // If there is no change, do nothing.
            if (lEquals)
            {
                return;
            }

            // Verify instance and show supplementary information
            if (lValue != null)
            {
                CheckInstance(lValue);
            }
            else
            {
                ShowSupplementaryInfo(null);
            }

            // Assign the current value as last value
            LastValueListOids = lValue;

            // Finally, if the last and current values are different, raise the event.
            OnValueChanged(new ValueChangedEventArgs(this, lLastValue, lValue, DependencyRulesAgentLogic.User));
        }
        /// <summary>
        /// This method builds a list of Oids from the editor presentation values.
        /// </summary>
        /// <param name="executeQuery">Indicates wheter a quey must be executed to retrieve the primary Oid.</param>
        /// <returns>List of Oids.</returns>
        private List <Oid> BuildOidsFromEditorsValue(bool executeQuery)
        {
            // Get the editor's values.
            List <object> lFields = new List <object>();

            foreach (IEditorPresentation lEditor in mEditors)
            {
                // Check the editor null values.
                if ((lEditor.Value == null) || (lEditor.Value.ToString().Trim().Length == 0))
                {
                    return(null);
                }
                lFields.Add(lEditor.Value);
            }
            // Build the AlternateKey object from the 'editor' values.
            List <Oid> lOids = new List <Oid>();
            Oid        lOid  = null;

            try
            {
                // Logic API call.
                lOid = Logic.CreateOidFromOidFields(Domain, lFields, AlternateKeyName, executeQuery);
            }
            catch (Exception logicException)
            {
                //Exception lcustomException = new Exception(CultureManager.TranslateFixedString(LanguageConstantKeys.L_CONTROLLER_EXCEPTION, LanguageConstantValues.L_CONTROLLER_EXCEPTION), logicException);
                ScenarioManager.LaunchErrorScenario(logicException);
            }
            lOids.Add(lOid);

            // If current Oid is equals to the Last one, return it
            if (UtilFunctions.OidListEquals(lOids, LastValueListOids))
            {
                return(LastValueListOids);
            }

            // Get SCD attribute values
            GetValuesForSCD(lOids);

            return(lOids);
        }