public virtual void LoadChilds(Type type, bool get_childs) { if (type.Equals(typeof(Respuesta_Alumno_Examenes))) { _respuestas = Respuesta_Alumno_Examenes.GetChildList(this, get_childs); } }
// called to retrieve data from the database private void DataPortal_Fetch(CriteriaEx criteria) { try { SessionCode = criteria.SessionCode; Childs = criteria.Childs; if (nHMng.UseDirectSQL) { Alumno_Examen.DoLOCK(Session()); IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session()); if (reader.Read()) { _base.CopyValues(reader); } if (Childs) { string query; Respuesta_Alumno_Examen.DoLOCK(Session()); query = Respuesta_Alumno_Examenes.SELECT_BY_ALUMNO_EXAMEN(this.Oid); reader = nHManager.Instance.SQLNativeSelect(query, Session()); _respuestas = Respuesta_Alumno_Examenes.GetChildList(reader); } } else { _base.Record.CopyValues((AlumnoExamenRecord)(criteria.UniqueResult())); //Session().Lock(Session().Get<AlumnoExamenRecord>(Oid), LockMode.UpgradeNoWait); if (Childs) { criteria = Respuesta_Alumno_Examen.GetCriteria(Session()); criteria.AddEq("OidAlumnoExamen", this.Oid); _respuestas = Respuesta_Alumno_Examenes.GetChildList(criteria.List <Respuesta_Alumno_Examen>()); } } } 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); } }
// called to retrieve data from db protected override void Fetch(CriteriaEx criteria) { this.RaiseListChangedEvents = false; SessionCode = criteria.SessionCode; Childs = criteria.Childs; try { if (nHMng.UseDirectSQL) { IDataReader reader = Respuesta_Alumno_Examenes.DoNativeSELECT(AppContext.ActiveSchema.Code, Session()); IsReadOnly = false; while (reader.Read()) { this.AddItem(Respuesta_Alumno_ExamenInfo.Get(reader, Childs)); } IsReadOnly = true; } else { IList <Respuesta_Alumno_Examen> list = criteria.List <Respuesta_Alumno_Examen>(); if (list.Count > 0) { IsReadOnly = false; foreach (Respuesta_Alumno_Examen item in list) { this.AddItem(item.GetInfo()); } IsReadOnly = true; } } } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } this.RaiseListChangedEvents = true; }
private void Fetch(Alumno_Examen source) { try { SessionCode = source.SessionCode; _base.CopyValues(source); CriteriaEx criteria; criteria = Respuesta_Alumno_Examen.GetCriteria(Session()); criteria.AddEq("OidAlumnoExamen", this.Oid); _respuestas = Respuesta_Alumno_Examenes.GetChildList(criteria.List <Respuesta_Alumno_Examen>()); } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }
private void Fetch(int session_code, IDataReader source) { try { _base.CopyValues(source); if (Childs) { string query; Respuesta_Alumno_Examen.DoLOCK(Session(session_code)); query = Respuesta_Alumno_Examenes.SELECT_BY_ALUMNO_EXAMEN(this.Oid); IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code)); _respuestas = Respuesta_Alumno_Examenes.GetChildList(reader); } } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }