public List <Models.AccionRecursosT> Catalogo(Models.AccionRecursosT oAccionRecursos) { OpenDbConn(); DAL.AccionRecursosT cAccionRecursos = new DAL.AccionRecursosT(cDblib); List <Models.AccionRecursosT> oLista = cAccionRecursos.Catalogo(oAccionRecursos); return(oLista); }
public int grabar(Models.AccionT DatosGenerales, List <Models.AccionRecursosT> Integrantes) { int idReferencia; bool bConTransaccion = false; Guid methodOwnerID = new Guid("9BA8A99E-6FE6-41EC-BDA6-1A123F0E7C9A"); OpenDbConn(); if (cDblib.Transaction.ownerID.Equals(new Guid())) { bConTransaccion = true; } if (bConTransaccion) { cDblib.beginTransaction(methodOwnerID); } try { DAL.AccionT oAccion = new DAL.AccionT(cDblib); DAL.AccionRecursosT oRecursoDAL = new DAL.AccionRecursosT(cDblib); if (DatosGenerales.T601_idaccion == -1) { DatosGenerales.T601_fcreacion = System.DateTime.Now; idReferencia = oAccion.Insert(DatosGenerales); } else { oAccion.Update(DatosGenerales); idReferencia = DatosGenerales.T601_idaccion; } foreach (Models.AccionRecursosT oRecurso in Integrantes) { switch (oRecurso.accionBD) { case "I": //Inserción oRecurso.t601_idaccion = idReferencia; oRecursoDAL.Insert(oRecurso); break; case "D": //delete oRecursoDAL.Delete(oRecurso); break; case "U": //update oRecursoDAL.Update(oRecurso); break; } } if (bConTransaccion) { cDblib.commitTransaction(methodOwnerID); } return(idReferencia); } catch (Exception ex) { //rollback if (cDblib.Transaction.ownerID.Equals(methodOwnerID)) { cDblib.rollbackTransaction(methodOwnerID); } throw new Exception(ex.Message); } finally { //nota.Dispose(); } }