private void ConsultarXcliente() { string encontro = "no"; string Cliente_id = txtID.Text; respuesta1 = detalleFacturaService.Consultar(); LisDetalleFacturas = respuesta1.detalle.ToList(); respuesta = facturaService.Consultar(); facturas = respuesta.factura.ToList(); foreach (var item in facturas) { if (Cliente_id == item.cliente.Identificacion) { dtgFacturas.Rows.Add(item.Factura_id, item.Totales, item.Fecha, item.cliente.Identificacion, item.FormaPago); foreach (var items in LisDetalleFacturas) { if (item.Factura_id == items.CodigoFactura) { DtgDetallesFacturas.Rows.Add(items.DetalleFac_id, items.productos.Productos_id, items.productos.Nombre, items.productos.Tipo, items.productos.Precio_venta, items.Cantidad, items.Total, items.CodigoFactura); } } encontro = "si"; } } if (encontro == "no") { MessageBox.Show("No hay Factura con ese Id"); DtgDetallesFacturas.Columns.Clear(); dtgFacturas.Columns.Clear(); } }
private void ConsultarXfecha() { string encontro = "no"; txtID.Text = ""; comboTipo.Text = "..."; DateTime fecha = Convert.ToDateTime(fechaDatetime.Text); respuesta1 = detalleFacturaService.Consultar(); LisDetalleFacturas = respuesta1.detalle.ToList(); respuesta = facturaService.Consultar(); facturas = respuesta.factura.ToList(); foreach (var item in facturas) { if (fecha == item.Fecha) { encontro = "si"; dtgFacturas.Rows.Add(item.Factura_id, item.Totales, item.Fecha, item.cliente.Identificacion, item.FormaPago); foreach (var items in LisDetalleFacturas) { if (item.Factura_id == items.CodigoFactura) { DtgDetallesFacturas.Rows.Add(items.DetalleFac_id, items.productos.Productos_id, items.productos.Nombre, items.productos.Tipo, items.productos.Precio_venta, items.Cantidad, items.Total, items.CodigoFactura); } } } } if (encontro == "no") { DtgDetallesFacturas.Columns.Clear(); dtgFacturas.Columns.Clear(); MessageBox.Show("No hay Factura con esa fecha"); } }
public ConsultaDetalleFcturaRespuesta Consultar() { ConsultaDetalleFcturaRespuesta respuesta = new ConsultaDetalleFcturaRespuesta(); try { conexion.Open(); respuesta.detalle = repositorio.Consultar(); conexion.Close(); respuesta.Error = false; if (respuesta.detalle.Count > 0) { respuesta.Mensaje = "Se consultan los Datos"; } else { respuesta.Mensaje = "No hay datos para consultar"; } respuesta.Error = false; return(respuesta); } catch (Exception e) { respuesta.Mensaje = $"Error de la Aplicacion: {e.Message}"; respuesta.Error = true; return(respuesta); } finally { conexion.Close(); } }
public FrmConsultarVentas() { InitializeComponent(); facturaService = new FacturaService(ConfigConnection.connectionString, ConfigConnection.ProviderName); detalleFacturaService = new DetalleFacturaService(ConfigConnection.connectionString, ConfigConnection.ProviderName); respuesta1 = new ConsultaDetalleFcturaRespuesta(); respuesta = new ConsultaFcturaRespuesta(); facturas = new List <Factura>(); LisDetalleFacturas = new List <DetalleFactura>(); }
private void ConsultarTodo() { respuesta = facturaService.Consultar(); facturas = respuesta.factura.ToList(); respuesta1 = detalleFacturaService.Consultar(); LisDetalleFacturas = respuesta1.detalle.ToList(); foreach (var item in facturas) { dtgFacturas.Rows.Add(item.Factura_id, item.Totales, item.Fecha, item.cliente.Identificacion, item.FormaPago); } foreach (var item in LisDetalleFacturas) { DtgDetallesFacturas.Rows.Add(item.DetalleFac_id, item.productos.Productos_id, item.productos.Nombre, item.productos.Tipo, item.productos.Precio_venta, item.Cantidad, item.Total, item.CodigoFactura); } }