private void Fetch(IDataReader source) { _base.CopyValues(source); if (Childs) { if (nHMng.UseDirectSQL) { WorkReportResource.DoLOCK(Session()); string query = WorkReportResources.SELECT(this); IDataReader reader = nHMng.SQLNativeSelect(query); _lines = WorkReportResources.GetChildList(SessionCode, reader); } } MarkOld(); }
/// <summary> /// Borra el registro de la base de datos /// </summary> /// <param name="parent">Lista padre</param> /// <remarks>La utiliza la BusinessListBaseEx correspondiente para borrar elementos<remarks/> internal void DeleteSelf(WorkReportResources parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } // if we're new then don't update the database if (this.IsNew) { return; } SessionCode = parent.SessionCode; Session().Delete(Session().Get <WorkReportResourceRecord>(Oid)); MarkNew(); }
/// <summary> /// Inserta el registro en la base de datos /// </summary> /// <param name="parent">Lista padre</param> /// <remarks>La utiliza la BusinessListBaseEx correspondiente para insertar elementos<remarks/> internal void Insert(WorkReportResources parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } ValidationRules.CheckRules(); if (!IsValid) { throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR); } parent.Session().Save(Base.Record); MarkOld(); }
private void DataPortal_Fetch(CriteriaEx criteria) { try { Oid = 0; SessionCode = criteria.SessionCode; Childs = criteria.Childs; if (nHMng.UseDirectSQL) { //WorkReport.DoLOCK(Session()); IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session()); if (reader.Read()) { _base.CopyValues(reader); } if (Childs) { string query = string.Empty; //WorkReportResource.DoLOCK(Session()); query = WorkReportResources.SELECT(this); reader = nHMng.SQLNativeSelect(query); _lines = WorkReportResources.GetChildList(SessionCode, reader); } } MarkOld(); } catch (Exception ex) { if (Transaction() != null) { Transaction().Rollback(); } iQExceptionHandler.TreatException(ex, new object[] { criteria.Query }); } }
/// <summary> /// Actualiza el registro en la base de datos /// </summary> /// <param name="parent">Lista padre</param> /// <remarks>La utiliza la BusinessListBaseEx correspondiente para actualizar elementos<remarks/> internal void Update(WorkReportResources parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } ValidationRules.CheckRules(); if (!IsValid) { throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR); } SessionCode = parent.SessionCode; WorkReportResourceRecord obj = Session().Get <WorkReportResourceRecord>(Oid); obj.CopyValues(Base.Record); Session().Update(obj); MarkOld(); }