private void BuscarButton_Click(object sender, EventArgs e)
        {
            Cobradores cobrador = new Cobradores();

            if (IdTextBox.Text.Trim() == "")
            {
                CobradorerrorProvider.SetError(IdTextBox, "Especifica el Cliente Id");
                IdTextBox.Focus();
            }
            else
            {
                CobradorerrorProvider.Clear();
            }

            if (IdTextBox.TextLength > 0)
            {
                if (cobrador.Buscar(Validacion.ConvertirToInt(IdTextBox.Text)))
                {
                    DevolverDatos(cobrador);
                }
                GuardarButton.Enabled  = true;
                EliminarButton.Enabled = true;
            }
            else
            {
                MessageBox.Show("El id que busca no existe");
            }
        }
Example #2
0
        private void Buscarbutton_Click(object sender, EventArgs e)
        {
            Cobradores cobrador = new Cobradores();

            if (CobradorIdtextBox.Text.Trim() == "")
            {
                CobradorerrorProvider.SetError(CobradorIdtextBox, "Especificar CobradorId ");
                CobradorIdtextBox.Focus();
            }
            else
            {
                CobradorerrorProvider.Clear();
            }


            if (CobradorIdtextBox.TextLength > 0)
            {
                int id;
                int.TryParse(CobradorIdtextBox.Text, out id);
                cobrador.Buscar(id);
                NombretextBox.Text    = cobrador.Nombres;
                ApellidotextBox.Text  = cobrador.Apellidos;
                DirecciontextBox.Text = cobrador.Direccion;
                TelefonotextBox.Text  = cobrador.Telefono;
                CelulartextBox.Text   = cobrador.Celular;
                CedulatextBox.Text    = cobrador.Cedula;
            }
        }