public PasajeroInstance Create_instanceServ(PasajeroAeronaveOid p_agrPasajeroAeronaveArg, ONInt p_atrid_PasajeroArg, ONText p_atrNombreArg) { // Create new context using (ONServiceContext lOnContext = new ONServiceContext(OnContext)) { // Call Executive PasajeroExecutive lExecutive = new PasajeroExecutive(); lExecutive.OnContext = lOnContext; lExecutive.Instance = Instance; Instance = lExecutive.Create_instanceServ(p_agrPasajeroAeronaveArg, p_atrid_PasajeroArg, p_atrNombreArg); } return Instance; }
internal PasajeroInstance Create_instanceServ(PasajeroAeronaveOid p_agrPasajeroAeronaveArg, ONInt p_atrid_PasajeroArg, ONText p_atrNombreArg) { if (Instance != null) { ONFilterList onfilt = new ONFilterList(); onfilt.Add("QueryByOid", new QueryByOidFilter(Instance.Oid)); Instance.Find(onfilt); } // Execute service PasajeroAction lAction = new PasajeroAction(OnContext); lAction.Instance = new PasajeroInstance(OnContext); Instance = lAction.Create_instanceServ(p_agrPasajeroAeronaveArg, p_atrid_PasajeroArg, p_atrNombreArg); OnContext.OperationStack.Pop(); OnContext.OperationStack.Push(Instance); return Instance; }
public override void Copy(ONInstance instance) { PasajeroInstance linstance = instance as PasajeroInstance; Oid = new PasajeroOid(linstance.Oid); if ((object)linstance.NombreAttrTemp != null) { NombreAttrTemp = new ONText(linstance.NombreAttrTemp); } else { NombreAttrTemp = 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_1348178542592658Ser_3_Alias", PasajeroClassText.Edit_instanceServiceAlias, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias); lSInfo.AddOIDArgument("p_thisPasajero", false, "Pasajero", "Clas_1348178542592658Ser_3Arg_1_Alias", PasajeroClassText.Edit_instance_P_thisPasajeroArgumentAlias); try { lSInfo.XML2ON(xmlReader, dtdVersion, true); } catch (Exception e) { throw new ONServiceArgumentsException(e, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias, "Clas_1348178542592658Ser_3_Alias", PasajeroClassText.Edit_instanceServiceAlias); } PasajeroOid lP_thisPasajeroArg = (PasajeroOid) ((ONArgumentInfo) lSInfo.mArgumentList["p_thisPasajero"]).Value; // Create Context ONServiceContext lOnContext = new ONServiceContext(); lOnContext.OidAgent = agentOid; // Execute Service PasajeroInstance lInstance = null; try { ONFilterList lFilterList = new ONFilterList(); PasajeroInstance lThisInstance = new PasajeroInstance(lOnContext); if (lP_thisPasajeroArg != null) { lFilterList = new ONFilterList(); lFilterList.Add("HorizontalVisibility", new PasajeroHorizontalVisibility()); lThisInstance = lP_thisPasajeroArg.GetInstance(lOnContext, lFilterList); if (lThisInstance == null) throw new ONInstanceNotExistException(null, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias); } using (PasajeroServer lServer = new PasajeroServer(lOnContext, lThisInstance)) { lServer.Edit_instanceServ(lP_thisPasajeroArg); 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 }
protected override ONInstance InhGetInstance(ONContext onContext, ONFilterList onFilterList) { // Add oid filter to the list ONFilterList lOnFilterList = new ONFilterList(onFilterList); lOnFilterList.Add("QueryByOid", new QueryByOidFilter(this)); // Search Instance ONInstance lInstance = new PasajeroInstance(onContext); lInstance.Oid = this; lInstance = lInstance.Find(lOnFilterList); if (lInstance == null) lInstance = new PasajeroInstance(onContext); return lInstance; }
public void Create_instanceServ(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, XmlWriter xmlWriter, double dtdVersion, string clientName) { // Process the service arguments ONServiceInfo lSInfo = new ONServiceInfo("Clas_1348178542592177Ser_1_Alias", PasajeroAeronaveClassText.Create_instanceServiceAlias, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias); lSInfo.AddOIDArgument("p_agrAeronave", true, "Aeronave", "Clas_1348178542592177Ser_1Arg_5_Alias", PasajeroAeronaveClassText.Create_instance_P_agrAeronaveArgumentAlias); lSInfo.AddOIDArgument("p_agrPasajero", true, "Pasajero", "Clas_1348178542592177Ser_1Arg_6_Alias", PasajeroAeronaveClassText.Create_instance_P_agrPasajeroArgumentAlias); lSInfo.AddDataValuedArgument("p_atrid_PasajeroAeronave", false, DataTypeEnumerator.Autonumeric, 0, "Clas_1348178542592177Ser_1Arg_1_Alias", PasajeroAeronaveClassText.Create_instance_P_atrid_PasajeroAeronaveArgumentAlias); lSInfo.AddDataValuedArgument("p_atrNombreAeronave", false, DataTypeEnumerator.String, 100, "Clas_1348178542592177Ser_1Arg_8_Alias", PasajeroAeronaveClassText.Create_instance_P_atrNombreAeronaveArgumentAlias); lSInfo.AddDataValuedArgument("p_atrNombrePasajero", false, DataTypeEnumerator.String, 100, "Clas_1348178542592177Ser_1Arg_9_Alias", PasajeroAeronaveClassText.Create_instance_P_atrNombrePasajeroArgumentAlias); try { lSInfo.XML2ON(xmlReader, dtdVersion, true); } catch (Exception e) { throw new ONServiceArgumentsException(e, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias, "Clas_1348178542592177Ser_1_Alias", PasajeroAeronaveClassText.Create_instanceServiceAlias); } AeronaveOid lP_agrAeronaveArg = (AeronaveOid) ((ONArgumentInfo) lSInfo.mArgumentList["p_agrAeronave"]).Value; PasajeroOid lP_agrPasajeroArg = (PasajeroOid) ((ONArgumentInfo) lSInfo.mArgumentList["p_agrPasajero"]).Value; ONInt lP_atrid_PasajeroAeronaveArg = (ONInt) ((ONArgumentInfo) lSInfo.mArgumentList["p_atrid_PasajeroAeronave"]).Value; ONString lP_atrNombreAeronaveArg = (ONString) ((ONArgumentInfo) lSInfo.mArgumentList["p_atrNombreAeronave"]).Value; ONString lP_atrNombrePasajeroArg = (ONString) ((ONArgumentInfo) lSInfo.mArgumentList["p_atrNombrePasajero"]).Value; // Create Context ONServiceContext lOnContext = new ONServiceContext(); lOnContext.OidAgent = agentOid; // Execute Service PasajeroAeronaveInstance lInstance = null; try { ONFilterList lFilterList = new ONFilterList(); AeronaveInstance lp_agrAeronaveInstance = new AeronaveInstance(lOnContext); if (lP_agrAeronaveArg != null) { lFilterList = new ONFilterList(); lFilterList.Add("HorizontalVisibility", new AeronaveHorizontalVisibility()); lp_agrAeronaveInstance = lP_agrAeronaveArg.GetInstance(lOnContext, lFilterList); if (lp_agrAeronaveInstance == null) throw new ONInstanceNotExistException(null, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias); } PasajeroInstance lp_agrPasajeroInstance = new PasajeroInstance(lOnContext); if (lP_agrPasajeroArg != null) { lFilterList = new ONFilterList(); lFilterList.Add("HorizontalVisibility", new PasajeroHorizontalVisibility()); lp_agrPasajeroInstance = lP_agrPasajeroArg.GetInstance(lOnContext, lFilterList); if (lp_agrPasajeroInstance == null) throw new ONInstanceNotExistException(null, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias); } using (PasajeroAeronaveServer lServer = new PasajeroAeronaveServer(lOnContext, null)) { lServer.Create_instanceServ(lP_agrAeronaveArg,lP_agrPasajeroArg,lP_atrid_PasajeroAeronaveArg,lP_atrNombreAeronaveArg,lP_atrNombrePasajeroArg); 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> /// Constructor /// </summary> /// <param name="onContext">This parameter has the current context</param> /// <param name="instance">This parameter has the instance that exectues the service</param> public PasajeroServer(ONServiceContext onContext, PasajeroInstance instance) : base(onContext, instance, "Pasajero") { }
///<summary> This method adds the order criteria to the SQL statement </summary> ///<param name = "onSql"> This parameter represents the SQL component </param> ///<param name = "comparer"> This parameter has all the information refering to the order criteria to add to SQL statement</param> /// <param name="startRowOid">This parameter has the OID necessary to start the search</param> /// <param name="blockSize">This parameter represents the number of instances to be returned</param> protected override void AddOrderCriteria(ONSqlSelect onSql, ONOrderCriteria comparer, ONOid startRowOid, int blockSize, ONPath initialPath) { //Initilizate StartRow PasajeroInstance lInstance = null; if (startRowOid != null) { lInstance = new PasajeroInstance(OnContext); lInstance.Oid = startRowOid as PasajeroOid; } //Default OrderCriteria if (comparer == null) { string lAlias = onSql.GetAlias("Pasajero", initialPath); if (lInstance != null) { onSql.AddOrderBy(lAlias, CtesBD.FLD_PASAJERO_ID_PASAJERO, OrderByTypeEnumerator.Asc, lInstance.Oid.Id_PasajeroAttr); } else { onSql.AddOrderBy(lAlias, CtesBD.FLD_PASAJERO_ID_PASAJERO, OrderByTypeEnumerator.Asc, null); } return; } //Add OrderCriteria bool lUseStartRow = (!comparer.InMemory); foreach (ONOrderCriteriaItem lOrderCriteriaItem in comparer.OrderCriteriaSqlItem) { ONPath lPath = new ONPath(lOrderCriteriaItem.OnPath); if((lInstance != null) && (lUseStartRow)) { ONSimpleType lAttrStartRow = null; if (lPath.Path == "") lAttrStartRow = lInstance[lOrderCriteriaItem.Attribute] as ONSimpleType; else { ONCollection lCollection = (lInstance[lPath.Path] as ONCollection); if((lCollection != null) && (lCollection.Count > 0)) lAttrStartRow = lCollection[0][lOrderCriteriaItem.Attribute] as ONSimpleType; } onSql.AddOrderBy(PasajeroData.AddPath(onSql, JoinType.LeftJoin, lOrderCriteriaItem.Facet, lPath, null, lOrderCriteriaItem.DomainArgument, false), lOrderCriteriaItem.Attribute, lOrderCriteriaItem.Type, lAttrStartRow); lUseStartRow = (lAttrStartRow != null); } else onSql.AddOrderBy(PasajeroData.AddPath(onSql, JoinType.LeftJoin, lOrderCriteriaItem.Facet, lPath, null, lOrderCriteriaItem.DomainArgument, false), lOrderCriteriaItem.Attribute, lOrderCriteriaItem.Type, null); } return; }
/// <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="columns">This parameter has the data collected from the database</param> /// <param name="index">This parameter has the position of the first data to fix in the application</param> public static PasajeroInstance LoadFacet(ONContext onContext, ONDisplaySet displaySet, object[] columns, ref int index) { PasajeroInstance lInstance = new PasajeroInstance(onContext); lInstance.Oid = new PasajeroOid(); // Field 'id_Pasajero' lInstance.Oid.Id_PasajeroAttr = new ONInt(Convert.ToInt32(columns[index++])); lInstance.StateObj = new ONString(((string) columns[index++]).TrimEnd()); lInstance.Lmd = new ONDateTime((DateTime) columns[index++]); if ((displaySet != null) && (displaySet.Contains("Nombre"))) { lInstance.NombreAttr = new ONText((string) columns[index++]); } lInstance.Modified = false; return lInstance; }