/// <summary> /// Executes the HAT leaf associated method. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">TriggerEventArgs.</param> public void Execute(object sender, TriggerEventArgs e) { try { // Create exchange information. ExchangeInfoAction lExchangeInfo = new ExchangeInfoAction(this.ClassIUName, this.IUName, NavigationalFilteringIdentity, null, null); // Launch scenario. ScenarioManager.LaunchActionScenario(lExchangeInfo, null); } catch (Exception err) { ScenarioManager.LaunchErrorScenario(err); } }
/// <summary> /// Executes the Action Item. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">TriggerEventArgs</param> public void Execute(object sender, TriggerEventArgs e) { try { // Validate if there are pending changes in the interaction unit // which contains the action item. CheckForPendingChangesEventArgs eventArg = new CheckForPendingChangesEventArgs(); OnBeforeExecute(eventArg); if (eventArg.Cancel) { return; } ContextRequiredEventArgs contextEventArgs = new ContextRequiredEventArgs(); OnContextRequired(contextEventArgs); SelectedInstancesRequiredEventArgs lSelectedInstancesEventArgs = new SelectedInstancesRequiredEventArgs(); OnSelectedInstancesRequired(lSelectedInstancesEventArgs); ExchangeInfoAction lExchangeInfoAction = null; if (this.IsNavigationalFilter) { lExchangeInfoAction = new ExchangeInfoAction(ClassIUName, IUName, NavigationalFilteringIdentity, lSelectedInstancesEventArgs.SelectedInstances, contextEventArgs.Context); } else { lExchangeInfoAction = new ExchangeInfoAction(ClassIUName, IUName, lSelectedInstancesEventArgs.SelectedInstances, contextEventArgs.Context); } // Set default order criteria lExchangeInfoAction.DefaultOrderCriteria = DefaultOrderCriteria; // Raise the event Launching Scenario. LaunchingScenarioEventArgs lLaunchScenarioArgs = new LaunchingScenarioEventArgs(lExchangeInfoAction); OnLaunchingScenario(lLaunchScenarioArgs); // Launch scenario. ScenarioManager.LaunchActionScenario(lExchangeInfoAction, this); } catch (Exception err) { ScenarioManager.LaunchErrorScenario(err); } }
/// <summary> /// Launchs an action in an scenario. /// </summary> /// <param name="actionInfo">Action information.</param> /// <param name="actionItem">Item involved in the action.</param> public static void LaunchActionScenario(ExchangeInfoAction actionInfo, IActionItemSuscriber actionItem) { // Print Scenario if (actionInfo.IUName == typeof(PrintForm).FullName) { LaunchPrintScenario(actionInfo.SelectedOids); return; } // Instance Scenario, initialize and return the controller instance inside the Scenario. Form lScenario = CreateScenarioInstance(actionInfo); IUController lController = Initialize(lScenario, actionInfo); if (lController != null) { if (actionItem != null) { actionItem.SuscribeActionEvents(lController as IActionItemEvents); } } if (lScenario != null) { IUServiceController lIUServiceController = lController as IUServiceController; if (lIUServiceController != null && !lIUServiceController.ShowScenario) { lIUServiceController.Execute(); } else { lScenario.MdiParent = MainForm; LaunchShowState = ShowState.Showing; lScenario.Show(); LaunchShowState = ShowState.Showed; } } }
/// <summary> /// Launchs an action in an scenario. /// </summary> /// <param name="actionInfo">Action information.</param> /// <param name="actionItem">Item involved in the action.</param> public static void LaunchActionScenario(ExchangeInfoAction actionInfo, IActionItemSuscriber actionItem) { // Print Scenario if (actionInfo.IUName == typeof(PrintForm).FullName) { LaunchPrintScenario(actionInfo.SelectedOids); return; } // Instance Scenario, initialize and return the controller instance inside the Scenario. Form lScenario = CreateScenarioInstance(actionInfo); IUController lController = Initialize(lScenario, actionInfo); if (lController != null) { if (actionItem != null) { actionItem.SuscribeActionEvents(lController as IActionItemEvents); } } if (lScenario != null) { IUServiceController lIUServiceController = lController as IUServiceController; if (lIUServiceController != null && !lIUServiceController.ShowScenario) { lIUServiceController.Execute(); } else { lScenario.MdiParent = MainForm; LaunchShowState = ShowState.Showing; lScenario.Show(); LaunchShowState = ShowState.Showed; } } }
/// <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> /// Executes the Action Item. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">TriggerEventArgs</param> public void Execute(object sender, TriggerEventArgs e) { try { // Validate if there are pending changes in the interaction unit // which contains the action item. CheckForPendingChangesEventArgs eventArg = new CheckForPendingChangesEventArgs(); OnBeforeExecute(eventArg); if (eventArg.Cancel) { return; } ContextRequiredEventArgs contextEventArgs = new ContextRequiredEventArgs(); OnContextRequired(contextEventArgs); SelectedInstancesRequiredEventArgs lSelectedInstancesEventArgs = new SelectedInstancesRequiredEventArgs(); OnSelectedInstancesRequired(lSelectedInstancesEventArgs); ExchangeInfoAction lExchangeInfoAction = null; if (this.IsNavigationalFilter) { lExchangeInfoAction = new ExchangeInfoAction(ClassIUName, IUName, NavigationalFilteringIdentity, lSelectedInstancesEventArgs.SelectedInstances, contextEventArgs.Context); } else { lExchangeInfoAction = new ExchangeInfoAction(ClassIUName, IUName, lSelectedInstancesEventArgs.SelectedInstances, contextEventArgs.Context); } // Set default order criteria lExchangeInfoAction.DefaultOrderCriteria = DefaultOrderCriteria; // Raise the event Launching Scenario. LaunchingScenarioEventArgs lLaunchScenarioArgs = new LaunchingScenarioEventArgs(lExchangeInfoAction); OnLaunchingScenario(lLaunchScenarioArgs); // Launch scenario. ScenarioManager.LaunchActionScenario(lExchangeInfoAction, this); } catch (Exception err) { ScenarioManager.LaunchErrorScenario(err); } }
/// <summary> /// Executes the HAT leaf associated method. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">TriggerEventArgs.</param> public void Execute(object sender, TriggerEventArgs e) { try { // Create exchange information. ExchangeInfoAction lExchangeInfo = new ExchangeInfoAction(this.ClassIUName, this.IUName,NavigationalFilteringIdentity, null, null); // Launch scenario. ScenarioManager.LaunchActionScenario(lExchangeInfo, null); } catch (Exception err) { ScenarioManager.LaunchErrorScenario(err); } }
/// <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); }
/// <summary> /// Clear associated service. /// </summary> protected void ClearAssociatedService() { if (AssociatedServiceController == null) { return; } // Clear input fields context values. AssociatedServiceController.Context.ClearInputFields(); // Create new EchangeInfoAction to service context IUServiceContext lServiceContext = AssociatedServiceController.Context; ExchangeInfoAction lExchangeInfoAction = new ExchangeInfoAction(lServiceContext.ClassName, lServiceContext.IuName, null, Context); AssociatedServiceController.Context.ExchangeInformation = lExchangeInfoAction; AssociatedServiceController.Initialize(); // Hidden argument this. if (string.Compare(AssociatedServiceController.ClassName, Context.ClassName) == 0 && AssociatedServiceController.ArgumentThis != null) { AssociatedServiceController.ArgumentThis.Visible = false; AssociatedServiceController.Context.InputFields[AssociatedServiceController.ArgumentThis.Name].Visible = false; } }