public bool Insertar(BEDocumento beDocumento, DBHelper.DatabaseHelper pDatabaseHelper) { DatabaseHelper oDatabaseHelper = (pDatabaseHelper == null) ? new DatabaseHelper() : pDatabaseHelper; DAAmortizacionVenta DAVenta = new DAAmortizacionVenta(); bool bOk = true; try { if (pDatabaseHelper == null) { oDatabaseHelper.BeginTransaction(); } bOk = DAVenta.InsertarCabeceraDocumento(beDocumento, oDatabaseHelper); foreach (BEAmortizacionVenta oEntidad in beDocumento.delleAmortizacion) { bOk = bOk && new DAAmortizacionVenta().InsertarDependiente(beDocumento, oEntidad, oDatabaseHelper); BEVenta oBEVenta = new BEVenta() { IdVenta = oEntidad.IdVenta, BEUsuarioLogin = oEntidad.BEUsuarioLogin }; bOk = bOk && (new DAVenta().InsertarVentaFinal(oBEVenta, oDatabaseHelper) > 0); // Opcional bOk = bOk && (new DAVenta().ActualizarEstado(oBEVenta.IdVenta, oDatabaseHelper, oEntidad.CancelarVenta) > 0); } // if (bOk) { if (pDatabaseHelper == null) { oDatabaseHelper.CommitTransaction(); } } else { if (pDatabaseHelper == null) { oDatabaseHelper.RollbackTransaction(); } throw new Exception("Error al registrar Amortización"); } return(bOk); } catch (Exception ex) { if (pDatabaseHelper == null) { oDatabaseHelper.RollbackTransaction(); } throw ex; } finally { if (pDatabaseHelper == null) { oDatabaseHelper.Dispose(); } } }
public List <BEVenta> ListarVenta(int pIdVenta, int pIdCaja, DBHelper.DatabaseHelper pDatabaseHelper) { try { return(new DAVenta().ListarVenta(pIdVenta, pIdCaja, pDatabaseHelper)); } catch (Exception ex) { throw ex; } }
public int Insertar(List <BEAmortizacionVenta> pLista, DBHelper.DatabaseHelper pDatabaseHelper) { int intResultado = 0; DatabaseHelper oDatabaseHelper = (pDatabaseHelper == null) ? new DatabaseHelper() : pDatabaseHelper; try { int intCantidad = 0; int intTotal = pLista.Count * 2; if (pDatabaseHelper == null) { oDatabaseHelper.BeginTransaction(); } foreach (BEAmortizacionVenta oEntidad in pLista) { intCantidad += new DAAmortizacionVenta().InsertarDependiente(oEntidad, oDatabaseHelper); BEVenta oBEVenta = new BEVenta(); oBEVenta.IdVenta = oEntidad.IdVenta; oBEVenta.BEUsuarioLogin = oEntidad.BEUsuarioLogin; intCantidad += new DAVenta().InsertarVentaFinal(oBEVenta, oDatabaseHelper); // Opcional int intTemporal = new DAVenta().ActualizarEstado(oBEVenta.IdVenta, oDatabaseHelper, oEntidad.CancelarVenta); } intResultado += (intCantidad == intTotal) ? 1 : 0; // if (intResultado == 1) { if (pDatabaseHelper == null) { oDatabaseHelper.CommitTransaction(); } } else { if (pDatabaseHelper == null) { oDatabaseHelper.RollbackTransaction(); } else { throw new Exception("Error al registrar Amortización"); } } return(intResultado); } catch (Exception ex) { if (pDatabaseHelper == null) { oDatabaseHelper.RollbackTransaction(); } throw ex; } finally { if (pDatabaseHelper == null) { oDatabaseHelper.Dispose(); } } }
public bool Eliminar(BEAmortizacionVenta amort, DBHelper.DatabaseHelper dbh) { try { return(new DAAmortizacionVenta().EliminarAmortizacionesVenta(amort, dbh)); } catch (Exception ex) { throw ex; } }
public bool ActualizarCabecera(BEDocumento beDocumento, DBHelper.DatabaseHelper dbh) { try { return(new DADocumentoPago().ActualizarCabeceraDocumento(beDocumento, dbh)); } catch (Exception ex) { throw ex; } }