コード例 #1
0
 /// <summary>Default Constructor</summary>
 public RevisionInstance(ONContext onContext)
     : base(onContext, "Revision", "Clas_1348178542592347_Alias")
 {
     Oid = new RevisionOid();
     NombreRevisorAttr = ONString.Null;
     FechaRevisionAttr = ONDate.Null;
     Id_AeronaveAttr = ONString.Null;
     RevisionPasajeroRoleTemp = null;
     StateObjAttrTemp = null;
 }
コード例 #2
0
 /// <summary>Default Constructor</summary>
 public PasajeroAeronaveInstance(ONContext onContext)
     : base(onContext, "PasajeroAeronave", "Clas_1348178542592177_Alias")
 {
     Oid = new PasajeroAeronaveOid();
     NombreAeronaveAttr = ONString.Null;
     NombrePasajeroAttr = ONString.Null;
     RevisionPasajeroRoleTemp = null;
     AeronaveRoleTemp = null;
     AeronaveRoleOidTemp = null;
     PasajeroRoleTemp = null;
     PasajeroRoleOidTemp = null;
     StateObjAttrTemp = null;
 }
コード例 #3
0
        public override void Copy(ONInstance instance)
        {
            RevisionInstance linstance = instance as RevisionInstance;

            Oid = new RevisionOid(linstance.Oid);

            NombreRevisorAttr = new ONString(linstance.NombreRevisorAttr);
            FechaRevisionAttr = new ONDate(linstance.FechaRevisionAttr);
            Id_AeronaveAttr = new ONString(linstance.Id_AeronaveAttr);
            RevisionPasajeroRoleTemp = linstance.RevisionPasajeroRoleTemp;
            StateObj = new ONString(linstance.StateObj);

            base.Copy(instance);
        }
コード例 #4
0
        /// <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)
        {
            RevisionPasajeroCollection 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;

                RevisionPasajeroInstance lInstance = null;
                RevisionPasajeroInstance lAntInstance = null;
                if (lDataReader != null)
                {
                    object[] lColumns;
                    if(displaySet == null)
                        lColumns = new object[5];
                    else
                        lColumns = new object[displaySet.ElementsInData];

                    lQuery = new RevisionPasajeroCollection(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: RevisionPasajeroData";
              			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;
        }
コード例 #5
0
        public override void Copy(ONInstance instance)
        {
            PasajeroAeronaveInstance linstance = instance as PasajeroAeronaveInstance;

            Oid = new PasajeroAeronaveOid(linstance.Oid);

            NombreAeronaveAttr = new ONString(linstance.NombreAeronaveAttr);
            NombrePasajeroAttr = new ONString(linstance.NombrePasajeroAttr);
            RevisionPasajeroRoleTemp = linstance.RevisionPasajeroRoleTemp;
            AeronaveRoleTemp = linstance.AeronaveRoleTemp;
            if (linstance.AeronaveRoleOidTemp != null)
                AeronaveRoleOidTemp = new AeronaveOid(linstance.AeronaveRoleOidTemp);
            PasajeroRoleTemp = linstance.PasajeroRoleTemp;
            if (linstance.PasajeroRoleOidTemp != null)
                PasajeroRoleOidTemp = new PasajeroOid(linstance.PasajeroRoleOidTemp);
            StateObj = new ONString(linstance.StateObj);

            base.Copy(instance);
        }