public Models.Asunto Select(Int32 t382_idasunto) { OpenDbConn(); DAL.Asunto cAsuntoPE = new DAL.Asunto(cDblib); return(cAsuntoPE.Select(t382_idasunto)); }
public int grabar(Models.Asunto DatosGenerales, List <Models.AsuntoRecursos> 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.Asunto oAsunto = new DAL.Asunto(cDblib); DAL.AsuntoEstado oAsuntoEstadoDAL = new DAL.AsuntoEstado(cDblib); DAL.AsuntoRecursos oRecursoDAL = new DAL.AsuntoRecursos(cDblib); Models.AsuntoEstado oAsuntoEstado = new Models.AsuntoEstado(); oAsuntoEstado.T385_codestado = byte.Parse(DatosGenerales.T382_estado); oAsuntoEstado.T385_idautor = (int)HttpContext.Current.Session["NUM_EMPLEADO_ENTRADA"]; if (DatosGenerales.T382_idasunto == -1) { idReferencia = oAsunto.Insert(DatosGenerales); oAsuntoEstado.T382_idasunto = idReferencia; oAsuntoEstadoDAL.Insert(oAsuntoEstado); } else { oAsunto.Update(DatosGenerales); idReferencia = DatosGenerales.T382_idasunto; if (DatosGenerales.T382_estado_anterior != DatosGenerales.T382_estado) { oAsuntoEstado.T382_idasunto = idReferencia; oAsuntoEstadoDAL.Insert(oAsuntoEstado); } } foreach (Models.AsuntoRecursos oRecurso in Integrantes) { switch (oRecurso.accionBD) { case "I": //Inserción oRecurso.T382_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(); } }