Example #1
0
        /// <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)
                {
                    string query = string.Empty;

                    if (Childs)
                    {
                        SerieFamilia.DoLOCK(Session());
                        query = SerieFamilias.SELECT(this);
                        IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session());
                        _serie_familias = SerieFamilias.GetChildList(SessionCode, reader, Childs);
                    }
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Example #2
0
        /// <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)
                {
                    Serie.DoLOCK(Session());
                    IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session());

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

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

                        SerieFamilia.DoLOCK(Session());
                        query           = SerieFamilias.SELECT(this);
                        reader          = nHManager.Instance.SQLNativeSelect(query, Session());
                        _serie_familias = SerieFamilias.GetChildList(SessionCode, reader, Childs);
                    }
                }

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