Example #1
0
        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_nro_doc.Text != "")
            {
                per.NroDoc = Convert.ToInt64(txt_nro_doc.Text);
            }
            per.TipoDoc = new TipoDocumento()
            {
                IDTipoDoc = (int)cmb_tipo_doc.SelectedValue
            };
            if (txt_razon_social.Text != "")
            {
                per.RazonSocial = txt_razon_social.Text;
            }

            if (txt_cuit.Text != "  -        -")
            {
                per.cuil = txt_cuit.Text;
            }

            //TipoDocumento tip = new TipoDocumento() { IDTipoDoc = 0 };

            //per.TipoDoc = tip;

            List <Persona> resul = null;

            try
            {
                resul = GestorDeFiltros.filtrarCliente(per);
            }
            catch (ApplicationException ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
            cargarGrillaFiltrada(resul);
        }
Example #2
0
        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_nro_doc.Text != "")
            {
                per.NroDoc = Convert.ToInt64(txt_nro_doc.Text);
            }
            per.TipoDoc = new TipoDocumento()
            {
                IDTipoDoc = (int)cmb_tipo_doc.SelectedValue
            };
            if (txt_razon_social.Text != "")
            {
                per.RazonSocial = txt_razon_social.Text;
            }

            if (txt_cuit.Text != "  -        -")
            {
                per.cuil = txt_cuit.Text;
            }


            List <Persona> resul = null;

            try
            {
                resul = GestorDeFiltros.filtrarCliente(per);
            }
            catch (ApplicationException ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }


            if (resul.Count == 1)
            {
                Persona res = resul.ElementAt <Persona>(0);

                txt_apellido.Text          = res.Apellido;
                txt_nombre.Text            = res.Nombre;
                txt_nro_doc.Text           = res.NroDoc.ToString();
                txt_razon_social.Text      = res.RazonSocial;
                cmb_tipo_doc.SelectedValue = res.TipoDoc.IDTipoDoc;
                txt_celular.Text           = res.tefefonoCelular.ToString();
            }
            else
            {
                ResultadoDeFiltro resFiltro = new ResultadoDeFiltro();
                resFiltro._resultado = resul;

                resFiltro.ShowDialog();

                Persona res = Vista.iniciador.per;
                resultado = res;
                if (res != null)
                {
                    txt_apellido.Text          = res.Apellido;
                    txt_nombre.Text            = res.Nombre;
                    txt_nro_doc.Text           = res.NroDoc.ToString();
                    txt_razon_social.Text      = res.RazonSocial;
                    cmb_tipo_doc.SelectedValue = res.TipoDoc.IDTipoDoc;
                    txt_celular.Text           = res.tefefonoCelular.ToString();
                }
            }
            dtp_fecha_necesidad.Enabled   = true;
            btn_agregar.Enabled           = true;
            txt_cantidad.Enabled          = true;
            dgv_productos_finales.Enabled = true;
            dgv_detalle.Enabled           = true;
        }