Пример #1
0
        //Fetch independiente de DataPortal para generar un Entidad a partir de un IDataReader
        private void Fetch(IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

                if (Childs)
                {
                    if (nHMng.UseDirectSQL)
                    {
                        Agente.DoLOCK(Session());
                        string      query  = Agentes.SELECT(this);
                        IDataReader reader = nHMng.SQLNativeSelect(query, Session());
                        _agentes = Agentes.GetChildList(reader, false);
                    }
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }
        }
Пример #2
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                _base.Record.Oid = 0;
                SessionCode      = criteria.SessionCode;
                Childs           = criteria.Childs;

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

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

                    if (Childs)
                    {
                        Agente.DoLOCK(Session());
                        string query = Agentes.SELECT(this);
                        reader   = nHMng.SQLNativeSelect(query, Session());
                        _agentes = Agentes.GetChildList(reader, false);
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex, new object[] { criteria.Query });
            }
        }