public List <Models.AccionTareas> Catalogo(Int32 idAccion) { OpenDbConn(); DAL.AccionTareas cAccionTareas = new DAL.AccionTareas(cDblib); List <Models.AccionTareas> oLista = cAccionTareas.Catalogo(idAccion); return(oLista); }
public int grabar(Models.Accion DatosGenerales, List <Models.AccionRecursos> Integrantes, List <Models.AccionTareas> Tareas) { int idReferencia; bool bConTransaccion = false; Guid methodOwnerID = new Guid("5590F1B4-7073-4B5F-A4DB-9F301648D151"); OpenDbConn(); if (cDblib.Transaction.ownerID.Equals(new Guid())) { bConTransaccion = true; } if (bConTransaccion) { cDblib.beginTransaction(methodOwnerID); } try { DAL.Accion oAccion = new DAL.Accion(cDblib); DAL.AccionRecursos oRecursoDAL = new DAL.AccionRecursos(cDblib); DAL.AccionTareas oTareaDAL = new DAL.AccionTareas(cDblib); if (DatosGenerales.t383_idaccion == -1) { DatosGenerales.t383_fcreacion = System.DateTime.Now; idReferencia = oAccion.Insert(DatosGenerales); } else { oAccion.Update(DatosGenerales); idReferencia = DatosGenerales.t383_idaccion; } foreach (Models.AccionRecursos oRecurso in Integrantes) { switch (oRecurso.accionBD) { case "I": //Inserción oRecurso.T383_idaccion = idReferencia; oRecursoDAL.Insert(oRecurso); break; case "D": //delete oRecursoDAL.Delete(oRecurso); break; case "U": //update oRecursoDAL.Update(oRecurso); break; } } foreach (Models.AccionTareas oTarea in Tareas) { switch (oTarea.accionBD) { case "I": //Inserción oTareaDAL.Insert(oTarea); break; case "D": //delete oTareaDAL.Delete(oTarea); break; } } if (bConTransaccion) { cDblib.commitTransaction(methodOwnerID); } return(idReferencia); } catch (Exception ex) { //rollback if (cDblib.Transaction.ownerID.Equals(new Guid())) { cDblib.rollbackTransaction(methodOwnerID); } throw new Exception(ex.Message); } finally { //nota.Dispose(); } }