private void btnBuscar_Click(object sender, EventArgs e)
 {
     if (!TextFieldUtils.IsValidTextField(txtApellido, txtNombre) || !TextFieldUtils.IsValidNumericField(txtDNI))
     {
         MessageBox.Show("Por favor revise los datos de entrada");
     }
     else
     {
         if (!TextFieldUtils.AreAllFieldsEmpty(this))
         {
             try
             {
                 string    query = StringUtil.FormatClienteListado(txtNombre.Text, txtApellido.Text, txtMail.Text, txtDNI.Text);
                 DataTable dt    = ConnectionFactory.Instance()
                                   .CreateConnection()
                                   .ExecuteDataTableSqlQuery(query);
                 dgvClientes.AllowUserToAddRows = false;
                 dgvClientes.ReadOnly           = true;
                 dgvClientes.DataSource         = dt;
             }
             catch (SqlQueryException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK); }
         }
         else
         {
             MessageBox.Show("Introduzca al menos un dato");
         }
     }
 }
Beispiel #2
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            if (!TextFieldUtils.AreAllFieldsEmpty(this))
            {
                try
                {
                    var cuit  = StringUtil.FormatCuil(txtCUIT2.Text + txtCUIT1.Text + txtCUIT3.Text);
                    var query = StringUtil.FormatEmpresaListado(txtRazonSocial.Text,
                                                                StringUtil.FormatCuil(txtCUIT2.Text + txtCUIT1.Text + txtCUIT3.Text),
                                                                txtMail.Text);

                    DataTable dt = ConnectionFactory.Instance()
                                   .CreateConnection()
                                   .ExecuteDataTableSqlQuery(query);
                    dgvEmpresas.AllowUserToAddRows = false;
                    dgvEmpresas.ReadOnly           = true;
                    dgvEmpresas.DataSource         = dt;
                }
                catch (SqlQueryException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK); }
            }
            else
            {
                MessageBox.Show("Debe introducir al menos un dato");
            }
        }
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            if (!TextFieldUtils.IsValidTextField(txtRazonSocial) ||
                !TextFieldUtils.IsValidNumericField(txtCUIT1, txtCUIT2, txtCUIT3))
            {
                MessageBox.Show("Por favor revise los datos ingresados");
            }
            else
            {
                if (!TextFieldUtils.AreAllFieldsEmpty(this))
                {
                    try
                    {
                        string query = StringUtil.FormatEmpresaListado(txtRazonSocial.Text,
                                                                       StringUtil.FormatCuil(txtCUIT1.Text + txtCUIT2.Text + txtCUIT3.Text),
                                                                       txtMail.Text);
                        DataTable dt = ConnectionFactory.Instance()
                                       .CreateConnection()
                                       .ExecuteDataTableSqlQuery(query);

                        dgvEmpresas.AllowUserToAddRows = false;
                        dgvEmpresas.ReadOnly           = true;
                        dgvEmpresas.DataSource         = dt;
                    }
                    catch (SqlQueryException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK); }
                }
                else
                {
                    MessageBox.Show("Introduzca al menos un dato");
                }
            }
        }