public static bool actualizarRegistroMaestroDetalle(eCOMPRA oeCOMPRA, List <eDETALLE_COMPRA> oeDETALLE_COMPRA) { bool bandera = true; bool flag = false; ValidationResult result = _balCOMPRA.Validate(oeCOMPRA); for (int i = 0; i < oeDETALLE_COMPRA.Count; i++) { eDETALLE_COMPRA o = new eDETALLE_COMPRA(); o = oeDETALLE_COMPRA[i]; ValidationResult result2 = _balDETALLE_COMPRA.Validate(o); if (!result2.IsValid) { bandera = false; } } if (bandera && result.IsValid) { if (_dalCOMPRA.obtenerRegistro(oeCOMPRA).Rows.Count > 0) { if (_dalCOMPRA.actualizarRegistroMaestroDetalle(oeCOMPRA, oeDETALLE_COMPRA)) { flag = true; } else { throw new CustomException("El registro no se pudo actualizar."); } } else { throw new CustomException("El registro que desea actualizar no existe."); } } else { throw new CustomException(CustomException.getMensajeList(result)); } return(flag); }
public static bool insertarRegistroMaestroDetalle(eVENTA oeVENTA, List <eDETALLE_VENTA> oeDETALLE_VENTA) { bool bandera = true; bool flag = false; ValidationResult result = _balVENTA.Validate(oeVENTA); for (int i = 0; i < oeDETALLE_VENTA.Count; i++) { eDETALLE_VENTA o = new eDETALLE_VENTA(); o = oeDETALLE_VENTA[i]; ValidationResult result2 = _balDETALLE_VENTA.Validate(o); if (!result2.IsValid) { bandera = false; } } if (bandera && result.IsValid) { if (_dalVENTA.obtenerRegistro(oeVENTA).Rows.Count == 0) { if (_dalDETALLE_VENTA.insertarRegistroMaestroDetalle(oeVENTA, oeDETALLE_VENTA)) { flag = true; } else { throw new CustomException("El registro no se pudo insertar."); } } else { throw new CustomException("El registro que desea insertar ya existe."); } } else { throw new CustomException(CustomException.getMensajeList(result)); } return(flag); }
public static bool actualizarFila(eDETALLE_IMPUESTO oeDETALLE_IMPUESTO) { ValidationResult result = _balDETALLE_IMPUESTO.Validate(oeDETALLE_IMPUESTO); bool flag = false; if (result.IsValid) { if (_dalDETALLE_IMPUESTO.actualizarFila(oeDETALLE_IMPUESTO)) { flag = true; } else { throw new CustomException("El registro que desea insertar ya existe."); } } else { throw new CustomException(CustomException.getMensajeList(result)); } return(flag); }