public static Venta GetVentaById(int ventaID) { VentaTableAdapter localAdapter = new VentaTableAdapter(); if (ventaID <= 0) { return(null); } Venta theUser = null; try { VentaDS.VentaDataTable table = localAdapter.GetVentaById(ventaID); if (table != null && table.Rows.Count > 0) { VentaDS.VentaRow row = table[0]; theUser = FillVentaRecord(row); } } catch (Exception q) { log.Error("An error was ocurred while geting venta data", q); return(null); } return(theUser); }
private static Venta FillVentaRecord(VentaDS.VentaRow row) { Venta theNewRecord = new Venta( row.ventaId, row.IsnombreClienteNull() ? "" : row.nombreCliente, row.IsapellidoClienteNull() ? "" : row.apellidoCliente, row.nit, row.montoTotal, row.IspagoTotalNull() ? 0 : row.pagoTotal, row.IsmontoDescuentoNull() ? 0 : row.montoCambio, row.IsmontoDescuentoNull() ? 0 : row.montoDescuento, row.IsfechaPedidoNull() ? DateTime.MinValue : row.fechaPedido, row.IsfechaEntregaNull() ? DateTime.MinValue : row.fechaEntrega, row.IsfechaAnulacionNull() ? DateTime.MinValue : row.fechaAnulacion, row.IsestadoNull() ? "" : row.estado, row.IslatitudNull() ? 0 : row.latitud, row.IslongitudNull() ? 0 : row.longitud); return(theNewRecord); }