public List <Models.ReceptoresAvisos> Catalogo() { OpenDbConn(); DAL.ReceptoresAvisos cReceptoresAvisos = new DAL.ReceptoresAvisos(cDblib); return(cReceptoresAvisos.Catalogo()); }
public void GrabarLista(List <Models.ReceptoresAvisos> Lista) { bool bConTransaccion = false; Guid methodOwnerID = new Guid("2E4127AD-00E3-40CD-B964-551B92CA8ABF"); OpenDbConn(); if (cDblib.Transaction.ownerID.Equals(new Guid())) { bConTransaccion = true; } if (bConTransaccion) { cDblib.beginTransaction(methodOwnerID); } DAL.ReceptoresAvisos bReceptor = new DAL.ReceptoresAvisos(cDblib); try { foreach (Models.ReceptoresAvisos oElem in Lista) { bReceptor.Update(oElem); } if (bConTransaccion) { cDblib.commitTransaction(methodOwnerID); } } catch (Exception ex) { if (cDblib.Transaction.ownerID.Equals(methodOwnerID)) { cDblib.rollbackTransaction(methodOwnerID); } throw new Exception(ex.Message); } finally { //bReceptor.Dispose(); } }
public int Update(Models.ReceptoresAvisos oReceptoresAvisos) { Guid methodOwnerID = new Guid("D8198EC4-92C4-49ED-9054-2C550CE39AFD"); OpenDbConn(); if (cDblib.Transaction.ownerID.Equals(new Guid())) { cDblib.beginTransaction(methodOwnerID); } try { DAL.ReceptoresAvisos cReceptoresAvisos = new DAL.ReceptoresAvisos(cDblib); int result = cReceptoresAvisos.Update(oReceptoresAvisos); //Finalizar transacción if (cDblib.Transaction.ownerID.Equals(methodOwnerID)) { cDblib.commitTransaction(methodOwnerID); } return(result); } catch (Exception ex) { //rollback if (cDblib.Transaction.ownerID.Equals(methodOwnerID)) { cDblib.rollbackTransaction(methodOwnerID); } throw ex; } }