// called to retrieve data from the database private void DataPortal_Fetch(CriteriaEx criteria) { try { SessionCode = criteria.SessionCode; Childs = criteria.Childs; if (nHMng.UseDirectSQL) { Submodulo.DoLOCK(Session()); IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session()); if (reader.Read()) { _base.CopyValues(reader); } if (Childs) { string query; Tema.DoLOCK(Session()); query = Temas.SELECT_BY_OID(this.Oid); reader = nHManager.Instance.SQLNativeSelect(query, Session()); _temas = Temas.GetChildList(reader); } } else { _base.Record.CopyValues((SubmoduloRecord)(criteria.UniqueResult())); //Session().Lock(Session().Get<SubmoduloRecord>(Oid), LockMode.UpgradeNoWait); if (Childs) { criteria = Tema.GetCriteria(Session()); criteria.AddEq("OidSubmodulo", this.Oid); _temas = Temas.GetChildList(criteria.List <Tema>()); } } } 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> /// Retrieve the complete list from db /// </summary> /// <returns>SubmoduloList</returns> public static TemaList GetModuloList(long oid_modulo, bool childs) { CriteriaEx criteria = Tema.GetCriteria(TemaList.OpenSession()); criteria.Childs = childs; criteria.Query = Temas.SELECT_BY_MODULO(oid_modulo); //No criteria. Retrieve all de List TemaList list = DataPortal.Fetch <TemaList>(criteria); CloseSession(criteria.SessionCode); return(list); }
private void Fetch(Submodulo source) { try { SessionCode = source.SessionCode; _base.CopyValues(source); CriteriaEx criteria; criteria = Tema.GetCriteria(Session()); criteria.AddEq("OidSubmodulo", this.Oid); _temas = Temas.GetChildList(criteria.List <Tema>()); } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }
private void Fetch(int session_code, IDataReader source) { try { _base.CopyValues(source); if (Childs) { string query; Tema.DoLOCK(Session(session_code)); query = Temas.SELECT_BY_SUBMODULO(this.Oid); IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code)); _temas = Temas.GetChildList(reader, GChilds); } } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }
public static string SELECT_BY_SUBMODULO(long oid_submodulo) { return(Temas.SELECT_BY_SUBMODULO(oid_submodulo, false)); }