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); } } }
private static string RevisionPasajeroRoleAddSql(ONSqlSelect onSql, JoinType joinType, string facet, ONPath onPath, ONPath processedPath, string role, bool force, bool isLinkedTo) { ONPath lOnPath = new ONPath(processedPath); lOnPath += role; //Source table string lAliasProcessed = onSql.GetAlias("Revision", processedPath, isLinkedTo); if (lAliasProcessed == "") { force = false; lAliasProcessed = onSql.CreateAlias(joinType, lAliasProcessed, CtesBD.TBL_REVISION, processedPath, "Revision", force, isLinkedTo); } //Target table string lAlias = onSql.GetAlias("RevisionPasajero", lOnPath, isLinkedTo); if (lAlias == "") { force = false; lAlias = onSql.CreateAlias(joinType, lAliasProcessed, CtesBD.TBL_REVISIONPASAJERO, lOnPath, "RevisionPasajero", force, isLinkedTo); onSql.AddAliasWhere(lAlias, lAliasProcessed + "." + CtesBD.FLD_REVISION_ID_REVISARAERONAVE + "=" + lAlias + "." + CtesBD.FLD_REVISIONPASAJERO_FK_REVISION_1); } //Target path if ((((object)onPath == null) || (onPath.Count == 0)) && (string.Compare("RevisionPasajero", facet, true) == 0) && (!force)) { return(lAlias); } return(RevisionPasajeroData.AddPath(onSql, joinType, facet, onPath, lOnPath, "", force, isLinkedTo)); }
/// <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 RevisionPasajeroHorizontalVisibility()); // Linked To List if (linkedTo == null) { linkedTo = new ONLinkedToList(); } // Call Data try { RevisionPasajeroData lData = new RevisionPasajeroData(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: RevisionPasajeroQuery"; if (e is ONSystemException) { ONSystemException lException = e as ONSystemException; lException.addTraceInformation(ltraceItem); throw lException; } throw new ONSystemException(e, ltraceItem); } } }
public ONCollection RevisionPasajeroRole(RevisionPasajeroOid oid) { ONSqlSelect lOnSql = new ONSqlSelect(); //Create select RevisionPasajeroData.AddPath(lOnSql, "Revision", new ONPath("Revision"), null, ""); RetrieveInstances(lOnSql, null, new ONPath("Revision"), OnContext); //Fix related instance RevisionPasajeroData.FixInstance(lOnSql, null, null, oid); //Execute return(ExecuteQuery(lOnSql)); }
public RevisionPasajeroCollection RevisionPasajeroRoleHV() { RevisionPasajeroData ldata = new RevisionPasajeroData(OnContext); //Fix related instance ONLinkedToList lLinkedTo = new ONLinkedToList(); lLinkedTo["Revision"] = Oid; ONFilterList lFilterList = new ONFilterList(); lFilterList.Add("HorizontalVisibility", new RevisionPasajeroHorizontalVisibility()); //Execute return(ldata.ExecuteQuery(lLinkedTo, lFilterList, null, null, null, 1) as RevisionPasajeroCollection); }
public static string GetTargetClassName(ONPath onPath) { ONPath lOnPath = new ONPath(onPath); if (lOnPath.Count == 0) { return("Revision"); } string lRol = lOnPath.RemoveHead(); if (string.Compare(lRol, "RevisionPasajero", true) == 0) { return(RevisionPasajeroData.GetTargetClassName(lOnPath)); } return(""); }
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>This method adds to the SQL statement any path that appears in a formula</summary> /// <param name="onSql">This parameter has the current SQL statement</param> /// <param name="joinType">This parameter has the type of join</param> /// <param name="facet">First class, the beginning of the path</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="initialClass">Domain of the object valued argument, object valued filter variables or AGENT when it should be necessary</param> /// <param name="forceLastAlias">Create almost the last alias in the sql</param> /// <param name="isLinkedTo">The alias belongs to a role in a linked To element</param> public static string AddPath(ONSqlSelect onSql, JoinType joinType, string facet, ONPath onPath, ONPath processedOnPath, string initialClass, bool forceLastAlias, bool isLinkedTo) { // initialClass is used for Object-valued arguments, object-valued filter variables, agent instance, ... ONPath lProcessedOnPath = new ONPath(processedOnPath); ONPath lOnPath = new ONPath(onPath); bool lOnPathExist = true; object[] lParameters = new object[8]; if (initialClass != "") { string lRol = lOnPath.RemoveHead(); lProcessedOnPath += lRol; // Solve path with initialPath lParameters[0] = onSql; lParameters[1] = joinType; lParameters[2] = facet; lParameters[3] = lOnPath; lParameters[4] = lProcessedOnPath; lParameters[5] = ""; lParameters[6] = forceLastAlias; lParameters[7] = isLinkedTo; return(ONContext.InvoqueMethod(ONContext.GetType_Data(initialClass), "AddPath", lParameters) as string); } // Search max solved path ONPath lMaxSolvedPath = new ONPath(onPath); string lMaxSolvedPathDomain = facet; while ((lMaxSolvedPath.Count > 0) && (onSql.GetAlias(lMaxSolvedPathDomain, lProcessedOnPath + lMaxSolvedPath, isLinkedTo) == "")) { lMaxSolvedPath.RemoveTail(); lMaxSolvedPathDomain = GetTargetClassName(lMaxSolvedPath); } if (lMaxSolvedPath.Count > 0) { lProcessedOnPath += lMaxSolvedPath; for (int i = 0; i < lMaxSolvedPath.Count; i++) { lOnPath.RemoveHead(); } lParameters[0] = onSql; lParameters[1] = joinType; lParameters[2] = facet; lParameters[3] = lOnPath; lParameters[4] = lProcessedOnPath; lParameters[5] = ""; lParameters[6] = forceLastAlias; lParameters[7] = isLinkedTo; return(ONContext.InvoqueMethod(ONContext.GetType_Data(lMaxSolvedPathDomain), "AddPath", lParameters) as string); } // Create inheritance path if ((onPath == null) || (onPath.Count == 0)) { if (forceLastAlias) { return(RevisionFacetAddSql(joinType, onSql, processedOnPath, forceLastAlias, isLinkedTo)); } if ((processedOnPath == null) || (processedOnPath.Count == 0)) { return(onSql.CreateAlias(joinType, "", CtesBD.TBL_REVISION, null, "Revision", false, isLinkedTo)); } else { return(onSql.CreateAlias(joinType, "", CtesBD.TBL_REVISION, processedOnPath, "Revision", false, isLinkedTo)); } } // Calculate processed path string lRole = lOnPath.RemoveHead() as string; lProcessedOnPath += lRole; // Search Path if (lOnPath.Count == 0) { string lAlias = onSql.GetAlias(facet, lProcessedOnPath, isLinkedTo); if ((lAlias != "") && (!forceLastAlias)) { return(lAlias); } else { lOnPathExist = false; } } else { string lTargetClass = GetTargetClassName(new ONPath(lRole)); // Agent & OV Argument Control if ((lTargetClass == "") && (initialClass != "")) { lTargetClass = initialClass; } string lAlias = onSql.GetAlias(lTargetClass, lProcessedOnPath, isLinkedTo); if (lAlias == "") { lOnPathExist = false; } } // Create path if (string.Compare(lRole, "RevisionPasajero", true) == 0) { if (lOnPathExist) { return(RevisionPasajeroData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias, isLinkedTo)); } else { return(RevisionPasajeroRoleAddSql(onSql, joinType, facet, lOnPath, processedOnPath, lRole, forceLastAlias, isLinkedTo)); } } initialClass = "Revision"; // Solve path with initialPath lParameters[0] = onSql; lParameters[1] = joinType; lParameters[2] = facet; lParameters[3] = lOnPath; lParameters[4] = lProcessedOnPath; lParameters[5] = ""; lParameters[6] = forceLastAlias; lParameters[7] = isLinkedTo; return(ONContext.InvoqueMethod(ONContext.GetType_Data(initialClass), "AddPath", lParameters) as string); }
/// <summary>This method adds to the SQL statement any path that appears in a formula</summary> /// <param name="onSql">This parameter has the current SQL statement</param> /// <param name="joinType">This parameter has the type of join</param> /// <param name="facet">First class, the beginning of the path</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="initialClass">Domain of the object valued argument, object valued filter variables or AGENT when it should be necessary</param> /// <param name="forceLastAlias">Create almost the last alias in the sql</param> public static string AddPath(ONSqlSelect onSql, JoinType joinType, string facet, ONPath onPath, ONPath processedOnPath, string initialClass, bool forceLastAlias) { // initialClass is used for Object-valued arguments, object-valued filter variables, agent instance, ... ONPath lProcessedOnPath = new ONPath(processedOnPath); ONPath lOnPath = new ONPath(onPath); // Calculate processed path string lRole = lOnPath.RemoveHead() as string; lProcessedOnPath += lRole; // Search Path if (lOnPath.Count == 0) { string lAlias = onSql.GetAlias(facet, lProcessedOnPath); if ((lAlias != "") && (!forceLastAlias)) { return(lAlias); } } // Create path if (initialClass == "") // Simple paths { if (string.Compare(lRole, "NaveNodriza", true) == 0) { return(NaveNodrizaData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias)); } if (string.Compare(lRole, "Aeronave", true) == 0) { return(AeronaveData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias)); } if (string.Compare(lRole, "Pasajero", true) == 0) { return(PasajeroData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias)); } if (string.Compare(lRole, "PasajeroAeronave", true) == 0) { return(PasajeroAeronaveData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias)); } if (string.Compare(lRole, "Revision", true) == 0) { return(RevisionData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias)); } if (string.Compare(lRole, "RevisionPasajero", true) == 0) { return(RevisionPasajeroData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias)); } if (string.Compare(lRole, "Administrador", true) == 0) { return(AdministradorData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias)); } } // Solve path with initialPath object[] lParameters = new object[6]; lParameters[0] = onSql; lParameters[1] = facet; lParameters[2] = lOnPath; lParameters[3] = lProcessedOnPath; lParameters[4] = ""; lParameters[5] = forceLastAlias; return(ONContext.InvoqueMethod(ONContext.GetType_Data(initialClass), "AddPath", lParameters) as string); }