public static List <Persona> filtrarCliente(Persona per) { try { return(PersonaDAO.GetByFiltro(per)); } catch (ApplicationException ex) { throw new ApplicationException(ex.Message); } }
private void btn_aplicar_filtro_empresa_Click(object sender, EventArgs e) { Persona per = new Persona(); if (txt_apellido.Text != "") { per.Apellido = txt_apellido.Text; } if (txt_nombre.Text != "") { per.Nombre = txt_nombre.Text; } if (txt_cuit.Text != " - -") { per.cuil = txt_cuit.Text; } if (txt_razon_social.Text != "") { per.RazonSocial = txt_razon_social.Text; } List <Persona> resul = null; try { resul = PersonaDAO.GetByFiltro(per); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } if (resul.Count == 1) { res = resul.ElementAt <Persona>(0); txt_apellido.Text = res.Apellido; txt_nombre.Text = res.Nombre; txt_razon_social.Text = res.RazonSocial; cmb_iva.SelectedValue = res.condicionIVA.idCondicionIVA; txt_cuit.Text = res.cuil; } else { ResultadoDeFiltro resFiltro = new ResultadoDeFiltro(); resFiltro._resultado = resul; resFiltro.ShowDialog(); res = Vista.iniciador.per; resultado = res; if (res != null) { txt_apellido.Text = res.Apellido; txt_nombre.Text = res.Nombre; txt_razon_social.Text = res.RazonSocial; txt_cuit.Text = res.cuil; cmb_iva.SelectedValue = res.condicionIVA.idCondicionIVA; } } btn_agregar.Enabled = true; txt_cantidad.Enabled = true; dgv_productos_finales.Enabled = true; dgv_detalle.Enabled = true; }