public void Edit_instanceServ( [ONInboundArgument("Clas_1348178411520734Ser_3Arg_1_Alias", AeronaveClassText.Edit_instance_P_thisAeronaveArgumentAlias, "", "Clas_1348178411520734Ser_3_Alias", AeronaveClassText.Edit_instanceServiceAlias, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias, AllowsNull = false)] AeronaveOid p_thisAeronaveArg) { try { } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Aeronave, Service: edit_instance, Component: AeronaveAction, Method: Edit_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
/// <summary> /// Execute a query related with a Aeronave /// </summary> /// <param name="agent">Application agent</param> /// <param name="relatedOid">Aeronave oid related</param> /// <param name="displaySet">List of attributes to return</param> /// <param name="orderCriteria">Order criteria name</param> /// <param name="lastOid">Oid from whitch to search (not included)</param> /// <param name="blockSize">Number of instances to return (0 for all population)</param> /// <param name="lastBlock">Returns if it is last block</param> /// <returns>Query data</returns> public static DataTable ExecuteQueryRelatedAeronave(Oid agent, AeronaveOid relatedOid, string displaySet, string orderCriteria, PasajeroAeronaveOid lastOid, int blockSize, ref bool lastBlock) { Dictionary <string, Oid> lLinkItems = new Dictionary <string, Oid>(StringComparer.CurrentCultureIgnoreCase); lLinkItems.Add("Aeronave", relatedOid); return(ExecuteQueryRelated(agent, lLinkItems, displaySet, orderCriteria, lastOid, blockSize, ref lastBlock)); }
/// <summary> /// Gets a list with the arguments values. /// </summary> /// <param name="p_thisAeronaveArg">Value of the inbound argument 'p_thisAeronave'.</param> /// <returns>List of inbound arguments values.</returns> private static Dictionary <string, object> GetInputFieldValues(AeronaveOid p_thisAeronaveArg) { // Fill values dictionary. Dictionary <string, object> lValues = new Dictionary <string, object>(); lValues.Add("p_thisAeronave", p_thisAeronaveArg); return(lValues); }
public void PasajeroAeronaveRoleInsert(AeronaveOid localOid, PasajeroAeronaveOid relatedOid) { ONSqlUpdate lOnSql = new ONSqlUpdate(); lOnSql.AddUpdate(CtesBD.TBL_PASAJEROAERONAVE); lOnSql.AddSet(CtesBD.FLD_PASAJEROAERONAVE_FK_AERONAVE_1, localOid.Id_AeronaveAttr); lOnSql.AddWhere(CtesBD.FLD_PASAJEROAERONAVE_ID_PASAJEROAERONAVE, relatedOid.Id_PasajeroAeronaveAttr); Execute(lOnSql); }
/// <summary>Default Constructor</summary> public AeronaveInstance(ONContext onContext) : base(onContext, "Aeronave", "Clas_1348178411520734_Alias") { Oid = new AeronaveOid(); NombreAttr = null; MaximoPasajerosAttr = ONInt.Null; OrigenAttr = null; DestinoAttr = null; PasajeroAeronaveRoleTemp = null; StateObjAttrTemp = null; }
/// <summary> /// Execute a query to retrieve an instance. /// </summary> /// <param name="context">Current context.</param> /// <returns>A DataTable with the instance searched.</returns> public static DataTable ExecuteQueryInstance(IUQueryContext context) { AeronaveOid lOid = null; if (context.ExchangeInformation != null && context.ExchangeInformation.SelectedOids.Count > 0) { lOid = new AeronaveOid(context.ExchangeInformation.SelectedOids[0]); } return(ExecuteQueryInstance(context.Agent, lOid, context.DisplaySetAttributes)); }
public void PasajeroAeronaveRoleDelete(AeronaveOid oid) { ONSqlUpdate lOnSql = new ONSqlUpdate(); lOnSql.AddUpdate(CtesBD.TBL_PASAJEROAERONAVE); lOnSql.AddSet(CtesBD.FLD_PASAJEROAERONAVE_FK_AERONAVE_1, ONInt.Null); lOnSql.AddWhere(CtesBD.FLD_PASAJEROAERONAVE_FK_AERONAVE_1, oid.Id_AeronaveAttr); Execute(lOnSql); }
/// <summary> /// Gets a list with the arguments values. /// </summary> /// <param name="p_agrAeronaveArg">Value of the inbound argument 'p_agrAeronave'.</param> /// <param name="p_agrPasajeroArg">Value of the inbound argument 'p_agrPasajero'.</param> /// <param name="p_atrid_PasajeroAeronaveArg">Value of the inbound argument 'p_atrid_PasajeroAeronave'.</param> /// <param name="p_atrNombreAeronaveArg">Value of the inbound argument 'p_atrNombreAeronave'.</param> /// <param name="p_atrNombrePasajeroArg">Value of the inbound argument 'p_atrNombrePasajero'.</param> /// <returns>List of inbound arguments values.</returns> private static Dictionary <string, object> GetInputFieldValues(AeronaveOid p_agrAeronaveArg, PasajeroOid p_agrPasajeroArg, int?p_atrid_PasajeroAeronaveArg, string p_atrNombreAeronaveArg, string p_atrNombrePasajeroArg) { // Fill values dictionary. Dictionary <string, object> lValues = new Dictionary <string, object>(); lValues.Add("p_agrAeronave", p_agrAeronaveArg); lValues.Add("p_agrPasajero", p_agrPasajeroArg); lValues.Add("p_atrid_PasajeroAeronave", p_atrid_PasajeroAeronaveArg); lValues.Add("p_atrNombreAeronave", p_atrNombreAeronaveArg); lValues.Add("p_atrNombrePasajero", p_atrNombrePasajeroArg); return(lValues); }
/// <summary> /// Extracts the OID from the XML message and converts it in structures of the application /// </summary> /// <param name="xmlReader">XML with the request message</param> /// <param name="dtdVersion">Version of DTD that follows the XML message</param> public static AeronaveOid XML2ON(XmlReader xmlReader, double dtdVersion) { try { if (xmlReader.IsStartElement(ONXml.XMLTAG_NULL)) { xmlReader.Skip(); return(AeronaveXml.Null); } if (!xmlReader.IsStartElement(ONXml.XMLTAG_OID)) { throw new ONXMLStructureException(null, ONXml.XMLTAG_OID); } } catch (Exception e) { throw new ONXMLStructureException(e, ONXml.XMLTAG_OID); } string lClass = xmlReader.GetAttribute("Class"); if (string.Compare(lClass, "Aeronave", true) != 0) { throw new ONXMLOIDWrongClassException(null, "Clas_1348178411520734_Alias", "Aeronave", lClass); } AeronaveOid lOid = new AeronaveOid(); xmlReader.ReadStartElement(ONXml.XMLTAG_OID); try { lOid.Id_AeronaveAttr = ONXmlAutonumeric.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_OIDFIELD); } catch (Exception e) { throw new ONXMLOIDFieldException(e, "Clas_1348178411520734_Alias", "Aeronave", "Clas_1348178411520734Atr_1_Alias", "id_Aeronave"); } try { xmlReader.ReadEndElement(); } catch { throw new ONXMLStructureException(null, ONXml.XMLTAG_OID); } return(lOid); }
public PasajeroAeronaveInstance Create_instanceServ(AeronaveOid p_agrAeronaveArg, PasajeroOid p_agrPasajeroArg, ONInt p_atrid_PasajeroAeronaveArg, ONString p_atrNombreAeronaveArg, ONString p_atrNombrePasajeroArg) { // Create new context using (ONServiceContext lOnContext = new ONServiceContext(OnContext)) { // Call Executive PasajeroAeronaveExecutive lExecutive = new PasajeroAeronaveExecutive(); lExecutive.OnContext = lOnContext; lExecutive.Instance = Instance; Instance = lExecutive.Create_instanceServ(p_agrAeronaveArg, p_agrPasajeroArg, p_atrid_PasajeroAeronaveArg, p_atrNombreAeronaveArg, p_atrNombrePasajeroArg); } return(Instance); }
internal void Delete_instanceServ(AeronaveOid p_thisAeronaveArg) { if (Instance != null) { ONFilterList onfilt = new ONFilterList(); onfilt.Add("QueryByOid", new QueryByOidFilter(Instance.Oid)); Instance.Find(onfilt); } // Execute service AeronaveAction lAction = new AeronaveAction(OnContext); lAction.Instance = Instance; lAction.Delete_instanceServ(p_thisAeronaveArg); }
/// <summary> /// Converts an OID into XML in order to put it in XML message response /// </summary> /// <param name="xmlWriter">XML with the response message</param> /// <param name="oid">OID that will be insert into XML message</param> /// <param name="dtdVersion">Version of DTD that follows the XML message</param> /// <param name="xmlElement">Element in the XML message in order to convert in the right form of the XML</param> public static void ON2XML(XmlWriter xmlWriter, AeronaveOid oid, double dtdVersion, string xmlElement) { if (oid == null) { xmlWriter.WriteElementString(ONXml.XMLTAG_NULL, null); } else { xmlWriter.WriteStartElement(ONXml.XMLTAG_OID); xmlWriter.WriteAttributeString(ONXml.XMLATT_CLASS, "Aeronave"); ONXmlAutonumeric.ON2XML(xmlWriter, oid.Id_AeronaveAttr, dtdVersion, xmlElement); xmlWriter.WriteEndElement(); // OID } }
/// <summary> /// Method that solves the execution of 'delete_instance' service. /// </summary> /// <param name="agent">Application agent.</param> /// <param name="p_thisAeronaveArg">Value of the inbound argument 'p_thisAeronave'.</param> /// <returns>Outbound argument values.</returns> public static Dictionary <string, object> ExecuteService(Oid agent, List <Oid> p_thisAeronaveArg) { AeronaveOid lp_thisAeronave = null; if ((p_thisAeronaveArg != null) && (p_thisAeronaveArg.Count > 0) && (p_thisAeronaveArg[0] != null)) { lp_thisAeronave = (p_thisAeronaveArg[0] as AeronaveOid); } Dictionary <string, object> lValues = GetInputFieldValues(lp_thisAeronave); Dictionary <string, ModelType> lTypes = GetInboundArgumentTypes(); Dictionary <string, string> lDomains = GetInboundArgumentDomains(); Dictionary <string, object> lOutboundArguments = Logic.Adaptor.ExecuteService(agent, "Aeronave", "delete_instance", lTypes, lValues, lDomains); return(UtilFunctions.ProcessOutboundArgsList(lOutboundArguments)); }
/// <summary>Load the data retrieved from the Data Base to components of the application</summary> /// <param name="onContext">This parameter has the current context</param> /// <param name="oid">OID of the instance whose text attribute value is wanted to be loaded</param> public static ONText LoadTextNombre(ONContext onContext, AeronaveOid oid) { ONSqlSelect lOnSql = new ONSqlSelect(); lOnSql.CreateAlias(CtesBD.TBL_AERONAVE, null, "Aeronave"); lOnSql.AddSelect(CtesBD.FLD_AERONAVE_NOMBRE); FixInstance(lOnSql, null, null, oid); // Create Data Component AeronaveData lData = new AeronaveData(onContext); // Execute query ArrayList lSqlParameters; ONText lReturn = new ONText((string)lData.ExecuteScalar(lOnSql.GenerateSQL(out lSqlParameters), lSqlParameters)); return(lReturn); }
public void Delete_instanceServ(AeronaveOid p_thisAeronaveArg) { // Create new context using (ONServiceContext lOnContext = new ONServiceContext(OnContext)) { // Change to Transactional OnContext Instance.OnContext = lOnContext; // Call Executive AeronaveExecutive lExecutive = new AeronaveExecutive(); lExecutive.OnContext = lOnContext; lExecutive.Instance = Instance; lExecutive.Delete_instanceServ(p_thisAeronaveArg); // Change to Non-Transactional OnContext Instance.OnContext = OnContext; } }
/// <summary> /// Execute a query to retrieve a set of instances, without any condition. /// </summary> /// <param name="context">Current context.</param> /// <returns>A DataTable with the instances searched.</returns> public static DataTable ExecuteQueryPopulation(IUPopulationContext context) { // Last Oid AeronaveOid lLastOid = null; if (context.LastOids.Count > 0) { lLastOid = new AeronaveOid(context.LastOids.Peek()); } // Last Block bool lLastBlock = true; NavigationalFiltering navigationalFiltering = NavigationalFiltering.GetNavigationalFiltering(context); DataTable lDataTable = ExecuteQueryRelated(context.Agent, new Dictionary <string, Oid>(), context.DisplaySetAttributes, context.OrderCriteriaNameSelected, navigationalFiltering, lLastOid, context.BlockSize, ref lLastBlock); context.LastBlock = lLastBlock; return(lDataTable); }
internal PasajeroAeronaveInstance Create_instanceServ(AeronaveOid p_agrAeronaveArg, PasajeroOid p_agrPasajeroArg, ONInt p_atrid_PasajeroAeronaveArg, ONString p_atrNombreAeronaveArg, ONString p_atrNombrePasajeroArg) { if (Instance != null) { ONFilterList onfilt = new ONFilterList(); onfilt.Add("QueryByOid", new QueryByOidFilter(Instance.Oid)); Instance.Find(onfilt); } // Execute service PasajeroAeronaveAction lAction = new PasajeroAeronaveAction(OnContext); lAction.Instance = new PasajeroAeronaveInstance(OnContext); Instance = lAction.Create_instanceServ(p_agrAeronaveArg, p_agrPasajeroArg, p_atrid_PasajeroAeronaveArg, p_atrNombreAeronaveArg, p_atrNombrePasajeroArg); OnContext.OperationStack.Pop(); OnContext.OperationStack.Push(Instance); return(Instance); }
public void Delete_instanceServ( [ONInboundArgument("Clas_1348178411520734Ser_2Arg_1_Alias", AeronaveClassText.Delete_instance_P_thisAeronaveArgumentAlias, "", "Clas_1348178411520734Ser_2_Alias", AeronaveClassText.Delete_instanceServiceAlias, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias, AllowsNull = false)] AeronaveOid p_thisAeronaveArg) { try { AeronaveData lData = new AeronaveData(OnContext); // Static delete check if (Instance.PasajeroAeronaveRole.Count > 0) { throw new ONStaticException(null, AeronaveClassText.ClassAlias, "Clas_1348178411520734_Alias", AeronaveClassText.PasajeroAeronaveRoleAlias, "Agr_1348602167296130Rol_1_Alias"); } // Delete relationships { AeronaveData lDataRel = new AeronaveData(OnContext); lDataRel.PasajeroAeronaveRoleDelete(Instance.Oid); } // Delete instance lData.UpdateDeleted(Instance); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Aeronave, Service: delete_instance, Component: AeronaveAction, Method: Delete_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
/// <summary> /// Method that solves the execution of 'create_instance' service. /// </summary> /// <param name="agent">Application agent.</param> /// <param name="p_agrAeronaveArg">Value of the inbound argument 'p_agrAeronave'.</param> /// <param name="p_agrPasajeroArg">Value of the inbound argument 'p_agrPasajero'.</param> /// <param name="p_atrid_PasajeroAeronaveArg">Value of the inbound argument 'p_atrid_PasajeroAeronave'.</param> /// <param name="p_atrNombreAeronaveArg">Value of the inbound argument 'p_atrNombreAeronave'.</param> /// <param name="p_atrNombrePasajeroArg">Value of the inbound argument 'p_atrNombrePasajero'.</param> /// <returns>Outbound argument values.</returns> public static Dictionary <string, object> ExecuteService(Oid agent, List <Oid> p_agrAeronaveArg, List <Oid> p_agrPasajeroArg, int?p_atrid_PasajeroAeronaveArg, string p_atrNombreAeronaveArg, string p_atrNombrePasajeroArg) { AeronaveOid lp_agrAeronave = null; if ((p_agrAeronaveArg != null) && (p_agrAeronaveArg.Count > 0) && (p_agrAeronaveArg[0] != null)) { lp_agrAeronave = (p_agrAeronaveArg[0] as AeronaveOid); } PasajeroOid lp_agrPasajero = null; if ((p_agrPasajeroArg != null) && (p_agrPasajeroArg.Count > 0) && (p_agrPasajeroArg[0] != null)) { lp_agrPasajero = (p_agrPasajeroArg[0] as PasajeroOid); } Dictionary <string, object> lValues = GetInputFieldValues(lp_agrAeronave, lp_agrPasajero, p_atrid_PasajeroAeronaveArg, p_atrNombreAeronaveArg, p_atrNombrePasajeroArg); Dictionary <string, ModelType> lTypes = GetInboundArgumentTypes(); Dictionary <string, string> lDomains = GetInboundArgumentDomains(); Dictionary <string, object> lOutboundArguments = Logic.Adaptor.ExecuteService(agent, "PasajeroAeronave", "create_instance", lTypes, lValues, lDomains); return(UtilFunctions.ProcessOutboundArgsList(lOutboundArguments)); }
public override void Copy(ONInstance instance) { PasajeroAeronaveInstance linstance = instance as PasajeroAeronaveInstance; Oid = new PasajeroAeronaveOid(linstance.Oid); NombreAeronaveAttr = new ONString(linstance.NombreAeronaveAttr); NombrePasajeroAttr = new ONString(linstance.NombrePasajeroAttr); RevisionPasajeroRoleTemp = linstance.RevisionPasajeroRoleTemp; AeronaveRoleTemp = linstance.AeronaveRoleTemp; if (linstance.AeronaveRoleOidTemp != null) { AeronaveRoleOidTemp = new AeronaveOid(linstance.AeronaveRoleOidTemp); } PasajeroRoleTemp = linstance.PasajeroRoleTemp; if (linstance.PasajeroRoleOidTemp != null) { PasajeroRoleOidTemp = new PasajeroOid(linstance.PasajeroRoleOidTemp); } StateObj = new ONString(linstance.StateObj); base.Copy(instance); }
public override void Copy(ONInstance instance) { AeronaveInstance linstance = instance as AeronaveInstance; Oid = new AeronaveOid(linstance.Oid); if ((object)linstance.NombreAttrTemp != null) { NombreAttrTemp = new ONText(linstance.NombreAttrTemp); } else { NombreAttrTemp = null; } MaximoPasajerosAttr = new ONInt(linstance.MaximoPasajerosAttr); if ((object)linstance.OrigenAttrTemp != null) { OrigenAttrTemp = new ONText(linstance.OrigenAttrTemp); } else { OrigenAttrTemp = null; } if ((object)linstance.DestinoAttrTemp != null) { DestinoAttrTemp = new ONText(linstance.DestinoAttrTemp); } else { DestinoAttrTemp = null; } PasajeroAeronaveRoleTemp = linstance.PasajeroAeronaveRoleTemp; StateObj = new ONString(linstance.StateObj); base.Copy(instance); }
public void Edit_instanceServ(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, XmlWriter xmlWriter, double dtdVersion, string clientName) { // Process the service arguments ONServiceInfo lSInfo = new ONServiceInfo("Clas_1348178411520734Ser_3_Alias", AeronaveClassText.Edit_instanceServiceAlias, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias); lSInfo.AddOIDArgument("p_thisAeronave", false, "Aeronave", "Clas_1348178411520734Ser_3Arg_1_Alias", AeronaveClassText.Edit_instance_P_thisAeronaveArgumentAlias); try { lSInfo.XML2ON(xmlReader, dtdVersion, true); } catch (Exception e) { throw new ONServiceArgumentsException(e, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias, "Clas_1348178411520734Ser_3_Alias", AeronaveClassText.Edit_instanceServiceAlias); } AeronaveOid lP_thisAeronaveArg = (AeronaveOid)((ONArgumentInfo)lSInfo.mArgumentList["p_thisAeronave"]).Value; // Create Context ONServiceContext lOnContext = new ONServiceContext(); lOnContext.OidAgent = agentOid; // Execute Service AeronaveInstance lInstance = null; try { ONFilterList lFilterList = new ONFilterList(); AeronaveInstance lThisInstance = new AeronaveInstance(lOnContext); if (lP_thisAeronaveArg != null) { lFilterList = new ONFilterList(); lFilterList.Add("HorizontalVisibility", new AeronaveHorizontalVisibility()); lThisInstance = lP_thisAeronaveArg.GetInstance(lOnContext, lFilterList); if (lThisInstance == null) { throw new ONInstanceNotExistException(null, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias); } } using (AeronaveServer lServer = new AeronaveServer(lOnContext, lThisInstance)) { lServer.Edit_instanceServ(lP_thisAeronaveArg); lInstance = lServer.Instance; } ticket = lOnContext.GetTicket(dtdVersion, clientName); } catch (SecurityException) { throw new ONAccessAgentValidationException(null); } catch { throw; } // Write Oid if (dtdVersion >= 3.1) { if (lInstance != null) { ON2XML(xmlWriter, lInstance.Oid, dtdVersion, ONXml.XMLTAG_OIDFIELD); } } // Write Outbound Arguments xmlWriter.WriteStartElement("Arguments"); // Write Outbound Arguments xmlWriter.WriteEndElement(); // Arguments }
/// <summary>This method adds to the SQL statement the part that fixes the instance</summary> /// <param name="onSql">This parameter has the current SQL statement</param> /// <param name="onPath">Path to add to SQL statement</param> /// <param name="processedOnPath">Path pocessed until the call of this method</param> /// <param name="oid">OID to fix the instance in the SQL statement</param> /// <param name="isLinkedTo">The alias belongs to a role in a linked To element</param> public static void FixInstance(ONSqlSelect onSql, ONPath onPath, ONPath processedOnPath, AeronaveOid oid, bool isLinkedTo) { if ((onPath != null) && (string.Compare(onPath.Path, "agent", true) == 0)) { if (onSql.GetParameter("agent") == null) { string lAlias = AddPath(onSql, JoinType.InnerJoin, "Aeronave", onPath, processedOnPath, "Aeronave", false, isLinkedTo); onSql.AddWhere(lAlias + "." + CtesBD.FLD_AERONAVE_ID_AERONAVE + " = ?"); onSql.AddWhereParameter("agent", oid.Id_AeronaveAttr); } } else { string lAlias = AddPath(onSql, JoinType.InnerJoin, "Aeronave", onPath, processedOnPath, "", false, isLinkedTo); onSql.AddWhere(lAlias + "." + CtesBD.FLD_AERONAVE_ID_AERONAVE + " = ?"); onSql.AddWhereParameter("", oid.Id_AeronaveAttr); } }
/// <summary>This method adds to the SQL statement the part that fixes the instance</summary> /// <param name="onSql">This parameter has the current SQL statement</param> /// <param name="onPath">Path to add to SQL statement</param> /// <param name="processedOnPath">Path pocessed until the call of this method</param> /// <param name="oid">OID to fix the instance in the SQL statement</param> public static void FixInstance(ONSqlSelect onSql, ONPath onPath, ONPath processedOnPath, AeronaveOid oid) { FixInstance(onSql, onPath, processedOnPath, oid, false); }
/// <summary> /// Execute a query to retrieve a set of instances, without any condition. /// </summary> /// <param name="agent">Application agent.</param> /// <param name="displaySet">List of attributes to return.</param> /// <param name="orderCriteria">Order criteria name.</param> /// <param name="lastOid">Oid from which to search (not included).</param> /// <param name="blockSize">Number of instances to return (0 for all population).</param> /// <returns>A DataTable with the instances searched.</returns> public static DataTable ExecuteQueryPopulation(Oid agent, string displaySet, string orderCriteria, AeronaveOid lastOid, int blockSize, ref bool lastBlock) { return(ExecuteQueryRelated(agent, new Dictionary <string, Oid>(), displaySet, orderCriteria, lastOid, blockSize, ref lastBlock)); }
/// <summary> /// Execute a query related with other instance. /// </summary> /// <param name="context">Current context.</param> /// <returns>A DataTable with the instances searched.</returns> public static DataTable ExecuteQueryRelated(IUQueryContext context) { try { ExchangeInfo lExchangeInfo = context.ExchangeInformation; if (lExchangeInfo.ExchangeType != ExchangeType.Navigation || lExchangeInfo.SelectedOids.Count == 0) { return(null); } IUPopulationContext lIUContext = context as IUPopulationContext; int blockSize = 1; if (lIUContext != null) { blockSize = lIUContext.BlockSize; } ExchangeInfoNavigation lNavInfo = lExchangeInfo as ExchangeInfoNavigation; // Specific case. No role name indicates Query by Instance. if (lNavInfo.RolePath == "") { if (lIUContext != null) { lIUContext.LastBlock = true; } AeronaveOid lOidInstance = new AeronaveOid(lNavInfo.SelectedOids[0]); return(ExecuteQueryInstance(context.Agent, lOidInstance, context.DisplaySetAttributes)); } // Get link items. Oid lOid = lNavInfo.SelectedOids[0]; Dictionary <string, Oid> lLinkItems = new Dictionary <string, Oid>(StringComparer.CurrentCultureIgnoreCase); lLinkItems.Add(lNavInfo.RolePath, lOid); bool lLastBlock = true; AeronaveOid lLastOid = null; string lOrderCriteria = string.Empty; // Get population members. if (lIUContext != null) { if (lIUContext.LastOid != null) { lLastOid = new AeronaveOid(lIUContext.LastOid); } lOrderCriteria = lIUContext.OrderCriteriaNameSelected; } NavigationalFiltering navigationalFiltering = NavigationalFiltering.GetNavigationalFiltering(context); DataTable lDataTable = ExecuteQueryRelated(context.Agent, lLinkItems, context.DisplaySetAttributes, lOrderCriteria, navigationalFiltering, lLastOid, blockSize, ref lLastBlock); if (lIUContext != null) { lIUContext.LastBlock = lLastBlock; } return(lDataTable); } catch (Exception e) { ScenarioManager.LaunchErrorScenario(e); return(null); } }
/// <summary> /// Execute a query related with other instance. /// </summary> /// <param name="agent">Application agent.</param> /// <param name="linkItems">List of related instance oids (path - role).</param> /// <param name="displaySet">List of attributes to return.</param> /// <param name="orderCriteria">Order criteria name.</param> /// <param name="lastOid">Oid from which to search (not included).</param> /// <param name="blockSize">Number of instances to return (0 for all population).</param> /// <param name="lastBlock">Return it is last block.</param> /// <returns>A DataTable with the instances searched.</returns> public static DataTable ExecuteQueryRelated(Oid agent, Dictionary <string, Oid> linkItems, string displaySet, string orderCriteria, AeronaveOid lastOid, int blockSize, ref bool lastBlock) { DataTable lDataTable = Logic.Adaptor.ExecuteQueryRelated(agent, "Aeronave", linkItems, displaySet, orderCriteria, lastOid, blockSize); // Last block. if (lDataTable.ExtendedProperties.Contains("LastBlock")) { lastBlock = (bool)lDataTable.ExtendedProperties["LastBlock"]; } else { lastBlock = false; } return(lDataTable); }
/// <summary> /// Execute a query to retrieve an instance. /// </summary> /// <param name="agent">Application agent.</param> /// <param name="oid">Specific 'AeronaveOid' Oid of the instance to be searched.</param> /// <param name="displaySet">Display set that will be retrieved.</param> /// <returns>A DataTable with the instance searched.</returns> public static DataTable ExecuteQueryInstance(Oid agent, AeronaveOid oid, string displaySet) { return(Logic.Adaptor.ExecuteQueryInstance(agent, "Aeronave", string.Empty, oid, displaySet)); }
/// <summary>Load the data retrieved from the Data Base to components of the application</summary> /// <param name="onContext">This parameter has the current context</param> /// <param name="oid">OID of the instance whose text attribute value is wanted to be loaded</param> public static ONText LoadTextOrigen(ONContext onContext, AeronaveOid oid) { return(AeronaveData.LoadTextOrigen(onContext, oid)); }
/// <summary>Load the data retrieved from the Data Base to components of the application</summary> /// <param name="onContext">This parameter has the current context</param> /// <param name="oid">OID of the instance whose text attribute value is wanted to be loaded</param> public static ONText LoadTextDestino(ONContext onContext, AeronaveOid oid) { return(AeronaveData.LoadTextDestino(onContext, oid)); }