コード例 #1
0
        ///<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
            NaveNodrizaInstance lInstance = null;

            if (startRowOid != null)
            {
                lInstance     = new NaveNodrizaInstance(OnContext);
                lInstance.Oid = startRowOid as NaveNodrizaOid;
            }

            //Default OrderCriteria
            if (comparer == null)
            {
                string lAlias = onSql.GetAlias("NaveNodriza", initialPath);
                if (lInstance != null)
                {
                    onSql.AddOrderBy(lAlias, CtesBD.FLD_NAVENODRIZA_ID_NAVENODRIZA, OrderByTypeEnumerator.Asc, lInstance.Oid.Id_NaveNodrizaAttr);
                }
                else
                {
                    onSql.AddOrderBy(lAlias, CtesBD.FLD_NAVENODRIZA_ID_NAVENODRIZA, 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(NaveNodrizaData.AddPath(onSql, JoinType.LeftJoin, lOrderCriteriaItem.Facet, lPath, null, lOrderCriteriaItem.DomainArgument, false), lOrderCriteriaItem.Attribute, lOrderCriteriaItem.Type, lAttrStartRow);
                    lUseStartRow = (lAttrStartRow != null);
                }
                else
                {
                    onSql.AddOrderBy(NaveNodrizaData.AddPath(onSql, JoinType.LeftJoin, lOrderCriteriaItem.Facet, lPath, null, lOrderCriteriaItem.DomainArgument, false), lOrderCriteriaItem.Attribute, lOrderCriteriaItem.Type, null);
                }
            }
            return;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        /// <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);
              				}
              			}
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        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);
              			}
              		}
        }