/// <summary> /// Obtains the ArgumentsList contained in a IUInputFieldsContext (either an IUServiceContext or an IUFilterContext). /// </summary> /// <param name="context">Context the list is obtained from.</param> /// <returns>ArgumentsList contained in the context.</returns> public static ArgumentsList GetArgumentsFromContext(IUInputFieldsContext context) { if (context != null) { Dictionary <string, ModelType> largumentTypes = null; // Context is of IUFilterContext type if (context.ContextType == ContextType.Service) { // Get types of service arguments return(GetArgumentListFromArgumentInfoContext((IUServiceContext)context)); } // Context is of IUFilterContext type if (context.ContextType == ContextType.Filter) { // Get types of filter variables largumentTypes = Logics.Logic.GetVariablesTypes(context.ClassName, context.ContainerName); if (largumentTypes != null) { return(GetArgumentListFromArgumentInfoContext(context.InputFields, largumentTypes)); } } } return(null); }
/// <summary> /// Initialize the inbound arguments of a service, taking into account the context information. /// </summary> /// <param name="context">Current service context.</param> public static void ExecuteLoadFromContext(IUInputFieldsContext context) { try { // Parameter values object[] lParameters = new object[1]; lParameters[0] = context; // Parameter types Type[] lTypes = new Type[1]; switch (context.ContextType) { case ContextType.Service: lTypes[0] = typeof(IUServiceContext); ExecuteMethod(GetServiceTypeName(context.ClassName, context.ContainerName), "ExecuteLoadFromContext", lTypes, lParameters); break; case ContextType.Filter: lTypes[0] = typeof(IUFilterContext); ExecuteMethod(GetFilterTypeName(context.ClassName, context.ContainerName), "ExecuteLoadFromContext", lTypes, lParameters); break; default: break; } } catch { } }
/// <summary> /// Solves the dependency rules of a service. /// </summary> /// <param name="context">Current context.</param> /// <param name="lastValue">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(IUInputFieldsContext context, object lastValue, DependencyRulesEventLogic dependencyRulesEvent, DependencyRulesAgentLogic dependencyRulesAgent) { // Parameter values. object[] lParameters = new object[4]; lParameters[0] = context; lParameters[1] = lastValue; lParameters[2] = dependencyRulesEvent; lParameters[3] = dependencyRulesAgent; // Parameter types. Type[] lTypes = new Type[4]; lTypes[1] = typeof(object); lTypes[2] = typeof(DependencyRulesEventLogic); lTypes[3] = typeof(DependencyRulesAgentLogic); switch (context.ContextType) { case ContextType.Service: lTypes[0] = typeof(IUServiceContext); ExecuteMethod(GetServiceTypeName(context.ClassName, context.ContainerName), "ExecuteDependencyRules", lTypes, lParameters); break; case ContextType.Filter: lTypes[0] = typeof(IUFilterContext); ExecuteMethod(GetFilterTypeName(context.ClassName, context.ContainerName), "ExecuteDependencyRules", lTypes, lParameters); break; default: break; } }
/// <summary> /// Obtains the ArgumentsList contained in a IUInputFieldsContext (either an IUServiceContext or an IUFilterContext). /// </summary> /// <param name="context">Context the list is obtained from.</param> /// <returns>ArgumentsList contained in the context.</returns> public static ArgumentsList GetArgumentsFromContext(IUInputFieldsContext context) { if (context != null) { Dictionary<string, ModelType> largumentTypes = null; // Context is of IUFilterContext type if (context.ContextType == ContextType.Service) { // Get types of service arguments return GetArgumentListFromArgumentInfoContext((IUServiceContext)context); } // Context is of IUFilterContext type if (context.ContextType == ContextType.Filter) { // Get types of filter variables largumentTypes = Logics.Logic.GetVariablesTypes(context.ClassName, context.ContainerName); if (largumentTypes != null) { return GetArgumentListFromArgumentInfoContext(context.InputFields, largumentTypes); } } } return null; }
/// <summary> /// Solves the validation of the inbound arguments values of a service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteValidateValue(IUInputFieldsContext context) { // Parameter values object[] lParameters = new object[1]; lParameters[0] = context; // Parameter types Type[] lTypes = new Type[1]; switch (context.ContextType) { case ContextType.Service: lTypes[0] = typeof(IUServiceContext); ExecuteMethod(GetServiceTypeName(context.ClassName, context.ContainerName), "ExecuteValidateValue", lTypes, lParameters); break; case ContextType.Filter: lTypes[0] = typeof(IUFilterContext); ExecuteMethod(GetFilterTypeName(context.ClassName, context.ContainerName), "ExecuteValidateValue", lTypes, lParameters); break; default: break; } }
/// <summary> /// Solves the dependency rules of a service. /// </summary> /// <param name="context">Current context.</param> /// <param name="lastValue">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(IUInputFieldsContext context, object lastValue, DependencyRulesEventLogic dependencyRulesEvent, DependencyRulesAgentLogic dependencyRulesAgent) { // Parameter values. object[] lParameters = new object[4]; lParameters[0] = context; lParameters[1] = lastValue; lParameters[2] = dependencyRulesEvent; lParameters[3] = dependencyRulesAgent; // Parameter types. Type[] lTypes = new Type[4]; lTypes[1] = typeof(object); lTypes[2] = typeof(DependencyRulesEventLogic); lTypes[3] = typeof(DependencyRulesAgentLogic); switch (context.ContextType) { case ContextType.Service: lTypes[0] = typeof(IUServiceContext); ExecuteMethod(GetServiceTypeName(context.ClassName, context.ContainerName), "ExecuteDependencyRules", lTypes, lParameters); break; case ContextType.Filter: lTypes[0] = typeof(IUFilterContext); ExecuteMethod(GetFilterTypeName(context.ClassName, context.ContainerName), "ExecuteDependencyRules", lTypes, lParameters); break; default: break; } }
/// <summary> /// Implemented in derived classes to call Logic Load from Context Values. Sets context values in controller values. /// </summary> /// <param name="context">Context structure.</param> protected virtual void ExecuteLoadFromContext(IUInputFieldsContext context) { Logic.ExecuteLoadFromContext(context); }
/// <summary> /// Implemented in derived classes to call Logic Execute Default Values. /// </summary> /// <param name="context">Context structure.</param> protected virtual void ExecuteDefaultValues(IUInputFieldsContext context) { Logic.ExecuteDefaultValues(context); }
/// <summary> /// Sets the context data and configurations to input fields controller. /// </summary> /// <param name="context">IUInputFieldsContext reference.</param> protected virtual void ConfigureInputFieldsByContext(IUInputFieldsContext context) { mEnabledChangeArgument = false; if (context != null) { // Set the input fields values from context values. foreach (ArgumentController lArgument in InputFields) { // Preload population associated to the argument. if (context.GetInputFieldPreloadPopulationInitialized(lArgument.Name)) { ArgumentOVPreloadController lOVPreloadArgument = lArgument as ArgumentOVPreloadController; if (lOVPreloadArgument != null) { lOVPreloadArgument.SetPopulation(context.GetInputFieldPreloadPopulation(lArgument.Name)); context.SetInputFieldPreloadPopulationInitialized(lArgument.Name, false); } } // Set Value. lArgument.Value = context.GetInputFieldValue(lArgument.Name); // Set Enable. lArgument.Enabled = context.GetInputFieldEnabled(lArgument.Name); // Set Mandatory. lArgument.Mandatory = context.GetInputFieldMandatory(lArgument.Name); // Set Visible. lArgument.Visible = context.GetInputFieldVisible(lArgument.Name); ArgumentOVController lOVArgument = lArgument as ArgumentOVController; // When the argument is OV, it is possible to exits multiselection if (lOVArgument != null) { if ((lOVArgument.Enabled) && (lOVArgument.MultiSelectionAllowed)) { List<Oid> lInstancesSelected = lOVArgument.Value as List<Oid>; if ((lInstancesSelected != null) && (lInstancesSelected.Count > 1)) { // Is there is multiselection and more than one selected, // the oid editors must be disable. lOVArgument.EnabledEditors = false; } } } } foreach (ArgumentController lArgument in InputFields) { // Set the focus to the editor. if (context.GetInputFieldFocused(lArgument.Name)) { lArgument.Focused = true; // After setting the focus to the editor, // the focus of the input fields is cleared. context.ClearInputFieldsFocus(); break; } } } mEnabledChangeArgument = true; }
/// <summary> /// Implemented in derived classes to call Logic Load from Context Values. Sets context values in controller values. /// </summary> /// <param name="context">Context structure.</param> protected virtual void ExecuteLoadFromContext(IUInputFieldsContext context) { Logic.ExecuteLoadFromContext(context); }
/// <summary> /// Implemented in derived classes to call Logic Execute Default Values. /// </summary> /// <param name="context">Context structure.</param> protected virtual void ExecuteDefaultValues(IUInputFieldsContext context) { Logic.ExecuteDefaultValues(context); }
/// <summary> /// Sets the context data and configurations to input fields controller. /// </summary> /// <param name="context">IUInputFieldsContext reference.</param> protected virtual void ConfigureInputFieldsByContext(IUInputFieldsContext context) { mEnabledChangeArgument = false; if (context != null) { // Set the input fields values from context values. foreach (ArgumentController lArgument in InputFields) { // Preload population associated to the argument. if (context.GetInputFieldPreloadPopulationInitialized(lArgument.Name)) { ArgumentOVPreloadController lOVPreloadArgument = lArgument as ArgumentOVPreloadController; if (lOVPreloadArgument != null) { lOVPreloadArgument.SetPopulation(context.GetInputFieldPreloadPopulation(lArgument.Name)); context.SetInputFieldPreloadPopulationInitialized(lArgument.Name, false); } } // Set Value. lArgument.Value = context.GetInputFieldValue(lArgument.Name); // Set Enable. lArgument.Enabled = context.GetInputFieldEnabled(lArgument.Name); // Set Mandatory. lArgument.Mandatory = context.GetInputFieldMandatory(lArgument.Name); // Set Visible. lArgument.Visible = context.GetInputFieldVisible(lArgument.Name); ArgumentOVController lOVArgument = lArgument as ArgumentOVController; // When the argument is OV, it is possible to exits multiselection if (lOVArgument != null) { if ((lOVArgument.Enabled) && (lOVArgument.MultiSelectionAllowed)) { List <Oid> lInstancesSelected = lOVArgument.Value as List <Oid>; if ((lInstancesSelected != null) && (lInstancesSelected.Count > 1)) { // Is there is multiselection and more than one selected, // the oid editors must be disable. lOVArgument.EnabledEditors = false; } } } } foreach (ArgumentController lArgument in InputFields) { // Set the focus to the editor. if (context.GetInputFieldFocused(lArgument.Name)) { lArgument.Focused = true; // After setting the focus to the editor, // the focus of the input fields is cleared. context.ClearInputFieldsFocus(); break; } } } mEnabledChangeArgument = true; }