public void Edit_instanceServ( [ONInboundArgument("Clas_1347649273856884Ser_3Arg_1_Alias", NaveNodrizaClassText.Edit_instance_P_thisNaveNodrizaArgumentAlias, "", "Clas_1347649273856884Ser_3_Alias", NaveNodrizaClassText.Edit_instanceServiceAlias, "Clas_1347649273856884_Alias", NaveNodrizaClassText.ClassAlias, AllowsNull = false)] NaveNodrizaOid p_thisNaveNodrizaArg) { try { } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: NaveNodriza, Service: edit_instance, Component: NaveNodrizaAction, Method: Edit_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
public void Delete_instanceServ( [ONInboundArgument("Clas_1347649273856884Ser_2Arg_1_Alias", NaveNodrizaClassText.Delete_instance_P_thisNaveNodrizaArgumentAlias, "", "Clas_1347649273856884Ser_2_Alias", NaveNodrizaClassText.Delete_instanceServiceAlias, "Clas_1347649273856884_Alias", NaveNodrizaClassText.ClassAlias, AllowsNull = false)] NaveNodrizaOid p_thisNaveNodrizaArg) { try { NaveNodrizaData lData = new NaveNodrizaData(OnContext); // Delete instance lData.UpdateDeleted(Instance); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: NaveNodriza, Service: delete_instance, Component: NaveNodrizaAction, Method: Delete_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
/// <summary> /// Gets a list with the arguments values. /// </summary> /// <param name="p_thisNaveNodrizaArg">Value of the inbound argument 'p_thisNaveNodriza'.</param> /// <returns>List of inbound arguments values.</returns> private static Dictionary <string, object> GetInputFieldValues(NaveNodrizaOid p_thisNaveNodrizaArg) { // Fill values dictionary. Dictionary <string, object> lValues = new Dictionary <string, object>(); lValues.Add("p_thisNaveNodriza", p_thisNaveNodrizaArg); return(lValues); }
/// <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) { NaveNodrizaOid lOid = null; if (context.ExchangeInformation != null && context.ExchangeInformation.SelectedOids.Count > 0) { lOid = new NaveNodrizaOid(context.ExchangeInformation.SelectedOids[0]); } return(ExecuteQueryInstance(context.Agent, lOid, context.DisplaySetAttributes)); }
public override void Copy(ONInstance instance) { NaveNodrizaInstance linstance = instance as NaveNodrizaInstance; Oid = new NaveNodrizaOid(linstance.Oid); Nombre_NaveNodrizaAttr = new ONString(linstance.Nombre_NaveNodrizaAttr); StateObj = new ONString(linstance.StateObj); base.Copy(instance); }
/// <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 NaveNodrizaOid XML2ON(XmlReader xmlReader, double dtdVersion) { try { if (xmlReader.IsStartElement(ONXml.XMLTAG_NULL)) { xmlReader.Skip(); return(NaveNodrizaXml.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, "NaveNodriza", true) != 0) { throw new ONXMLOIDWrongClassException(null, "Clas_1347649273856884_Alias", "NaveNodriza", lClass); } NaveNodrizaOid lOid = new NaveNodrizaOid(); xmlReader.ReadStartElement(ONXml.XMLTAG_OID); try { lOid.Id_NaveNodrizaAttr = ONXmlAutonumeric.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_OIDFIELD); } catch (Exception e) { throw new ONXMLOIDFieldException(e, "Clas_1347649273856884_Alias", "NaveNodriza", "Clas_1347649273856884Atr_1_Alias", "id_NaveNodriza"); } try { xmlReader.ReadEndElement(); } catch { throw new ONXMLStructureException(null, ONXml.XMLTAG_OID); } return(lOid); }
internal void Delete_instanceServ(NaveNodrizaOid p_thisNaveNodrizaArg) { if (Instance != null) { ONFilterList onfilt = new ONFilterList(); onfilt.Add("QueryByOid", new QueryByOidFilter(Instance.Oid)); Instance.Find(onfilt); } // Execute service NaveNodrizaAction lAction = new NaveNodrizaAction(OnContext); lAction.Instance = Instance; lAction.Delete_instanceServ(p_thisNaveNodrizaArg); }
/// <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, NaveNodrizaOid 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, "NaveNodriza"); ONXmlAutonumeric.ON2XML(xmlWriter, oid.Id_NaveNodrizaAttr, 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_thisNaveNodrizaArg">Value of the inbound argument 'p_thisNaveNodriza'.</param> /// <returns>Outbound argument values.</returns> public static Dictionary <string, object> ExecuteService(Oid agent, List <Oid> p_thisNaveNodrizaArg) { NaveNodrizaOid lp_thisNaveNodriza = null; if ((p_thisNaveNodrizaArg != null) && (p_thisNaveNodrizaArg.Count > 0) && (p_thisNaveNodrizaArg[0] != null)) { lp_thisNaveNodriza = (p_thisNaveNodrizaArg[0] as NaveNodrizaOid); } Dictionary <string, object> lValues = GetInputFieldValues(lp_thisNaveNodriza); Dictionary <string, ModelType> lTypes = GetInboundArgumentTypes(); Dictionary <string, string> lDomains = GetInboundArgumentDomains(); Dictionary <string, object> lOutboundArguments = Logic.Adaptor.ExecuteService(agent, "NaveNodriza", "delete_instance", lTypes, lValues, lDomains); return(UtilFunctions.ProcessOutboundArgsList(lOutboundArguments)); }
public void Delete_instanceServ(NaveNodrizaOid p_thisNaveNodrizaArg) { // Create new context using (ONServiceContext lOnContext = new ONServiceContext(OnContext)) { // Change to Transactional OnContext Instance.OnContext = lOnContext; // Call Executive NaveNodrizaExecutive lExecutive = new NaveNodrizaExecutive(); lExecutive.OnContext = lOnContext; lExecutive.Instance = Instance; lExecutive.Delete_instanceServ(p_thisNaveNodrizaArg); // 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 NaveNodrizaOid lLastOid = null; if (context.LastOids.Count > 0) { lLastOid = new NaveNodrizaOid(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); }
/// <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, NaveNodrizaOid lastOid, int blockSize, ref bool lastBlock) { return(ExecuteQueryRelated(agent, new Dictionary <string, Oid>(), displaySet, orderCriteria, lastOid, blockSize, ref lastBlock)); }
/// <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, NaveNodrizaOid oid) { FixInstance(onSql, onPath, processedOnPath, oid, false); }
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_1347649273856884Ser_3_Alias", NaveNodrizaClassText.Edit_instanceServiceAlias, "Clas_1347649273856884_Alias", NaveNodrizaClassText.ClassAlias); lSInfo.AddOIDArgument("p_thisNaveNodriza", false, "NaveNodriza", "Clas_1347649273856884Ser_3Arg_1_Alias", NaveNodrizaClassText.Edit_instance_P_thisNaveNodrizaArgumentAlias); try { lSInfo.XML2ON(xmlReader, dtdVersion, true); } catch (Exception e) { throw new ONServiceArgumentsException(e, "Clas_1347649273856884_Alias", NaveNodrizaClassText.ClassAlias, "Clas_1347649273856884Ser_3_Alias", NaveNodrizaClassText.Edit_instanceServiceAlias); } NaveNodrizaOid lP_thisNaveNodrizaArg = (NaveNodrizaOid)((ONArgumentInfo)lSInfo.mArgumentList["p_thisNaveNodriza"]).Value; // Create Context ONServiceContext lOnContext = new ONServiceContext(); lOnContext.OidAgent = agentOid; // Execute Service NaveNodrizaInstance lInstance = null; try { ONFilterList lFilterList = new ONFilterList(); NaveNodrizaInstance lThisInstance = new NaveNodrizaInstance(lOnContext); if (lP_thisNaveNodrizaArg != null) { lFilterList = new ONFilterList(); lFilterList.Add("HorizontalVisibility", new NaveNodrizaHorizontalVisibility()); lThisInstance = lP_thisNaveNodrizaArg.GetInstance(lOnContext, lFilterList); if (lThisInstance == null) { throw new ONInstanceNotExistException(null, "Clas_1347649273856884_Alias", NaveNodrizaClassText.ClassAlias); } } using (NaveNodrizaServer lServer = new NaveNodrizaServer(lOnContext, lThisInstance)) { lServer.Edit_instanceServ(lP_thisNaveNodrizaArg); 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> /// Execute a query to retrieve an instance. /// </summary> /// <param name="agent">Application agent.</param> /// <param name="oid">Specific 'NaveNodrizaOid' 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, NaveNodrizaOid oid, string displaySet) { return(Logic.Adaptor.ExecuteQueryInstance(agent, "NaveNodriza", string.Empty, oid, displaySet)); }
/// <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, NaveNodrizaOid oid, bool isLinkedTo) { if ((onPath != null) && (string.Compare(onPath.Path, "agent", true) == 0)) { if (onSql.GetParameter("agent") == null) { string lAlias = AddPath(onSql, JoinType.InnerJoin, "NaveNodriza", onPath, processedOnPath, "NaveNodriza", false, isLinkedTo); onSql.AddWhere(lAlias + "." + CtesBD.FLD_NAVENODRIZA_ID_NAVENODRIZA + " = ?"); onSql.AddWhereParameter("agent", oid.Id_NaveNodrizaAttr); } } else { string lAlias = AddPath(onSql, JoinType.InnerJoin, "NaveNodriza", onPath, processedOnPath, "", false, isLinkedTo); onSql.AddWhere(lAlias + "." + CtesBD.FLD_NAVENODRIZA_ID_NAVENODRIZA + " = ?"); onSql.AddWhereParameter("", oid.Id_NaveNodrizaAttr); } }
/// <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, NaveNodrizaOid lastOid, int blockSize, ref bool lastBlock) { DataTable lDataTable = Logic.Adaptor.ExecuteQueryRelated(agent, "NaveNodriza", 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 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; } NaveNodrizaOid lOidInstance = new NaveNodrizaOid(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; NaveNodrizaOid lLastOid = null; string lOrderCriteria = string.Empty; // Get population members. if (lIUContext != null) { if (lIUContext.LastOid != null) { lLastOid = new NaveNodrizaOid(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>Default Constructor</summary> public NaveNodrizaInstance(ONContext onContext) : base(onContext, "NaveNodriza", "Clas_1347649273856884_Alias") { Oid = new NaveNodrizaOid(); Nombre_NaveNodrizaAttr = ONString.Null; StateObjAttrTemp = null; }