/// <summary>
        /// Construye el objeto y se encarga de obtener los
        /// hijos si los tiene y se solicitan
        /// </summary>
        /// <param name="source">DataReader fuente</param>
        private void Fetch(IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

                if (Childs)
                {
                    if (nHMng.UseDirectSQL)
                    {
                        InventarioAlmacen.DoLOCK(Session());
                        string      query  = InventarioAlmacenes.SELECT(this);
                        IDataReader reader = nHMng.SQLNativeSelect(query, Session());
                        _inventarios = InventarioAlmacenes.GetChildList(reader, false);

                        Batch.DoLOCK(Session());
                        query     = Batchs.SELECT(this, true);
                        reader    = nHMng.SQLNativeSelect(query, Session());
                        _partidas = Batchs.GetChildList(SessionCode, reader, false);

                        Stock.DoLOCK(Session());
                        query   = Stocks.SELECT(this);
                        reader  = nHMng.SQLNativeSelect(query, Session());
                        _stocks = Stocks.GetChildList(SessionCode, reader, false);
                    }
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
        /// <summary>
        /// Obtiene un registro de la base de datos
        /// </summary>
        /// <param name="criteria">Criterios de consulta</param>
        /// <remarks>Lo llama el DataPortal tras generar el objeto</remarks>
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                _base.Record.Oid = 0;
                SessionCode      = criteria.SessionCode;
                Childs           = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    Almacen.DoLOCK(Session());
                    IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session());

                    if (reader.Read())
                    {
                        _base.CopyValues(reader);
                    }

                    if (Childs)
                    {
                        string query = string.Empty;

                        InventarioAlmacen.DoLOCK(Session());
                        query        = InventarioAlmacenes.SELECT(this);
                        reader       = nHMng.SQLNativeSelect(query, Session());
                        _inventarios = InventarioAlmacenes.GetChildList(reader);

                        Batch.DoLOCK(Session());
                        query     = Batchs.SELECT(this, true);
                        reader    = nHMng.SQLNativeSelect(query, Session());
                        _partidas = Batchs.GetChildList(SessionCode, reader, false);

                        Stock.DoLOCK(Session());
                        query   = Stocks.SELECT(this);
                        reader  = nHMng.SQLNativeSelect(query, Session());
                        _stocks = Stocks.GetChildList(SessionCode, reader, false);
                    }
                }

                MarkOld();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }