public List <Models.AsuntoEstadoT> Catalogo(int t600_idasunto) { OpenDbConn(); DAL.AsuntoEstadoT cAsuntoEstado = new DAL.AsuntoEstadoT(cDblib); List <Models.AsuntoEstadoT> oLista = cAsuntoEstado.Catalogo(t600_idasunto); return(oLista); }
public int grabar(Models.AsuntoT DatosGenerales, List <Models.AsuntoRecursosT> Integrantes) { 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.AsuntoT oAsunto = new DAL.AsuntoT(cDblib); DAL.AsuntoEstadoT oAsuntoEstadoDAL = new DAL.AsuntoEstadoT(cDblib); DAL.AsuntoRecursosT oRecursoDAL = new DAL.AsuntoRecursosT(cDblib); Models.AsuntoEstadoT oAsuntoEstado = new Models.AsuntoEstadoT(); oAsuntoEstado.t606_estado = byte.Parse(DatosGenerales.T600_estado); oAsuntoEstado.t314_idusuario = (int)HttpContext.Current.Session["NUM_EMPLEADO_ENTRADA"]; if (DatosGenerales.T600_idasunto == -1) { idReferencia = oAsunto.Insert(DatosGenerales); oAsuntoEstado.t600_idasunto = idReferencia; oAsuntoEstadoDAL.Insert(oAsuntoEstado); } else { oAsunto.Update(DatosGenerales); idReferencia = DatosGenerales.T600_idasunto; if (DatosGenerales.T600_estado_anterior != DatosGenerales.T600_estado) { oAsuntoEstado.t600_idasunto = idReferencia; oAsuntoEstadoDAL.Insert(oAsuntoEstado); } } foreach (Models.AsuntoRecursosT oRecurso in Integrantes) { switch (oRecurso.accionBD) { case "I": //Inserción oRecurso.T600_idasunto = 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(new Guid())) { cDblib.rollbackTransaction(methodOwnerID); } throw new Exception(ex.Message); } finally { //nota.Dispose(); } }