/// <summary>
        /// Solves the dependency rules of 'create_instance' inbound arguments, updating the context received as parameter.
        /// </summary>
        /// <param name="context">Current context.</param>
        /// <param name="oldValue">Old value of the modified argument.</param>
        /// <param name="dependencyRulesEvent">Event that has been thrown (SetValue, SetEnabled).</param>
        /// <param name="dependencyRulesAgent">Agent that has thrown the event (User, Internal).</param>
        public static void ExecuteDependencyRules(IUServiceContext context, object oldValue, DependencyRulesEventLogic dependencyRulesEvent, DependencyRulesAgentLogic dependencyRulesAgent)
        {
            int lDependencyRulesCounter        = Properties.Settings.Default.DependencyRulesCounter;
            DependencyRulesCache depRulesCache = new DependencyRulesCache();

            ExecuteDependencyRules(context, oldValue, dependencyRulesEvent, dependencyRulesAgent, ref lDependencyRulesCounter, depRulesCache);
        }
        /// <summary>
        /// Initialize the inbound arguments based in the context information.
        /// </summary>
        /// <param name="context">Current service context.</param>
        public static void ExecuteLoadFromContext(IUServiceContext context)
        {
            int depRulesCounter = Properties.Settings.Default.DependencyRulesCounter;
            DependencyRulesCache depRulesCache = new DependencyRulesCache();

            // If Exchange information does not exist, none initialization can be done.
            if (context == null || context.ExchangeInformation == null)
            {
                return;
            }

            // Argument previous value. Common for all of them.
            object previousValue;


            #region Aggregation relationships initializations
            // Obtain data from the last navigation, in order to initialize object-valued arguments that represent aggregation relationships.
            string lLastNavigationRole = context.ExchangeInformation.GetLastNavigationRole();

            if (lLastNavigationRole != "")
            {
            }
            #endregion Aggregation relationships initializations

            #region Manual initializations
            // Search in context for initializations done by programmers, in order to achieve special behaviours.
            foreach (KeyValuePair <string, object> argument in context.ExchangeInformation.CustomData)
            {
                previousValue = context.GetInputFieldValue(argument.Key);

                object lCustomArgumentValue = argument.Value;


                context.SetInputFieldValue(argument.Key, lCustomArgumentValue);
                // Check SetValue dependency rules
                context.SelectedInputField = argument.Key;
                ExecuteDependencyRules(context, previousValue, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                context.SelectedInputField = string.Empty;
            }
            #endregion Manual initializations

            #region Arguments initializations taking into account context information
            #endregion Arguments initializations taking into account context information
        }
        /// <summary>
        /// Initialize the inbound arguments based in the context information.
        /// </summary>
        /// <param name="context">Current service context.</param>
        public static void ExecuteLoadFromContext(IUServiceContext context)
        {
            int depRulesCounter  = Properties.Settings.Default.DependencyRulesCounter;
            DependencyRulesCache depRulesCache = new DependencyRulesCache();

            // If Exchange information does not exist, none initialization can be done.
            if (context == null || context.ExchangeInformation == null)
            {
                return;
            }

            // Argument previous value. Common for all of them.
            object previousValue;

            #region Aggregation relationships initializations
            // Obtain data from the last navigation, in order to initialize object-valued arguments that represent aggregation relationships.
            string lLastNavigationRole = context.ExchangeInformation.GetLastNavigationRole();

            if (lLastNavigationRole != "")
            {

            }
            #endregion Aggregation relationships initializations

            #region Manual initializations
            // Search in context for initializations done by programmers, in order to achieve special behaviours.
            foreach(KeyValuePair<string,object> argument in context.ExchangeInformation.CustomData)
            {
                previousValue = context.GetInputFieldValue(argument.Key);

                object lCustomArgumentValue = argument.Value;

                context.SetInputFieldValue(argument.Key, lCustomArgumentValue);
                // Check SetValue dependency rules
                context.SelectedInputField = argument.Key;
                ExecuteDependencyRules(context, previousValue, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                context.SelectedInputField = string.Empty;
            }
            #endregion Manual initializations

            #region Arguments initializations taking into account context information
            #endregion Arguments initializations taking into account context information
        }
        /// <summary>
        /// Solves the dependency rules of 'create_instance' inbound arguments, updating the context received as parameter.
        /// </summary>
        /// <param name="context">Current context.</param>
        /// <param name="oldValue">Old value of the modified argument.</param>
        /// <param name="dependencyRulesEvent">Event that has been thrown (SetValue, SetEnabled).</param>
        /// <param name="dependencyRulesAgent">Agent that has thrown the event (User, Internal).</param>
        /// <param name="dependencyRulesCounter">Counter that controls the number of dependency rules executed in order to avoid infinite loops.</param>
        /// <param name="depRulesCache">Cache in this dependency rule.</param>
        private static void ExecuteDependencyRules(IUServiceContext context, object oldValue, DependencyRulesEventLogic dependencyRulesEvent, DependencyRulesAgentLogic dependencyRulesAgent, ref int dependencyRulesCounter, DependencyRulesCache depRulesCache)
        {
            // Check if the receiver object-valued argument has more than one Oid.
            if (context.InputFields[context.SelectedInputField].Value is List <Oid> )
            {
                if (((List <Oid>)context.InputFields[context.SelectedInputField].Value).Count > 1)
                {
                    // If the receiver object-valued argument has more than one Oid,
                    // do not execute dependency rules.
                    return;
                }
            }

            switch (context.SelectedInputField)
            {
            default:
                break;
            }
        }
        /// <summary>
        /// Initialize the inbound arguments based in the context information.
        /// </summary>
        /// <param name="context">Current service context.</param>
        public static void ExecuteLoadFromContext(IUServiceContext context)
        {
            int depRulesCounter  = Properties.Settings.Default.DependencyRulesCounter;
            DependencyRulesCache depRulesCache = new DependencyRulesCache();

            // If Exchange information does not exist, none initialization can be done.
            if (context == null || context.ExchangeInformation == null)
            {
                return;
            }

            // Argument previous value. Common for all of them.
            object previousValue;

            #region 'this' initialization
            // Argument 'this' initialization: 'p_thisPasajero'.
            List<Oid> lSelectedOids = null;
            ExchangeInfoAction lInfoAction = context.ExchangeInformation as ExchangeInfoAction;
            if (lInfoAction != null)
            {
                lSelectedOids = lInfoAction.SelectedOids;
            }

            // Check if the selected Oid is an Oid of the 'this' argument class.
            if (UtilFunctions.OidsBelongToClass(lSelectedOids, "Pasajero"))
            {
                if (!context.GetInputFieldMultiSelectionAllowed("p_thisPasajero") && lSelectedOids.Count > 1)
                {
                    lSelectedOids.RemoveRange(1, lSelectedOids.Count - 1);
                }
                previousValue = context.GetInputFieldValue("p_thisPasajero");
                context.SetInputFieldValue("p_thisPasajero", lSelectedOids);
                // Check SetValue dependency rules.
                context.SelectedInputField = "p_thisPasajero";
                ExecuteDependencyRules(context, previousValue, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                // Check SetEnabled dependency rules.
                context.SetInputFieldEnabled("p_thisPasajero", false);
                context.SelectedInputField = "p_thisPasajero";
                ExecuteDependencyRules(context, true, DependencyRulesEventLogic.SetActive, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                context.SelectedInputField = string.Empty;
            }
            #endregion 'this' initialization

            #region Aggregation relationships initializations
            // Obtain data from the last navigation, in order to initialize object-valued arguments that represent aggregation relationships.
            string lLastNavigationRole = context.ExchangeInformation.GetLastNavigationRole();

            if (lLastNavigationRole != "")
            {

            }
            #endregion Aggregation relationships initializations

            #region Manual initializations
            // Search in context for initializations done by programmers, in order to achieve special behaviours.
            foreach(KeyValuePair<string,object> argument in context.ExchangeInformation.CustomData)
            {
                previousValue = context.GetInputFieldValue(argument.Key);

                object lCustomArgumentValue = argument.Value;

                context.SetInputFieldValue(argument.Key, lCustomArgumentValue);
                // Check SetValue dependency rules
                context.SelectedInputField = argument.Key;
                ExecuteDependencyRules(context, previousValue, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                context.SelectedInputField = string.Empty;
            }
            #endregion Manual initializations

            #region Arguments initializations taking into account context information
            // Initialize object-valued arguments using information in the context stack, only if the argument has not value.
            List<Oid> lArgumentValue = null;
            // 'p_thisPasajero' argument.
            previousValue = context.GetInputFieldValue("p_thisPasajero");
            if (previousValue == null)
            {
                // Search an Oid of the argument class: 'Pasajero'.
                lArgumentValue = context.ExchangeInformation.GetOidsOfClass("Pasajero");
                if (lArgumentValue != null)
                {
                    context.SetInputFieldValue("p_thisPasajero", lArgumentValue);
                    // Check SetValue dependency rules.
                    context.SelectedInputField = "p_thisPasajero";
                    ExecuteDependencyRules(context, null, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                    context.SelectedInputField = string.Empty;
                }
            }

            #endregion Arguments initializations taking into account context information
        }
 /// <summary>
 /// Solves the dependency rules of 'edit_instance' inbound arguments, updating the context received as parameter.
 /// </summary>
 /// <param name="context">Current context.</param>
 /// <param name="oldValue">Old value of the modified argument.</param>
 /// <param name="dependencyRulesEvent">Event that has been thrown (SetValue, SetEnabled).</param>
 /// <param name="dependencyRulesAgent">Agent that has thrown the event (User, Internal).</param>
 public static void ExecuteDependencyRules(IUServiceContext context, object oldValue, DependencyRulesEventLogic dependencyRulesEvent, DependencyRulesAgentLogic dependencyRulesAgent)
 {
     int lDependencyRulesCounter = Properties.Settings.Default.DependencyRulesCounter;
     DependencyRulesCache depRulesCache = new DependencyRulesCache();
     ExecuteDependencyRules(context, oldValue, dependencyRulesEvent, dependencyRulesAgent, ref lDependencyRulesCounter, depRulesCache);
 }
        /// <summary>
        /// Solves the dependency rules of 'edit_instance' inbound arguments, updating the context received as parameter.
        /// </summary>
        /// <param name="context">Current context.</param>
        /// <param name="oldValue">Old value of the modified argument.</param>
        /// <param name="dependencyRulesEvent">Event that has been thrown (SetValue, SetEnabled).</param>
        /// <param name="dependencyRulesAgent">Agent that has thrown the event (User, Internal).</param>
        /// <param name="dependencyRulesCounter">Counter that controls the number of dependency rules executed in order to avoid infinite loops.</param>
        /// <param name="depRulesCache">Cache in this dependency rule.</param>
        private static void ExecuteDependencyRules(IUServiceContext context, object oldValue, DependencyRulesEventLogic dependencyRulesEvent, DependencyRulesAgentLogic dependencyRulesAgent, ref int dependencyRulesCounter, DependencyRulesCache depRulesCache)
        {
            // Check if the receiver object-valued argument has more than one Oid.
            if (context.InputFields[context.SelectedInputField].Value is List<Oid>)
            {
                if (((List<Oid>)context.InputFields[context.SelectedInputField].Value).Count > 1)
                {
                    // If the receiver object-valued argument has more than one Oid,
                    // do not execute dependency rules.
                    return;
                }
            }

            switch (context.SelectedInputField)
            {
                default:
                    break;
            }
        }
        /// <summary>
        /// Initialize the inbound arguments based in the context information.
        /// </summary>
        /// <param name="context">Current service context.</param>
        public static void ExecuteLoadFromContext(IUServiceContext context)
        {
            int depRulesCounter = Properties.Settings.Default.DependencyRulesCounter;
            DependencyRulesCache depRulesCache = new DependencyRulesCache();

            // If Exchange information does not exist, none initialization can be done.
            if (context == null || context.ExchangeInformation == null)
            {
                return;
            }

            // Argument previous value. Common for all of them.
            object previousValue;


            #region 'this' initialization
            // Argument 'this' initialization: 'p_thisPasajero'.
            List <Oid>         lSelectedOids = null;
            ExchangeInfoAction lInfoAction   = context.ExchangeInformation as ExchangeInfoAction;
            if (lInfoAction != null)
            {
                lSelectedOids = lInfoAction.SelectedOids;
            }

            // Check if the selected Oid is an Oid of the 'this' argument class.
            if (UtilFunctions.OidsBelongToClass(lSelectedOids, "Pasajero"))
            {
                if (!context.GetInputFieldMultiSelectionAllowed("p_thisPasajero") && lSelectedOids.Count > 1)
                {
                    lSelectedOids.RemoveRange(1, lSelectedOids.Count - 1);
                }
                previousValue = context.GetInputFieldValue("p_thisPasajero");
                context.SetInputFieldValue("p_thisPasajero", lSelectedOids);
                // Check SetValue dependency rules.
                context.SelectedInputField = "p_thisPasajero";
                ExecuteDependencyRules(context, previousValue, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                // Check SetEnabled dependency rules.
                context.SetInputFieldEnabled("p_thisPasajero", false);
                context.SelectedInputField = "p_thisPasajero";
                ExecuteDependencyRules(context, true, DependencyRulesEventLogic.SetActive, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                context.SelectedInputField = string.Empty;
            }
            #endregion 'this' initialization

            #region Aggregation relationships initializations
            // Obtain data from the last navigation, in order to initialize object-valued arguments that represent aggregation relationships.
            string lLastNavigationRole = context.ExchangeInformation.GetLastNavigationRole();

            if (lLastNavigationRole != "")
            {
            }
            #endregion Aggregation relationships initializations

            #region Manual initializations
            // Search in context for initializations done by programmers, in order to achieve special behaviours.
            foreach (KeyValuePair <string, object> argument in context.ExchangeInformation.CustomData)
            {
                previousValue = context.GetInputFieldValue(argument.Key);

                object lCustomArgumentValue = argument.Value;


                context.SetInputFieldValue(argument.Key, lCustomArgumentValue);
                // Check SetValue dependency rules
                context.SelectedInputField = argument.Key;
                ExecuteDependencyRules(context, previousValue, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                context.SelectedInputField = string.Empty;
            }
            #endregion Manual initializations

            #region Arguments initializations taking into account context information
            // Initialize object-valued arguments using information in the context stack, only if the argument has not value.
            List <Oid> lArgumentValue = null;
            // 'p_thisPasajero' argument.
            previousValue = context.GetInputFieldValue("p_thisPasajero");
            if (previousValue == null)
            {
                // Search an Oid of the argument class: 'Pasajero'.
                lArgumentValue = context.ExchangeInformation.GetOidsOfClass("Pasajero");
                if (lArgumentValue != null)
                {
                    context.SetInputFieldValue("p_thisPasajero", lArgumentValue);
                    // Check SetValue dependency rules.
                    context.SelectedInputField = "p_thisPasajero";
                    ExecuteDependencyRules(context, null, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                    context.SelectedInputField = string.Empty;
                }
            }

            #endregion Arguments initializations taking into account context information
        }