private void DataPortal_Delete(CriteriaCs criterio) { try { //Iniciamos la conexion y la transaccion SessionCode = OpenSession(); BeginTransaction(); CriteriaEx criteria = GetCriteria(); criteria.AddOidSearch(criterio.Oid); // Obtenemos el objeto RevisionMaterialRecord obj = (RevisionMaterialRecord)(criteria.UniqueResult()); Session().Delete(Session().Get <RevisionMaterialRecord>(obj.Oid)); Transaction().Commit(); } catch (Exception ex) { if (Transaction() != null) { Transaction().Rollback(); } iQExceptionHandler.TreatException(ex); } finally { CloseSession(); } }
internal void Update(MaterialDocente parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } //Debe obtener la sesion del padre pq el objeto es padre a su vez SessionCode = parent.SessionCode; OidMaterial = parent.Oid; try { ValidationRules.CheckRules(); if (!IsValid) { throw new iQValidationException(moleQule.Library.Resources.Messages.GENERIC_VALIDATION_ERROR); } RevisionMaterialRecord obj = parent.Session().Get <RevisionMaterialRecord>(Oid); obj.CopyValues(this.Base.Record); parent.Session().Update(obj); _materiales.Update(this); } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }
public virtual void CopyValues(RevisionMaterialRecord source) { if (source == null) { return; } Oid = source.Oid; _oid_material = source.OidMaterial; _version = source.Version; _fecha = source.Fecha; _autor = source.Autor; _observaciones = source.Observaciones; }
protected override void DataPortal_Update() { if (IsDirty) { try { RevisionMaterialRecord obj = Session().Get <RevisionMaterialRecord>(Oid); obj.CopyValues(this.Base.Record); Session().Update(obj); } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } } }