// called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    Instructor_Promocion.DoLOCK(Session());

                    IDataReader reader = Instructor_Promocion.DoSELECT(AppContext.ActiveSchema.Code, Session(), criteria.Oid);

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

                    if (Childs)
                    {
                        string query;

                        Submodulo_Instructor_Promocion.DoLOCK(Session());

                        query       = Submodulos_Instructores_Promociones.SELECT_BY_INSTRUCTOR_PROMOCION(this.Oid);
                        reader      = nHManager.Instance.SQLNativeSelect(query, Session());
                        _submodulos = Submodulos_Instructores_Promociones.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((Instructor_PromocionRecord)(criteria.UniqueResult()));

                    //Session().Lock(Session().Get<Instructor_PromocionRecord>(Oid), LockMode.UpgradeNoWait);

                    if (Childs)
                    {
                        criteria = Submodulo_Instructor_Promocion.GetCriteria(Session());
                        criteria.AddEq("OidInstructorPromocion", this.Oid);
                        _submodulos = Submodulos_Instructores_Promociones.GetChildList(criteria.List <Submodulo_Instructor_Promocion>());
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
        private void Fetch(int session_code, IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

                if (Childs)
                {
                    string query;

                    Submodulo_Instructor_Promocion.DoLOCK(Session(session_code));

                    query = Submodulos_Instructores_Promociones.SELECT_BY_INSTRUCTOR_PROMOCION(this.Oid);
                    IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _submodulos = Submodulos_Instructores_Promociones.GetChildList(reader);
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }