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

                Childs = criteria.Childs;

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

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

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

                    if (Childs)
                    {
                        Alumno_Convocatoria.DoLOCK(Session());

                        string query = Alumno_Convocatorias.SELECT_BY_CONVOCATORIA(this.Oid);
                        reader   = nHManager.Instance.SQLNativeSelect(query, Session());
                        _alumnos = Alumno_Convocatorias.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((Convocatoria_CursoRecord)(criteria.UniqueResult()));

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

                    if (Childs)
                    {
                        criteria = Alumno_Convocatoria.GetCriteria(Session());
                        criteria.AddEq("OidConvocatoria", this.Oid);
                        _alumnos = Alumno_Convocatorias.GetChildList(criteria.List <Alumno_Convocatoria>());
                    }
                }
            }
            catch (NHibernate.ADOException)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQLockException(moleQule.Library.Resources.Messages.LOCK_ERROR);
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
        /// <summary>
        /// Devuelve una lista de todos los alumno_cursos asociados a un curso
        /// </summary>
        /// <returns>Lista de elementos</returns>
        public static Alumno_ConvocatoriaList GetAlumnosList(long oid_curso)
        {
            CriteriaEx criteria = Alumno_Convocatoria.GetCriteria(Alumno_Convocatoria.OpenSession());

            criteria.AddEq("OidCurso", oid_curso);
            Alumno_ConvocatoriaList list = Alumno_ConvocatoriaList.RetrieveList(typeof(Alumno_Convocatoria), AppContext.ActiveSchema.Code, criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
        public void CopyValues(Alumno_Convocatoria source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);

            _nombre  = source.Nombre;
            _cliente = source.Cliente;
        }
        // called to copy objects data from list
        private void Fetch(IDataReader reader)
        {
            this.RaiseListChangedEvents = false;

            IsReadOnly = false;

            while (reader.Read())
            {
                this.AddItem(Alumno_Convocatoria.GetChild(reader).GetInfo());
            }

            IsReadOnly = true;

            this.RaiseListChangedEvents = true;
        }
        private void Fetch(int session_code, IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

                if (Childs)
                {
                    Alumno_Convocatoria.DoLOCK(Session(session_code));

                    string      query  = Alumno_Convocatorias.SELECT_BY_CONVOCATORIA(this.Oid);
                    IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _alumnos = Alumno_Convocatorias.GetChildList(reader);
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
        private void Fetch(Convocatoria_Curso source)
        {
            try
            {
                SessionCode = source.SessionCode;

                _base.CopyValues(source);

                if (Childs)
                {
                    CriteriaEx criteria = Alumno_Convocatoria.GetCriteria(Session());
                    criteria.AddEq("OidConvocatoria", this.Oid);
                    _alumnos = Alumno_Convocatorias.GetChildList(criteria.List <Alumno_Convocatoria>());
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
 public void CopyFrom(Alumno_Convocatoria source)
 {
     _base.CopyValues(source);
 }