/// <summary> /// Construye el objeto y se encarga de obtener los /// hijos si los tiene y se solicitan /// </summary> /// <param name="source">Objeto fuente</param> private void Fetch(Cash source) { try { SessionCode = source.SessionCode; _base.CopyValues(source); if (Childs) { if (nHMng.UseDirectSQL) { CashLine.DoLOCK(Session()); string query = CashLines.SELECT(this); IDataReader reader = nHMng.SQLNativeSelect(query, Session()); _lines = CashLines.GetChildList(reader, false); } } } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }
private void Fetch(CierreCaja source) { try { SessionCode = source.SessionCode; _base.CopyValues(source); if (Childs) { if (nHMng.UseDirectSQL) { CashLine.DoLOCK(Session()); string query = CashLines.SELECT_BY_CIERRE(this.Oid); IDataReader reader = nHMng.SQLNativeSelect(query, Session()); _lineas = CashLines.GetChildList(reader, false); } else { CriteriaEx criteria = CashLine.GetCriteria(Session()); criteria.AddEq("OidCierre", this.Oid); _lineas = CashLines.GetChildList(criteria.List <CashLine>()); } UpdateSaldo(); } } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }
private void Fetch(IDataReader source) { try { _base.CopyValues(source); if (Childs) { if (nHMng.UseDirectSQL) { CashLine.DoLOCK(Session()); string query = CashLines.SELECT_BY_CIERRE(this.Oid); IDataReader reader = nHMng.SQLNativeSelect(query, Session()); _lineas = CashLines.GetChildList(reader, false); } UpdateSaldo(); } } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }
/// <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) { Cash.DoLOCK(Session()); IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session()); if (reader.Read()) { _base.CopyValues(reader); } #if TRACE ControlerBase.AppControler.Timer.Record("Caja.CopyValues"); #endif if (Childs) { string query = string.Empty; CashLine.DoLOCK(Session()); query = CashLines.SELECT_BY_CAJA(Oid); reader = nHMng.SQLNativeSelect(query, Session()); #if TRACE ControlerBase.AppControler.Timer.Record("LineaCajas.SQLNativeSelect"); #endif _lines = CashLines.GetChildList(reader); #if TRACE ControlerBase.AppControler.Timer.Record("LineaCajas.GetChildList"); #endif } UpdateSaldo(); #if TRACE ControlerBase.AppControler.Timer.Record("UpdateSaldo"); #endif } } catch (Exception ex) { if (!SharedTransaction && Transaction() != null) { Transaction().Rollback(); } iQExceptionHandler.TreatException(ex, new object[] { criteria.Query }); } }
/// <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) { CierreCaja.DoLOCK(Session()); IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session()); if (reader.Read()) { _base.CopyValues(reader); } if (Childs) { string query = string.Empty; CashLine.DoLOCK(Session()); query = CashLines.SELECT_BY_CIERRE(this.Oid); reader = nHMng.SQLNativeSelect(query, Session()); _lineas = CashLines.GetChildList(reader); } } UpdateSaldo(); MarkOld(); } catch (Exception ex) { if (!SharedTransaction && Transaction() != null) { Transaction().Rollback(); } iQExceptionHandler.TreatException(ex); } }