public void SetPasswordServ( [ONInboundArgument("Clas_1348605050880238Ser_4Arg_1_Alias", AdministradorClassText.SetPassword_P_thisAdministradorArgumentAlias, "", "Clas_1348605050880238Ser_4_Alias", AdministradorClassText.SetPasswordServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, AllowsNull = false)] AdministradorOid p_thisAdministradorArg, [ONInboundArgument("Clas_1348605050880238Ser_4Arg_2_Alias", AdministradorClassText.SetPassword_P_NewPasswordArgumentAlias, "password", "Clas_1348605050880238Ser_4_Alias", AdministradorClassText.SetPasswordServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, Length = AdministradorXml.LENGTHPASSWORDADMINISTRADOR, AllowsNull = false)] ONString p_NewPasswordArg) { try { //Cipher password argument ONString lPassword = new ONString(ONSecureControl.CipherPassword(p_NewPasswordArg.TypedValue)); //Update Attribute Instance.PassWordAttr = lPassword; } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Administrador, Service: setPassword, Component: AdministradorAction, Method: SetPasswordServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
public void Edit_instanceServ( [ONInboundArgument("Clas_1348605050880238Ser_3Arg_1_Alias", AdministradorClassText.Edit_instance_P_thisAdministradorArgumentAlias, "", "Clas_1348605050880238Ser_3_Alias", AdministradorClassText.Edit_instanceServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, AllowsNull = false)] AdministradorOid p_thisAdministradorArg) { try { } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Administrador, Service: edit_instance, Component: AdministradorAction, Method: Edit_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
/// <summary> /// Retrieve all the instances of a determinate class that fulfil a determinate formula of searching /// </summary> /// <param name="linkedTo">List to reach the class to retrieve the related instance</param> /// <param name="filters">Formula to search concrete instances</param> /// <param name="comparer">Order Criteria that must be followed by the query</param> /// <param name="startRowOid">OID frontier</param> /// <param name="blockSize">Number of instances to be returned</param> /// <returns>Instances that check the filter list</returns> protected virtual ONCollection SolveQuery(ONLinkedToList linkedTo, ONFilterList onFilterList, ONDisplaySet displaySet, ONOrderCriteria comparer, ONOid startRowOid, int blockSize) { ONSqlSelect lOnSql = new ONSqlSelect(); try { // Create select and first table InhRetrieveInstances(lOnSql, displaySet, null, OnContext); // Fix related instance if (!AddLinkedTo(lOnSql, linkedTo)) { return(ONContext.GetComponent_Collection(ClassName, OnContext)); } // Add filter formula if (onFilterList != null) { onFilterList.FilterInData(lOnSql, this); } // Retrieve query instance number int lTotalNumInstances = -1; if (OnContext.CalculateQueryInstancesNumber) { if ((onFilterList == null) || (!onFilterList.InMemory)) { ArrayList lSqlParameters; string lNumInstancesSqlSentence = ONSqlSelect.GenerateSQLAsCount(lOnSql, out lSqlParameters); lTotalNumInstances = Convert.ToInt32(ExecuteScalar(lNumInstancesSqlSentence, lSqlParameters)); } OnContext.CalculateQueryInstancesNumber = false; } // OrderCriteria AddOrderCriteria(lOnSql, comparer, startRowOid, blockSize); // Execute ONCollection lONCollection = ExecuteSql(lOnSql, onFilterList, displaySet, comparer, startRowOid, blockSize); // Set Query instance number if (lTotalNumInstances > -1) { lONCollection.totalNumInstances = lTotalNumInstances; } return(lONCollection); } catch (Exception e) { string ltraceItem = "Method: SolveQuery, Component: ONDBData"; 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_1348178542592177Ser_2Arg_1_Alias", PasajeroAeronaveClassText.Delete_instance_P_thisPasajeroAeronaveArgumentAlias, "", "Clas_1348178542592177Ser_2_Alias", PasajeroAeronaveClassText.Delete_instanceServiceAlias, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias, AllowsNull = false)] PasajeroAeronaveOid p_thisPasajeroAeronaveArg) { try { PasajeroAeronaveData lData = new PasajeroAeronaveData(OnContext); #region Cardinality check for role 'Aeronave' // Minimum cardinality check (inverse) if (Instance.AeronaveRole.Count > 0) { throw new ONMinCardinalityException(null, AeronaveClassText.ClassAlias, "Clas_1348178411520734_Alias", AeronaveClassText.PasajeroAeronaveRoleAlias, "Agr_1348602167296130Rol_1_Alias", 1); } #endregion Cardinality check for role 'Aeronave' #region Cardinality check for role 'Pasajero' // Minimum cardinality check (inverse) if (Instance.PasajeroRole.Count > 0) { throw new ONMinCardinalityException(null, PasajeroClassText.ClassAlias, "Clas_1348178542592658_Alias", PasajeroClassText.PasajeroAeronaveRoleAlias, "Agr_1348602429440718Rol_1_Alias", 1); } #endregion Cardinality check for role 'Pasajero' #region Cardinality check for role 'RevisionPasajero' // Minimum cardinality check (inverse) if (Instance.RevisionPasajeroRole.Count > 0) { throw new ONMinCardinalityException(null, RevisionPasajeroClassText.ClassAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.PasajeroAeronaveRoleAlias, "Agr_1348602167296649Rol_2_Alias", 1); } #endregion Cardinality check for role 'RevisionPasajero' // Delete relationships { PasajeroAeronaveData lDataRel = new PasajeroAeronaveData(OnContext); lDataRel.RevisionPasajeroRoleDelete(Instance.Oid); } // Delete instance lData.UpdateDeleted(Instance); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: PasajeroAeronave, Service: delete_instance, Component: PasajeroAeronaveAction, Method: Delete_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_1348605050880238Ser_2Arg_1_Alias", AdministradorClassText.Delete_instance_P_thisAdministradorArgumentAlias, "", "Clas_1348605050880238Ser_2_Alias", AdministradorClassText.Delete_instanceServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, AllowsNull = false)] AdministradorOid p_thisAdministradorArg) { try { AdministradorData lData = new AdministradorData(OnContext); // Delete instance lData.UpdateDeleted(Instance); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Administrador, Service: delete_instance, Component: AdministradorAction, Method: Delete_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
public void Edit_instanceServ( [ONInboundArgument("Clas_1348178542592658Ser_3Arg_1_Alias", PasajeroClassText.Edit_instance_P_thisPasajeroArgumentAlias, "", "Clas_1348178542592658Ser_3_Alias", PasajeroClassText.Edit_instanceServiceAlias, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias, AllowsNull = false)] PasajeroOid p_thisPasajeroArg) { try { } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Pasajero, Service: edit_instance, Component: PasajeroAction, 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_1348178673664478Ser_2Arg_1_Alias", RevisionPasajeroClassText.Delete_instance_P_thisRevisionPasajeroArgumentAlias, "", "Clas_1348178673664478Ser_2_Alias", RevisionPasajeroClassText.Delete_instanceServiceAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias, AllowsNull = false)] RevisionPasajeroOid p_thisRevisionPasajeroArg) { try { RevisionPasajeroData lData = new RevisionPasajeroData(OnContext); // Delete instance lData.UpdateDeleted(Instance); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: RevisionPasajero, Service: delete_instance, Component: RevisionPasajeroAction, Method: Delete_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
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); } } }
public AdministradorInstance Create_instanceServ( [ONInboundArgument("Clas_1348605050880238Ser_1Arg_1_Alias", AdministradorClassText.Create_instance_P_atrid_AdministradorArgumentAlias, "autonumeric", "Clas_1348605050880238Ser_1_Alias", AdministradorClassText.Create_instanceServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, AllowsNull = false)] ONInt p_atrid_AdministradorArg, [ONInboundArgument("Clas_1348605050880238Ser_1Arg_2_Alias", AdministradorClassText.Create_instance_P_passwordArgumentAlias, "password", "Clas_1348605050880238Ser_1_Alias", AdministradorClassText.Create_instanceServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, Length = AdministradorXml.LENGTHPASSWORDADMINISTRADOR, AllowsNull = false)] ONString p_passwordArg) { try { AdministradorData lData = new AdministradorData(OnContext); #region Construct OID Instance.Oid = new AdministradorOid(); Instance.Oid.Id_AdministradorAttr = new ONInt(p_atrid_AdministradorArg); #endregion Construct OID #region Argument initialization 'p_password' (password) // Cipher password argument Instance.PassWordAttr = new ONString(ONSecureControl.CipherPassword(p_passwordArg.TypedValue)); #endregion Argument initialization 'p_password' (password) #region Autonumeric attribute 'id_Administrador' if (Instance.Id_AdministradorAttr < new ONInt(0)) { AdministradorData lAutonumericData = new AdministradorData(OnContext); lAutonumericData.ClassName = "Administrador"; //Get Autonumeric Instance.Oid.Id_AdministradorAttr = lAutonumericData.GetAutonumericid_Administrador(); } #endregion Autonumeric attribute 'id_Administrador' //Search if instance exists if (lData.Exist(Instance.Oid, null)) { throw new ONInstanceExistException(null, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias); } //Update the new instance lData.UpdateAdded(Instance); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Administrador, Service: create_instance, Component: AdministradorAction, Method: Create_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } return(Instance); }
public NaveNodrizaInstance Create_instanceServ( [ONInboundArgument("Clas_1347649273856884Ser_1Arg_1_Alias", NaveNodrizaClassText.Create_instance_P_atrid_NaveNodrizaArgumentAlias, "autonumeric", "Clas_1347649273856884Ser_1_Alias", NaveNodrizaClassText.Create_instanceServiceAlias, "Clas_1347649273856884_Alias", NaveNodrizaClassText.ClassAlias, AllowsNull = false)] ONInt p_atrid_NaveNodrizaArg, [ONInboundArgument("Clas_1347649273856884Ser_1Arg_2_Alias", NaveNodrizaClassText.Create_instance_P_atrNombre_NaveNodrizaArgumentAlias, "string", "Clas_1347649273856884Ser_1_Alias", NaveNodrizaClassText.Create_instanceServiceAlias, "Clas_1347649273856884_Alias", NaveNodrizaClassText.ClassAlias, Length = 100, AllowsNull = false)] ONString p_atrNombre_NaveNodrizaArg) { try { NaveNodrizaData lData = new NaveNodrizaData(OnContext); #region Construct OID Instance.Oid = new NaveNodrizaOid(); Instance.Oid.Id_NaveNodrizaAttr = new ONInt(p_atrid_NaveNodrizaArg); #endregion Construct OID #region Argument initialization 'p_atrNombre_NaveNodriza' (Nombre_NaveNodriza) Instance.Nombre_NaveNodrizaAttr = new ONString(p_atrNombre_NaveNodrizaArg); #endregion Argument initialization 'p_atrNombre_NaveNodriza' (Nombre_NaveNodriza) #region Autonumeric attribute 'id_NaveNodriza' if (Instance.Id_NaveNodrizaAttr < new ONInt(0)) { NaveNodrizaData lAutonumericData = new NaveNodrizaData(OnContext); lAutonumericData.ClassName = "NaveNodriza"; //Get Autonumeric Instance.Oid.Id_NaveNodrizaAttr = lAutonumericData.GetAutonumericid_NaveNodriza(); } #endregion Autonumeric attribute 'id_NaveNodriza' //Search if instance exists if (lData.Exist(Instance.Oid, null)) { throw new ONInstanceExistException(null, "Clas_1347649273856884_Alias", NaveNodrizaClassText.ClassAlias); } //Update the new instance lData.UpdateAdded(Instance); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: NaveNodriza, Service: create_instance, Component: NaveNodrizaAction, Method: Create_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } return(Instance); }
/// <summary>Solves the filters defined in this class</summary> /// <param name="linkedTo">This parameter has the related instance to retrieve the requested instances</param> /// <param name="filters">This parameter has all the filters defined with this class</param> /// <param name="orderCriteria">This parameter has the name of 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> public override ONCollection QueryByFilter(ONLinkedToList linkedTo, ONFilterList filters, ONDisplaySet displaySet, string orderCriteria, ONOid startRowOID, int blockSize) { // OrderCriteria ONOrderCriteria lComparer = GetOrderCriteria(orderCriteria); // Horizontal visibility if (filters == null) { filters = new ONFilterList(); } filters.Add("HorizontalVisibility", new NaveNodrizaHorizontalVisibility()); // Linked To List if (linkedTo == null) { linkedTo = new ONLinkedToList(); } // Call Data try { NaveNodrizaData lData = new NaveNodrizaData(OnContext); ONCollection lCollection = lData.ExecuteQuery(linkedTo, filters, displaySet, lComparer, startRowOID, blockSize); // OrderCriteria if (lComparer != null) { lCollection.Sort(lComparer); } return(lCollection); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Error in query, Method: ExecuteQuery, Component: NaveNodrizaQuery"; 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_1348178542592658Ser_2Arg_1_Alias", PasajeroClassText.Delete_instance_P_thisPasajeroArgumentAlias, "", "Clas_1348178542592658Ser_2_Alias", PasajeroClassText.Delete_instanceServiceAlias, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias, AllowsNull = false)] PasajeroOid p_thisPasajeroArg) { try { PasajeroData lData = new PasajeroData(OnContext); // Static delete check if (Instance.PasajeroAeronaveRole.Count > 0) { throw new ONStaticException(null, PasajeroClassText.ClassAlias, "Clas_1348178542592658_Alias", PasajeroClassText.PasajeroAeronaveRoleAlias, "Agr_1348602429440718Rol_1_Alias"); } // Delete relationships { PasajeroData lDataRel = new PasajeroData(OnContext); lDataRel.PasajeroAeronaveRoleDelete(Instance.Oid); } // Delete instance lData.UpdateDeleted(Instance); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Pasajero, Service: delete_instance, Component: PasajeroAction, Method: Delete_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
public PasajeroInstance Create_instanceServ( [ONInboundArgument("Clas_1348178542592658Ser_1Arg_4_Alias", PasajeroClassText.Create_instance_P_agrPasajeroAeronaveArgumentAlias, "", "Clas_1348178542592658Ser_1_Alias", PasajeroClassText.Create_instanceServiceAlias, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias, AllowsNull = false)] PasajeroAeronaveOid p_agrPasajeroAeronaveArg, [ONInboundArgument("Clas_1348178542592658Ser_1Arg_1_Alias", PasajeroClassText.Create_instance_P_atrid_PasajeroArgumentAlias, "autonumeric", "Clas_1348178542592658Ser_1_Alias", PasajeroClassText.Create_instanceServiceAlias, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias, AllowsNull = false)] ONInt p_atrid_PasajeroArg, [ONInboundArgument("Clas_1348178542592658Ser_1Arg_2_Alias", PasajeroClassText.Create_instance_P_atrNombreArgumentAlias, "text", "Clas_1348178542592658Ser_1_Alias", PasajeroClassText.Create_instanceServiceAlias, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias, AllowsNull = false)] ONText p_atrNombreArg) { try { PasajeroData lData = new PasajeroData(OnContext); #region Construct OID Instance.Oid = new PasajeroOid(); Instance.Oid.Id_PasajeroAttr = new ONInt(p_atrid_PasajeroArg); #endregion Construct OID #region Argument initialization 'p_atrNombre' (Nombre) Instance.NombreAttr = new ONText(p_atrNombreArg); #endregion Argument initialization 'p_atrNombre' (Nombre) #region Argument initialization 'p_agrPasajeroAeronave' (PasajeroAeronave) if (p_agrPasajeroAeronaveArg != null) { PasajeroAeronaveData lPasajeroAeronaveData = new PasajeroAeronaveData(OnContext); if (!lPasajeroAeronaveData.Exist(p_agrPasajeroAeronaveArg, null)) { throw new ONInstanceNotExistException(null, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias); } throw new ONStaticCreationException(null, PasajeroClassText.ClassAlias, "Clas_1348178542592658_Alias", PasajeroClassText.PasajeroAeronaveRoleAlias, "Agr_1348602429440718Rol_1_Alias"); } #endregion Argument Initialization 'p_agrPasajeroAeronave' (PasajeroAeronave) #region Autonumeric attribute 'id_Pasajero' if (Instance.Id_PasajeroAttr < new ONInt(0)) { PasajeroData lAutonumericData = new PasajeroData(OnContext); lAutonumericData.ClassName = "Pasajero"; //Get Autonumeric Instance.Oid.Id_PasajeroAttr = lAutonumericData.GetAutonumericid_Pasajero(); } #endregion Autonumeric attribute 'id_Pasajero' //Search if instance exists if (lData.Exist(Instance.Oid, null)) { throw new ONInstanceExistException(null, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias); } //Update the new instance lData.UpdateAdded(Instance); #region Argument initialization 'p_agrPasajeroAeronave' (PasajeroAeronave) if (p_agrPasajeroAeronaveArg != null) { PasajeroAeronaveData lPasajeroAeronaveData = new PasajeroAeronaveData(OnContext); if (!lPasajeroAeronaveData.Exist(p_agrPasajeroAeronaveArg, null)) { throw new ONInstanceNotExistException(null, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias); } PasajeroAeronaveInstance lInstance = p_agrPasajeroAeronaveArg.GetInstance(OnContext); Instance.PasajeroAeronaveRole.Add(lInstance); if (!lInstance.PasajeroRole.Contains(Instance)) { lInstance.PasajeroRole.Add(Instance); lInstance.PasajeroRoleOidTemp = Instance.Oid; } lPasajeroAeronaveData.UpdateEdited(lInstance); } #endregion Argument Initialization 'p_agrPasajeroAeronave' (PasajeroAeronave) #region Cardinality check for role 'PasajeroAeronave' // Minimum cardinality check if (Instance.PasajeroAeronaveRole == null) { throw new ONMinCardinalityException(null, PasajeroClassText.ClassAlias, "Clas_1348178542592658_Alias", PasajeroClassText.PasajeroAeronaveRoleAlias, "Agr_1348602429440718Rol_1_Alias", 1); } #endregion Cardinality check for role 'PasajeroAeronave' #region Cardinality check for role 'PasajeroAeronave' // Maximum cardinality check (inverse) foreach (PasajeroAeronaveInstance lRelatedInstance in Instance.PasajeroAeronaveRole) { if (lRelatedInstance.PasajeroRole.Count > 1) { throw new ONMaxCardinalityException(null, PasajeroAeronaveClassText.ClassAlias, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.PasajeroRoleAlias, "Agr_1348602429440718Rol_2_Alias", 1); } } #endregion Cardinality check for role 'PasajeroAeronave' } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Pasajero, Service: create_instance, Component: PasajeroAction, Method: Create_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } return(Instance); }
public RevisionInstance Create_instanceServ( [ONInboundArgument("Clas_1348178542592347Ser_1Arg_1_Alias", RevisionClassText.Create_instance_P_atrid_RevisarAeronaveArgumentAlias, "autonumeric", "Clas_1348178542592347Ser_1_Alias", RevisionClassText.Create_instanceServiceAlias, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias, AllowsNull = false)] ONInt p_atrid_RevisarAeronaveArg, [ONInboundArgument("Clas_1348178542592347Ser_1Arg_3_Alias", RevisionClassText.Create_instance_P_atrFechaRevisionArgumentAlias, "date", "Clas_1348178542592347Ser_1_Alias", RevisionClassText.Create_instanceServiceAlias, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias, AllowsNull = false)] ONDate p_atrFechaRevisionArg, [ONInboundArgument("Clas_1348178542592347Ser_1Arg_4_Alias", RevisionClassText.Create_instance_P_atrNombreRevisorArgumentAlias, "string", "Clas_1348178542592347Ser_1_Alias", RevisionClassText.Create_instanceServiceAlias, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias, Length = 100, AllowsNull = false)] ONString p_atrNombreRevisorArg, [ONInboundArgument("Clas_1348178542592347Ser_1Arg_5_Alias", RevisionClassText.Create_instance_P_atrId_AeronaveArgumentAlias, "string", "Clas_1348178542592347Ser_1_Alias", RevisionClassText.Create_instanceServiceAlias, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias, Length = 100, AllowsNull = false)] ONString p_atrId_AeronaveArg) { try { RevisionData lData = new RevisionData(OnContext); #region Construct OID Instance.Oid = new RevisionOid(); Instance.Oid.Id_RevisarAeronaveAttr = new ONInt(p_atrid_RevisarAeronaveArg); #endregion Construct OID #region Argument initialization 'p_atrFechaRevision' (FechaRevision) Instance.FechaRevisionAttr = new ONDate(p_atrFechaRevisionArg); #endregion Argument initialization 'p_atrFechaRevision' (FechaRevision) #region Argument initialization 'p_atrNombreRevisor' (NombreRevisor) Instance.NombreRevisorAttr = new ONString(p_atrNombreRevisorArg); #endregion Argument initialization 'p_atrNombreRevisor' (NombreRevisor) #region Argument initialization 'p_atrId_Aeronave' (Id_Aeronave) Instance.Id_AeronaveAttr = new ONString(p_atrId_AeronaveArg); #endregion Argument initialization 'p_atrId_Aeronave' (Id_Aeronave) #region Autonumeric attribute 'id_RevisarAeronave' if (Instance.Id_RevisarAeronaveAttr < new ONInt(0)) { RevisionData lAutonumericData = new RevisionData(OnContext); lAutonumericData.ClassName = "Revision"; //Get Autonumeric Instance.Oid.Id_RevisarAeronaveAttr = lAutonumericData.GetAutonumericid_RevisarAeronave(); } #endregion Autonumeric attribute 'id_RevisarAeronave' //Search if instance exists if (lData.Exist(Instance.Oid, null)) { throw new ONInstanceExistException(null, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias); } //Update the new instance lData.UpdateAdded(Instance); } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: Revision, Service: create_instance, Component: RevisionAction, Method: Create_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } return(Instance); }
/// <summary> /// Executes the SQL statment over the Data Base connected /// </summary> /// <param name="onSql">This parameter has the current SQL statment</param> /// <param name="onFilterList">List of filters to check</param> /// <param name="comparer">This parameter has all the information refering to the order criteria to add to SQL statment</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> public override ONCollection ExecuteSql(ONSql onSql, ONFilterList onFilterList, ONDisplaySet displaySet, ONOrderCriteria orderCriteria, ONOid startRowOid, int blockSize) { AeronaveCollection lQuery = null; bool lWithStartRow = (startRowOid != null).TypedValue; long lCount = -1; if (!lWithStartRow) { lCount = 0; } IDataReader lDataReader = null; ONSQLConnection lOnSQLConnection = null; try { lDataReader = Execute(onSql) as IDataReader; AeronaveInstance lInstance = null; AeronaveInstance lAntInstance = null; if (lDataReader != null) { object[] lColumns; if (displaySet == null) { lColumns = new object[4]; } else { lColumns = new object[displaySet.ElementsInData]; } lQuery = new AeronaveCollection(OnContext); bool lFoundStartRow = false; while (lDataReader.Read()) { lAntInstance = lInstance; // Read Columns lDataReader.GetValues(lColumns); // Read Instance int lIndex = 0; lInstance = LoadFacet(OnContext, displaySet, lColumns, ref lIndex); // Read related attributes if (displaySet != null) { LoadRelated(OnContext, displaySet, lColumns, lIndex, lInstance); } if (lCount >= 0) // Add the load instance { if ((onFilterList == null) || (!onFilterList.InMemory)) { // Add to the Instance list lQuery.Add(lInstance); lCount++; } else { ONSQLConnection lSQLConnectionOld = (ONSQLConnection)lInstance.OnContext.SqlConnection; // Set another connection because it is imposible to use // the same connection that is used in the DataReader if (lOnSQLConnection == null) { lOnSQLConnection = GetConnection(); } lInstance.OnContext.SqlConnection = lOnSQLConnection; if (onFilterList.FilterInMemory(lInstance)) { // Add to the Instance list lQuery.Add(lInstance); lCount++; } lInstance.OnContext.SqlConnection = lSQLConnectionOld; } } else { if ((orderCriteria != null) && (orderCriteria.InMemory)) // Need to load for ordering in memory after loading { if (lAntInstance != null) { // Set another connection because it is imposible to use // the same connection that is used in the DataReader ONSQLConnection lOnSQLConnectionOld = lInstance.OnContext.SqlConnection as ONSQLConnection; if (lOnSQLConnection == null) { lOnSQLConnection = GetConnection(); } lInstance.OnContext.SqlConnection = lOnSQLConnection; int lCompare = orderCriteria.CompareSql(lInstance, lAntInstance); if (lCompare != 0) { if (lFoundStartRow) { lCount = 1; } else { lQuery.Clear(); } } // Restores the old connection lInstance.OnContext.SqlConnection = lOnSQLConnectionOld; } if ((onFilterList == null) || (!onFilterList.InMemory)) { // Add to the Instance list lQuery.Add(lInstance); } else { ONSQLConnection lSQLConnectionOld = (ONSQLConnection)lInstance.OnContext.SqlConnection; // Set another connection because it is imposible to use // the same connection that is used in the DataReader if (lOnSQLConnection == null) { lOnSQLConnection = GetConnection(); } lInstance.OnContext.SqlConnection = lOnSQLConnection; if (onFilterList.FilterInMemory(lInstance)) { // Add to the Instance list lQuery.Add(lInstance); } else { lCount--; } lInstance.OnContext.SqlConnection = lSQLConnectionOld; } if (lInstance.Oid.Equals(startRowOid)) { lFoundStartRow = true; } } else if (lInstance.Oid.Equals(startRowOid)) // Search the start row { lCount = 0; } } // Stop loading if ((blockSize != 0) && (lCount > blockSize)) { if (orderCriteria == null) { break; } else { // Set another connection because it is imposible to use // the same connection that is used in the DataReader ONSQLConnection lOnSQLConnectionOld = lInstance.OnContext.SqlConnection as ONSQLConnection; if (lOnSQLConnection == null) { lOnSQLConnection = GetConnection(); } lInstance.OnContext.SqlConnection = lOnSQLConnection; int lCompare = orderCriteria.CompareSql(lInstance, lAntInstance); // Restores the old connection lInstance.OnContext.SqlConnection = lOnSQLConnectionOld; if (lCompare > 0) { break; } } } } } } catch (Exception e) { string ltraceItem = "Method: ExecuteSql, Component: AeronaveData"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } finally { if (lOnSQLConnection != null) { ONDBData.CloseConnection(lOnSQLConnection); } if (lDataReader != null) { if (mSqlCommand != null) { mSqlCommand.Cancel(); } lDataReader.Close(); } Close(); if ((onFilterList != null) && (onFilterList.InMemory) && !lWithStartRow && (lCount <= blockSize)) { lQuery.totalNumInstances = lQuery.Count; } } return(lQuery); }
public RevisionPasajeroInstance Create_instanceServ( [ONInboundArgument("Clas_1348178673664478Ser_1Arg_3_Alias", RevisionPasajeroClassText.Create_instance_P_agrPasajeroAeronaveArgumentAlias, "", "Clas_1348178673664478Ser_1_Alias", RevisionPasajeroClassText.Create_instanceServiceAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias, AllowsNull = false)] PasajeroAeronaveOid p_agrPasajeroAeronaveArg, [ONInboundArgument("Clas_1348178673664478Ser_1Arg_4_Alias", RevisionPasajeroClassText.Create_instance_P_agrRevisionArgumentAlias, "", "Clas_1348178673664478Ser_1_Alias", RevisionPasajeroClassText.Create_instanceServiceAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias, AllowsNull = false)] RevisionOid p_agrRevisionArg, [ONInboundArgument("Clas_1348178673664478Ser_1Arg_1_Alias", RevisionPasajeroClassText.Create_instance_P_atrid_RevisionPasajeroArgumentAlias, "autonumeric", "Clas_1348178673664478Ser_1_Alias", RevisionPasajeroClassText.Create_instanceServiceAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias, AllowsNull = false)] ONInt p_atrid_RevisionPasajeroArg) { try { RevisionPasajeroData lData = new RevisionPasajeroData(OnContext); #region Construct OID Instance.Oid = new RevisionPasajeroOid(); Instance.Oid.Id_RevisionPasajeroAttr = new ONInt(p_atrid_RevisionPasajeroArg); #endregion Construct OID #region Argument initialization 'p_agrPasajeroAeronave' (PasajeroAeronave) if (p_agrPasajeroAeronaveArg != null) { PasajeroAeronaveData lPasajeroAeronaveData = new PasajeroAeronaveData(OnContext); if (!lPasajeroAeronaveData.Exist(p_agrPasajeroAeronaveArg, null)) { throw new ONInstanceNotExistException(null, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias); } Instance.PasajeroAeronaveRole = null; Instance.PasajeroAeronaveRoleOidTemp = p_agrPasajeroAeronaveArg; // Maximum cardinality check (inverse role) if (p_agrPasajeroAeronaveArg.GetInstance(OnContext).RevisionPasajeroRole.Count >= 1) { throw new ONMaxCardinalityException(null, PasajeroAeronaveClassText.ClassAlias, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.RevisionPasajeroRoleAlias, "Agr_1348602167296649Rol_1_Alias", 1); } } #endregion Argument Initialization 'p_agrPasajeroAeronave' (PasajeroAeronave) #region Argument initialization 'p_agrRevision' (Revision) if (p_agrRevisionArg != null) { RevisionData lRevisionData = new RevisionData(OnContext); if (!lRevisionData.Exist(p_agrRevisionArg, null)) { throw new ONInstanceNotExistException(null, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias); } Instance.RevisionRole = null; Instance.RevisionRoleOidTemp = p_agrRevisionArg; // Maximum cardinality check (inverse role) if (p_agrRevisionArg.GetInstance(OnContext).RevisionPasajeroRole.Count >= 1) { throw new ONMaxCardinalityException(null, RevisionClassText.ClassAlias, "Clas_1348178542592347_Alias", RevisionClassText.RevisionPasajeroRoleAlias, "Agr_1348602167296276Rol_1_Alias", 1); } } #endregion Argument Initialization 'p_agrRevision' (Revision) #region Autonumeric attribute 'id_RevisionPasajero' if (Instance.Id_RevisionPasajeroAttr < new ONInt(0)) { RevisionPasajeroData lAutonumericData = new RevisionPasajeroData(OnContext); lAutonumericData.ClassName = "RevisionPasajero"; //Get Autonumeric Instance.Oid.Id_RevisionPasajeroAttr = lAutonumericData.GetAutonumericid_RevisionPasajero(); } #endregion Autonumeric attribute 'id_RevisionPasajero' //Search if instance exists if (lData.Exist(Instance.Oid, null)) { throw new ONInstanceExistException(null, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias); } //Update the new instance lData.UpdateAdded(Instance); #region Cardinality check for role 'PasajeroAeronave' // Minimum cardinality check if (Instance.PasajeroAeronaveRole == null) { throw new ONMinCardinalityException(null, RevisionPasajeroClassText.ClassAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.PasajeroAeronaveRoleAlias, "Agr_1348602167296649Rol_2_Alias", 1); } #endregion Cardinality check for role 'PasajeroAeronave' #region Cardinality check for role 'PasajeroAeronave' // Maximum cardinality check (inverse) foreach (PasajeroAeronaveInstance lRelatedInstance in Instance.PasajeroAeronaveRole) { if (lRelatedInstance.RevisionPasajeroRole.Count > 1) { throw new ONMaxCardinalityException(null, PasajeroAeronaveClassText.ClassAlias, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.RevisionPasajeroRoleAlias, "Agr_1348602167296649Rol_1_Alias", 1); } } #endregion Cardinality check for role 'PasajeroAeronave' #region Cardinality check for role 'Revision' // Minimum cardinality check if (Instance.RevisionRole == null) { throw new ONMinCardinalityException(null, RevisionPasajeroClassText.ClassAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.RevisionRoleAlias, "Agr_1348602167296276Rol_2_Alias", 1); } #endregion Cardinality check for role 'Revision' #region Cardinality check for role 'Revision' // Maximum cardinality check (inverse) foreach (RevisionInstance lRelatedInstance in Instance.RevisionRole) { if (lRelatedInstance.RevisionPasajeroRole.Count > 1) { throw new ONMaxCardinalityException(null, RevisionClassText.ClassAlias, "Clas_1348178542592347_Alias", RevisionClassText.RevisionPasajeroRoleAlias, "Agr_1348602167296276Rol_1_Alias", 1); } } #endregion Cardinality check for role 'Revision' } catch (Exception e) { if (e is ONException) { throw e; } else { string ltraceItem = "Definition class: RevisionPasajero, Service: create_instance, Component: RevisionPasajeroAction, Method: Create_instanceServ"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } return(Instance); }
/// <summary> /// Retrieve all the instances of a determinate class that fulfil a determinate formula of searching /// </summary> /// <param name="linkedTo">List to reach the class to retrieve the related instance</param> /// <param name="filters">Formula to search concrete instances</param> /// <param name="comparer">Order Criteria that must be followed by the query</param> /// <param name="startRowOID">OID frontier</param> /// <param name="blockSize">Number of instances to be returned</param> public override ONCollection ExecuteQuery(ONLinkedToList linkedTo, ONFilterList filters, ONDisplaySet displaySet, ONOrderCriteria comparer, ONOid startRowOid, int blockSize) { try { ONCollection lInstances = null; Type lTypeInstance = ONContext.GetType_Instance(ClassName); Type lTypeQuery = ONContext.GetType_Query(ClassName); // Initialize the list of related queries if (linkedTo == null) { linkedTo = new ONLinkedToList(); } // Initialize the filter list if (filters == null) { filters = new ONFilterList(); } ONLinkedToList lLinkedToLegacy = new ONLinkedToList(); ONLinkedToList lLinkedToLocal = new ONLinkedToList(); ONLinkedToList lLinkedToMixed = new ONLinkedToList(); #region Treatment of LinkedTo foreach (KeyValuePair <ONPath, ONOid> lDictionaryEntry in linkedTo) { ONPath lPath = lDictionaryEntry.Key as ONPath; ONOid lOid = lDictionaryEntry.Value as ONOid; ONPath lInversePath = new ONPath(ONInstance.InversePath(lTypeInstance, lPath)); Type lTypeTargetClassInstance = ONContext.GetType_Instance(ONInstance.GetTargetClass(OnContext, lTypeInstance, lPath)); if ((lInversePath.Count == 0) || (!ONInstance.IsVisible(lTypeTargetClassInstance, lInversePath, OnContext))) { return(ONContext.GetComponent_Collection(ClassName, OnContext)); } bool lexistLV = false; ONData lData = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext); if (lData.GetType().BaseType == typeof(ONLVData)) { if (!lOid.Exist(OnContext, null)) { return(ONContext.GetComponent_Collection(ClassName, OnContext)); } } foreach (string lRole in lInversePath.Roles) { lData = ONContext.GetComponent_Data(lData.InhGetTargetClassName(new ONPath(lRole)), OnContext); if (lData.GetType().BaseType == typeof(ONLVData)) { lexistLV = true; } } if (!lexistLV) { lLinkedToLocal.mLinkedToList.Add(lPath, lOid); } else { lLinkedToMixed.mLinkedToList.Add(lPath, lOid); } } #endregion #region displaySet if (!filters.PreloadRelatedAttributes) { displaySet = null; } #endregion displaySet #region No link item if ((linkedTo.mLinkedToList.Count == 0) || (lLinkedToMixed.mLinkedToList.Count > 0)) { if ((GetType().BaseType != typeof(ONLVData)) || (filters.InData)) { lInstances = SolveQuery(new ONLinkedToList(), filters, displaySet, comparer, startRowOid, blockSize); } } #endregion #region Local Link if (lLinkedToLocal.mLinkedToList.Count > 0) { ONCollection lInstancesAux = SolveQuery(lLinkedToLocal, filters, displaySet, comparer, startRowOid, blockSize); if (lInstances != null) { lInstances.Intersection(lInstancesAux); } else { lInstances = lInstancesAux; } } #endregion #region Hybrid Link if (lLinkedToMixed.mLinkedToList.Count > 0) { ONCollection lInstancesAux = null; foreach (KeyValuePair <ONPath, ONOid> lDictionaryEntry in lLinkedToMixed) { ONPath lPath = lDictionaryEntry.Key as ONPath; ONOid lOid = lDictionaryEntry.Value as ONOid; if (lPath.Roles.Count == 1) { ONLinkedToList lLinked = new ONLinkedToList(); lLinked[lPath] = lOid; ONCollection lInstanceColl = SolveQuery(lLinked, filters, displaySet, comparer, startRowOid, blockSize); if (lInstances != null) { lInstances.Intersection(lInstanceColl); } else { lInstances = lInstanceColl; } continue; } #region Optimized Path ONLinkedToList linkedToOptimized = new ONLinkedToList(); ONPath lInversePath = new ONPath(ONInstance.InversePath(lTypeInstance, lPath)); ONPath lOptimizedRole = new ONPath(lInversePath.RemoveHead() as string); Type lTypeInstanceDestiny = ONContext.GetType_Instance(InhGetTargetClassName(lPath)); bool lBeginIsLegacy = (ONInstance.IsLegacy(lTypeInstanceDestiny, lOptimizedRole)); bool lEnterLoop = true; ONData lData = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext); if (lData.GetType().BaseType != typeof(ONLVData)) { if (ONContext.GetType_Data(lData.InhGetTargetClassName(lOptimizedRole)).BaseType == typeof(ONLVData)) { lEnterLoop = false; } } lPath.RemoveTail(); if (lEnterLoop) { while (lInversePath.Roles.Count > 0) { lData = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext); if ((!lBeginIsLegacy) && (ONContext.GetType_Data(lData.InhGetTargetClassName(new ONPath(lInversePath.Roles[0]))).BaseType == typeof(ONLVData))) { break; } if ((lBeginIsLegacy) && (ONContext.GetType_Data(lData.InhGetTargetClassName(new ONPath(lInversePath.Roles[0]))).BaseType != typeof(ONLVData))) { break; } lOptimizedRole.Roles.Add(lInversePath.RemoveHead()); lPath.RemoveTail(); } } linkedToOptimized[ONInstance.InversePath(lTypeInstanceDestiny, lOptimizedRole)] = lOid; if ((lPath.Count > 0) || (lBeginIsLegacy)) { // It is not the last role or it is leged lInstancesAux = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext).ExecuteQuery(linkedToOptimized, null, null, comparer, startRowOid, blockSize); } else { // It is the last role and it is local lInstancesAux = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext).ExecuteQuery(linkedToOptimized, null, displaySet, comparer, startRowOid, blockSize); } #endregion #region Rest of the path lInstancesAux = lInstancesAux[lInversePath] as ONCollection; #endregion if (lInstances != null) { lInstances.Intersection(lInstancesAux); } else { lInstances = lInstancesAux; } } } #endregion return(lInstances); } catch (Exception e) { string ltraceItem = "Method: SolveQuery, Component: ONDBData"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } }