/// <summary> /// Creates the specific IUServiceController of the 'edit_instance' IU pattern. /// </summary> /// <param name="exchangeInfo">IUServiceController reference.</param> /// <returns>Specific IUServiceController of the 'edit_instance' IU pattern.</returns> public static IUServiceController Service_edit_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController) { string[] lAgentsService = { Agents.Administrador }; IUServiceContext lContext = new IUServiceContext(exchangeInfo, "PasajeroAeronave", "edit_instance", "SIU_edit_instance"); IUServiceController lController = new IUServiceController("edit_instance", "Edit", "Clas_1348178542592177Ser_3_Alias", lAgentsService, "PasajeroAeronave", "edit_instance", lContext, null, false); // This controller is an InboundArgument controller. lController.IsOutboundArgumentController = false; #region Inbound arguments IArguments InboundArguments = lController.InputFields; ArgumentOVController lArgument = null; // Argument p_thisPasajeroAeronave. lArgument = new ArgumentOVController("p_thisPasajeroAeronave", "PasajeroAeronave", "Clas_1348178542592177Ser_3UIServ_1ElemAgrup_1_Alias", "PasajeroAeronave", false, true, false, typeof(InteractionToolkit.PasajeroAeronave.IUPopulations.PIU_PasajeroAeronaveIT).FullName, null, "", lController); lController.ArgumentThis = lArgument; InboundArguments.Add(lArgument); #endregion Inbound arguments #region Outbound arguments // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null. lController.OutboundArgumentsScenario = null; #endregion Outbound arguments return(lController); }
/// <summary> /// Creates the specific IUServiceController of the 'create_instance' IU pattern. /// </summary> /// <param name="exchangeInfo">IUServiceController reference.</param> /// <returns>Specific IUServiceController of the 'create_instance' IU pattern.</returns> public static IUServiceController Service_create_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController) { string[] lAgentsService = { Agents.Administrador }; IUServiceContext lContext = new IUServiceContext(exchangeInfo, "Revision", "create_instance", "SIU_create_instance"); IUServiceController lController = new IUServiceController("create_instance", "New", "Clas_1348178542592347Ser_1_Alias", lAgentsService, "Revision", "create_instance", lContext, null); // This controller is an InboundArgument controller. lController.IsOutboundArgumentController = false; #region Inbound arguments IArguments InboundArguments = lController.InputFields; // Argument p_atrid_RevisarAeronave. InboundArguments.Add(new ArgumentDVController("p_atrid_RevisarAeronave", "id_RevisarAeronave", "Clas_1348178542592347Ser_1UIServ_1ElemAgrup_1_Alias", ModelType.Autonumeric, 0, false, null, lController)); // Argument p_atrFechaRevision. InboundArguments.Add(new ArgumentDVController("p_atrFechaRevision", "FechaRevision", "Clas_1348178542592347Ser_1UIServ_1ElemAgrup_3_Alias", ModelType.Date, 0, false, null, lController)); // Argument p_atrNombreRevisor. InboundArguments.Add(new ArgumentDVController("p_atrNombreRevisor", "NombreRevisor", "Clas_1348178542592347Ser_1UIServ_1ElemAgrup_4_Alias", ModelType.String, 100, false, null, lController)); // Argument p_atrId_Aeronave. InboundArguments.Add(new ArgumentDVController("p_atrId_Aeronave", "Id_Aeronave", "Clas_1348178542592347Ser_1UIServ_1ElemAgrup_5_Alias", ModelType.String, 100, false, null, lController)); #endregion Inbound arguments #region Outbound arguments // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null. lController.OutboundArgumentsScenario = null; #endregion Outbound arguments return(lController); }
/// <summary> /// Solves the validation of inbound arguments of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteValidateValue(IUServiceContext context) { switch (context.SelectedInputField) { case "p_agrAeronave": ExecuteValidateValuep_agrAeronave(context.Agent, context.GetInputFieldValue("p_agrAeronave") as List <Oid>); break; case "p_agrPasajero": ExecuteValidateValuep_agrPasajero(context.Agent, context.GetInputFieldValue("p_agrPasajero") as List <Oid>); break; case "p_atrid_PasajeroAeronave": ExecuteValidateValuep_atrid_PasajeroAeronave(context.Agent, context.GetInputFieldValue("p_atrid_PasajeroAeronave") as int?); break; case "p_atrNombreAeronave": ExecuteValidateValuep_atrNombreAeronave(context.Agent, context.GetInputFieldValue("p_atrNombreAeronave") as string); break; case "p_atrNombrePasajero": ExecuteValidateValuep_atrNombrePasajero(context.Agent, context.GetInputFieldValue("p_atrNombrePasajero") as string); break; default: break; } }
/// <summary> /// Creates the specific IUServiceController of the 'create_instance' IU pattern. /// </summary> /// <param name="exchangeInfo">IUServiceController reference.</param> /// <returns>Specific IUServiceController of the 'create_instance' IU pattern.</returns> public static IUServiceController Service_create_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController) { string[] lAgentsService = { Agents.Administrador }; IUServiceContext lContext = new IUServiceContext(exchangeInfo, "PasajeroAeronave", "create_instance", "SIU_create_instance"); IUServiceController lController = new IUServiceController("create_instance", "New", "Clas_1348178542592177Ser_1_Alias", lAgentsService, "PasajeroAeronave", "create_instance", lContext, null); // This controller is an InboundArgument controller. lController.IsOutboundArgumentController = false; #region Inbound arguments IArguments InboundArguments = lController.InputFields; // Argument p_atrid_PasajeroAeronave. InboundArguments.Add(new ArgumentDVController("p_atrid_PasajeroAeronave", "id_PasajeroAeronave", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_1_Alias", ModelType.Autonumeric, 0, false, null, lController)); // Argument p_agrAeronave. InboundArguments.Add(new ArgumentOVController("p_agrAeronave", "Aeronave", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_5_Alias", "Aeronave", true, false, false, typeof(InteractionToolkit.Aeronave.IUPopulations.PIU_AeronaveIT).FullName, null, "", lController)); // Argument p_agrPasajero. InboundArguments.Add(new ArgumentOVController("p_agrPasajero", "Pasajero", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_6_Alias", "Pasajero", true, false, false, typeof(InteractionToolkit.Pasajero.IUPopulations.PIU_PasajeroIT).FullName, null, "", lController)); // Argument p_atrNombreAeronave. InboundArguments.Add(new ArgumentDVController("p_atrNombreAeronave", "NombreAeronave", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_8_Alias", ModelType.String, 100, false, null, lController)); // Argument p_atrNombrePasajero. InboundArguments.Add(new ArgumentDVController("p_atrNombrePasajero", "NombrePasajero", "Clas_1348178542592177Ser_1UIServ_1ElemAgrup_9_Alias", ModelType.String, 100, false, null, lController)); #endregion Inbound arguments #region Outbound arguments // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null. lController.OutboundArgumentsScenario = null; #endregion Outbound arguments return(lController); }
/// <summary> /// Creates the specific IUServiceController of the 'delete_instance' IU pattern. /// </summary> /// <param name="exchangeInfo">IUServiceController reference.</param> /// <returns>Specific IUServiceController of the 'delete_instance' IU pattern.</returns> public static IUServiceController Service_delete_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController) { string[] lAgentsService = { Agents.Administrador }; IUServiceContext lContext = new IUServiceContext(exchangeInfo, "NaveNodriza", "delete_instance", "SIU_delete_instance"); IUServiceController lController = new IUServiceController("delete_instance", "Destroy", "Clas_1347649273856884Ser_2_Alias", lAgentsService, "NaveNodriza", "delete_instance", lContext, null, false); // This controller is an InboundArgument controller. lController.IsOutboundArgumentController = false; #region Inbound arguments IArguments InboundArguments = lController.InputFields; ArgumentOVController lArgument = null; // Argument p_thisNaveNodriza. lArgument = new ArgumentOVController("p_thisNaveNodriza", "NaveNodriza", "Clas_1347649273856884Ser_2UIServ_1ElemAgrup_1_Alias", "NaveNodriza", false, true, false, typeof(InteractionToolkit.NaveNodriza.IUPopulations.PIU_NaveNodrizaIT).FullName, null, "", lController); lController.ArgumentThis = lArgument; InboundArguments.Add(lArgument); #endregion Inbound arguments #region Outbound arguments // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null. lController.OutboundArgumentsScenario = null; #endregion Outbound arguments return(lController); }
/// <summary> /// Creates the specific IUServiceController of the 'create_instance' IU pattern. /// </summary> /// <param name="exchangeInfo">IUServiceController reference.</param> /// <returns>Specific IUServiceController of the 'create_instance' IU pattern.</returns> public static IUServiceController Service_create_instanceInbound(ExchangeInfo exchangeInfo, IUController parentController) { string[] lAgentsService = { Agents.Administrador }; IUServiceContext lContext = new IUServiceContext(exchangeInfo, "NaveNodriza", "create_instance", "Crear_NaveNodriza"); IUServiceController lController = new IUServiceController("create_instance", "New", "Clas_1347649273856884Ser_1_Alias", lAgentsService, "NaveNodriza", "create_instance", lContext, null); // This controller is an InboundArgument controller. lController.IsOutboundArgumentController = false; #region Inbound arguments IArguments InboundArguments = lController.InputFields; // Argument p_atrid_NaveNodriza. InboundArguments.Add(new ArgumentDVController("p_atrid_NaveNodriza", "id_NaveNodriza", "Clas_1347649273856884Ser_1UIServ_1ElemAgrup_1_Alias", ModelType.Autonumeric, 0, false, null, lController)); // Argument p_atrNombre_NaveNodriza. InboundArguments.Add(new ArgumentDVController("p_atrNombre_NaveNodriza", "Nombre_NaveNodriza", "Clas_1347649273856884Ser_1UIServ_1ElemAgrup_2_Alias", ModelType.String, 100, false, null, lController)); #endregion Inbound arguments #region Outbound arguments // If the service has outbound arguments, the outbound arguments scenario is set here; otherwise, null. lController.OutboundArgumentsScenario = null; #endregion Outbound arguments return(lController); }
/// <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> /// Gets the effect type of a service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Effect type of the service (Creation, Destruction, Modification).</returns> public static ServiceEffectType GetServiceEffectType(IUServiceContext context) { // Parameter values object[] lParameters = new object[1]; lParameters[0] = context; // Parameter types Type[] lTypes = new Type[1]; lTypes[0] = typeof(IUServiceContext); return((ServiceEffectType)ExecuteMethod(GetServiceTypeName(context.ClassName, context.ServiceName), "GetServiceEffectType", lTypes, lParameters)); }
/// <summary> /// Solves the validation of the inbound arguments values of a service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteValidateValue(IUServiceContext context) { // Parameter values object[] lParameters = new object[1]; lParameters[0] = context; // Parameter types Type[] lTypes = new Type[1]; lTypes[0] = typeof(IUServiceContext); ExecuteMethod(GetServiceTypeName(context.ClassName, context.ServiceName), "ExecuteValidateValue", lTypes, lParameters); }
/// <summary> /// Solves the validation of inbound arguments of 'delete_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteValidateValue(IUServiceContext context) { switch (context.SelectedInputField) { case "p_thisPasajero": ExecuteValidateValuep_thisPasajero(context.Agent, context.GetInputFieldValue("p_thisPasajero") as List <Oid>); break; default: break; } }
/// <summary> /// Solve the conditional navigation of a service. /// </summary> /// <param name="context">Current context.</param> /// <returns>A ExchangeInfo object indicating the target scenario and its initializations.</returns> public static ExchangeInfoConditionalNavigation ExecuteConditionalNavigation(IUServiceContext context) { // Parameter values. object[] lParameters = new object[1]; lParameters[0] = context; // Parameter types. Type[] lTypes = new Type[1]; lTypes[0] = typeof(IUServiceContext); return(ExecuteMethod(GetServiceTypeName(context.ClassName, context.ServiceName), "ExecuteConditionalNavigation", lTypes, lParameters) as ExchangeInfoConditionalNavigation); }
/// <summary> /// Obtains the ArgumentsList contained in a IUServiceContext. /// </summary> /// <param name="context">Context the list is obtained from.</param> /// <returns>ArgumentsList contained in the context.</returns> private static ArgumentsList GetArgumentListFromArgumentInfoContext(IUServiceContext context) { Dictionary <string, ModelType> largumentTypes = null; ArgumentsList lResult = null; largumentTypes = Logics.Logic.GetInboundArgumentTypes(context.ClassName, context.ContainerName); if (largumentTypes != null) { lResult = GetArgumentListFromArgumentInfoContext(context.InputFields, largumentTypes); } largumentTypes = Logics.Logic.GetOutboundArgumentTypes(context.ClassName, context.ContainerName); if (largumentTypes != null) { if (context.OutputFields != null && context.OutputFields.Count > 0) { foreach (KeyValuePair <string, ModelType> largumentType in largumentTypes) { object argumentInfo = context.OutputFields[largumentType.Key]; if (argumentInfo != null) { if (largumentType.Value == ModelType.Oid) { List <Oid> lOids = argumentInfo as List <Oid>; if (lOids != null && lOids.Count == 1) { lResult.Add(largumentType.Key, largumentType.Value, lOids[0], lOids[0].ClassName); } } else { if (argumentInfo != null) { lResult.Add(largumentType.Key, largumentType.Value, argumentInfo, string.Empty); } } } } } } if (lResult != null) { return(lResult); } return(null); }
/// <summary> /// Obtains the ArgumentsList contained in a IUServiceContext. /// </summary> /// <param name="context">Context the list is obtained from.</param> /// <returns>ArgumentsList contained in the context.</returns> private static ArgumentsList GetArgumentListFromArgumentInfoContext(IUServiceContext context) { Dictionary<string, ModelType> largumentTypes = null; ArgumentsList lResult = null; largumentTypes = Logics.Logic.GetInboundArgumentTypes(context.ClassName, context.ContainerName); if (largumentTypes != null) { lResult = GetArgumentListFromArgumentInfoContext(context.InputFields, largumentTypes); } largumentTypes = Logics.Logic.GetOutboundArgumentTypes(context.ClassName, context.ContainerName); if (largumentTypes != null) { if (context.OutputFields != null && context.OutputFields.Count > 0) { foreach (KeyValuePair<string, ModelType> largumentType in largumentTypes) { object argumentInfo = context.OutputFields[largumentType.Key]; if (argumentInfo != null) { if (largumentType.Value == ModelType.Oid) { List<Oid> lOids = argumentInfo as List<Oid>; if (lOids != null && lOids.Count == 1) { lResult.Add(largumentType.Key, largumentType.Value, lOids[0], lOids[0].ClassName); } } else { if (argumentInfo != null) { lResult.Add(largumentType.Key, largumentType.Value, argumentInfo, string.Empty); } } } } } } if (lResult != null) { return lResult; } return null; }
/// <summary> /// Solves the validation of inbound arguments of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteValidateValue(IUServiceContext context) { switch (context.SelectedInputField) { case "p_atrid_NaveNodriza": ExecuteValidateValuep_atrid_NaveNodriza(context.Agent, context.GetInputFieldValue("p_atrid_NaveNodriza") as int?); break; case "p_atrNombre_NaveNodriza": ExecuteValidateValuep_atrNombre_NaveNodriza(context.Agent, context.GetInputFieldValue("p_atrNombre_NaveNodriza") as string); 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(IUServiceContext 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[0] = typeof(IUServiceContext); lTypes[1] = typeof(object); lTypes[2] = typeof(DependencyRulesEventLogic); lTypes[3] = typeof(DependencyRulesAgentLogic); ExecuteMethod(GetServiceTypeName(context.ClassName, context.ServiceName), "ExecuteDependencyRules", lTypes, lParameters); }
/// <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> /// Solves the validation of inbound arguments of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteValidateValue(IUServiceContext context) { switch (context.SelectedInputField) { case "p_atrid_RevisarAeronave": ExecuteValidateValuep_atrid_RevisarAeronave(context.Agent, context.GetInputFieldValue("p_atrid_RevisarAeronave") as int?); break; case "p_atrFechaRevision": ExecuteValidateValuep_atrFechaRevision(context.Agent, context.GetInputFieldValue("p_atrFechaRevision") as DateTime?); break; case "p_atrNombreRevisor": ExecuteValidateValuep_atrNombreRevisor(context.Agent, context.GetInputFieldValue("p_atrNombreRevisor") as string); break; case "p_atrId_Aeronave": ExecuteValidateValuep_atrId_Aeronave(context.Agent, context.GetInputFieldValue("p_atrId_Aeronave") as string); break; 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> /// Method that solves the inbound arguments default values. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteDefaultValues(IUServiceContext context) { }
/// <summary> /// Method that returns the type of 'edit_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Type of the service (enumerate value Event, Transaction, Operation).</returns> public static ServiceType GetServiceType(IUServiceContext context) { // Type = E. return ServiceType.Event; }
/// <summary> /// Gets the effect type of 'edit_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Effect type of the service (Creation, Destruction, Modification).</returns> public static ServiceEffectType GetServiceEffectType(IUServiceContext context) { // ServiceType = N. return ServiceEffectType.Modification; }
/// <summary> /// Method that solves the execution of 'edit_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_thisPasajero") as List<Oid>); }
/// <summary> /// Solves the validation of inbound arguments of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteValidateValue(IUServiceContext context) { switch (context.SelectedInputField) { case "p_agrPasajeroAeronave": ExecuteValidateValuep_agrPasajeroAeronave(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List<Oid>); break; case "p_agrRevision": ExecuteValidateValuep_agrRevision(context.Agent, context.GetInputFieldValue("p_agrRevision") as List<Oid>); break; case "p_atrid_RevisionPasajero": ExecuteValidateValuep_atrid_RevisionPasajero(context.Agent, context.GetInputFieldValue("p_atrid_RevisionPasajero") as int?); break; default: break; } }
/// <summary> /// Method that solves the execution of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_atrid_RevisarAeronave") as int?, context.GetInputFieldValue("p_atrFechaRevision") as DateTime?, context.GetInputFieldValue("p_atrNombreRevisor") as string, context.GetInputFieldValue("p_atrId_Aeronave") as string); }
/// <summary> /// Gets the effect type of 'delete_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Effect type of the service (Creation, Destruction, Modification).</returns> public static ServiceEffectType GetServiceEffectType(IUServiceContext context) { // ServiceType = D. return ServiceEffectType.Destruction; }
/// <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)); }
/// <summary> /// Gets the effect type of a service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Effect type of the service (Creation, Destruction, Modification).</returns> public static ServiceEffectType GetServiceEffectType(IUServiceContext context) { // Parameter values object[] lParameters = new object[1]; lParameters[0] = context; // Parameter types Type[] lTypes = new Type[1]; lTypes[0] = typeof(IUServiceContext); return (ServiceEffectType) ExecuteMethod(GetServiceTypeName(context.ClassName, context.ServiceName), "GetServiceEffectType", lTypes, lParameters); }
/// <summary> /// Solve the conditional navigation of a service. /// </summary> /// <param name="context">Current context.</param> /// <returns>A ExchangeInfo object indicating the target scenario and its initializations.</returns> public static ExchangeInfoConditionalNavigation ExecuteConditionalNavigation(IUServiceContext context) { // Parameter values. object[] lParameters = new object[1]; lParameters[0] = context; // Parameter types. Type[] lTypes = new Type[1]; lTypes[0] = typeof(IUServiceContext); return ExecuteMethod(GetServiceTypeName(context.ClassName, context.ServiceName), "ExecuteConditionalNavigation", lTypes, lParameters) as ExchangeInfoConditionalNavigation; }
/// <summary> /// Solve the conditional navigation of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>A ExchangeInfoConditionalNavigation object indicating the target scenario and its initializations.</returns> public static ExchangeInfoConditionalNavigation ExecuteConditionalNavigation(IUServiceContext context) { return(null); // No conditional navigations are defined for this service IU. }
/// <summary> /// Gets the effect type of 'edit_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Effect type of the service (Creation, Destruction, Modification).</returns> public static ServiceEffectType GetServiceEffectType(IUServiceContext context) { // ServiceType = N. return(ServiceEffectType.Modification); }
/// <summary> /// Method that solves the execution of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List <Oid>, context.GetInputFieldValue("p_atrid_Aeronave") as int?, context.GetInputFieldValue("p_atrNombre") as string, context.GetInputFieldValue("p_atrMaximoPasajeros") as int?, context.GetInputFieldValue("p_atrOrigen") as string, context.GetInputFieldValue("p_atrDestino") as string); }
/// <summary> /// Gets the effect type of 'delete_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Effect type of the service (Creation, Destruction, Modification).</returns> public static ServiceEffectType GetServiceEffectType(IUServiceContext context) { // ServiceType = D. return(ServiceEffectType.Destruction); }
/// <summary> /// Gets the effect type of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Effect type of the service (Creation, Destruction, Modification).</returns> public static ServiceEffectType GetServiceEffectType(IUServiceContext context) { // ServiceType = C. return(ServiceEffectType.Creation); }
/// <summary> /// Method that solves the execution of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List<Oid>, context.GetInputFieldValue("p_agrRevision") as List<Oid>, context.GetInputFieldValue("p_atrid_RevisionPasajero") as int?); }
/// <summary> /// Solves the validation of inbound arguments of 'edit_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteValidateValue(IUServiceContext context) { switch (context.SelectedInputField) { case "p_thisPasajero": ExecuteValidateValuep_thisPasajero(context.Agent, context.GetInputFieldValue("p_thisPasajero") as List<Oid>); break; default: break; } }
/// <summary> /// Solves the validation of inbound arguments of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteValidateValue(IUServiceContext context) { switch (context.SelectedInputField) { case "p_agrPasajeroAeronave": ExecuteValidateValuep_agrPasajeroAeronave(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List<Oid>); break; case "p_atrid_Aeronave": ExecuteValidateValuep_atrid_Aeronave(context.Agent, context.GetInputFieldValue("p_atrid_Aeronave") as int?); break; case "p_atrNombre": ExecuteValidateValuep_atrNombre(context.Agent, context.GetInputFieldValue("p_atrNombre") as string); break; case "p_atrMaximoPasajeros": ExecuteValidateValuep_atrMaximoPasajeros(context.Agent, context.GetInputFieldValue("p_atrMaximoPasajeros") as int?); break; case "p_atrOrigen": ExecuteValidateValuep_atrOrigen(context.Agent, context.GetInputFieldValue("p_atrOrigen") as string); break; case "p_atrDestino": ExecuteValidateValuep_atrDestino(context.Agent, context.GetInputFieldValue("p_atrDestino") as string); break; default: break; } }
/// <summary> /// Solve the conditional navigation of 'edit_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>A ExchangeInfoConditionalNavigation object indicating the target scenario and its initializations.</returns> public static ExchangeInfoConditionalNavigation ExecuteConditionalNavigation(IUServiceContext context) { return null; // No conditional navigations are defined for this service IU. }
/// <summary> /// Gets the effect type of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Effect type of the service (Creation, Destruction, Modification).</returns> public static ServiceEffectType GetServiceEffectType(IUServiceContext context) { // ServiceType = C. return ServiceEffectType.Creation; }
/// <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> /// Method that solves the execution of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_agrAeronave") as List <Oid>, context.GetInputFieldValue("p_agrPasajero") as List <Oid>, context.GetInputFieldValue("p_atrid_PasajeroAeronave") as int?, context.GetInputFieldValue("p_atrNombreAeronave") as string, context.GetInputFieldValue("p_atrNombrePasajero") as string); }
/// <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> /// 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> /// Method that solves the execution of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_agrAeronave") as List<Oid>, context.GetInputFieldValue("p_agrPasajero") as List<Oid>, context.GetInputFieldValue("p_atrid_PasajeroAeronave") as int?, context.GetInputFieldValue("p_atrNombreAeronave") as string, context.GetInputFieldValue("p_atrNombrePasajero") as string); }
/// <summary> /// Method that solves the execution of 'delete_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_thisPasajero") as List <Oid>); }
/// <summary> /// Method that solves the execution of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List <Oid>, context.GetInputFieldValue("p_agrRevision") as List <Oid>, context.GetInputFieldValue("p_atrid_RevisionPasajero") as int?); }
/// <summary> /// Method that solves the execution of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_atrid_NaveNodriza") as int?, context.GetInputFieldValue("p_atrNombre_NaveNodriza") as string); }
/// <summary> /// Method that returns the type of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> /// <returns>Type of the service (enumerate value Event, Transaction, Operation).</returns> public static ServiceType GetServiceType(IUServiceContext context) { // Type = E. return(ServiceType.Event); }
/// <summary> /// Method that solves the execution of 'create_instance' service. /// </summary> /// <param name="context">Current context.</param> public static void ExecuteService(IUServiceContext context) { context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List<Oid>, context.GetInputFieldValue("p_atrid_Aeronave") as int?, context.GetInputFieldValue("p_atrNombre") as string, context.GetInputFieldValue("p_atrMaximoPasajeros") as int?, context.GetInputFieldValue("p_atrOrigen") as string, context.GetInputFieldValue("p_atrDestino") as string); }