Beispiel #1
0
        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 MostrarDatos()
        {
            int codigoFactura = Convert.ToInt32(this.dtgrFactura.CurrentRow.Cells["codigo"].Value);
            var respuesta     = new BLL.DetalleFacturaService.Respuesta();

            respuesta = detalleServicio.Consultar();
            if (!respuesta.IsError)
            {
                //dataGridClientes.DataSource = null;

                dtgrDetalleFactura.DataSource = respuesta.Detalles.Where(p => p.CodigoFactura == codigoFactura).ToList();
                dtgrDetalleFactura.Refresh();
            }
            else
            {
                MessageBox.Show(respuesta.Mensaje, respuesta.Mensaje, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }