コード例 #1
0
        private void txtId_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((int)e.KeyChar == (int)Keys.Enter)
            {
                Cliente cliente = new Cliente();
                BusquedaClienteRespuesta consulta = new BusquedaClienteRespuesta();
                consulta = clienteService.BuscarPorIdentificacion(txtId.Text);
                if (!consulta.Error)
                {
                    cliente = consulta.Cliente;
                    cmboTipo.SelectedItem = cliente.TipoIdentificacion;
                    txtname.Text          = cliente.Nombre;
                    txtApellido.Text      = cliente.Apellidos;
                    txtBarrio.Text        = cliente.Barrio;
                    txtDirecciòn.Text     = cliente.Direccion;
                    txtTelefono.Text      = cliente.Telefono;
                    txtEmail.Text         = cliente.Email;
                }
                else
                {
                    MessageBox.Show("Cliente no esta registrado ", " Atención", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    Limpiar();
                }
            }



            if (!Char.IsDigit(e.KeyChar) &&
                e.KeyChar != (char)Keys.Back &&
                e.KeyChar != '-')
            {
                e.Handled = true;
            }
            else
            {
                if (e.KeyChar == '-')
                {
                    if (((TextBox)sender).Text.Contains('-'))
                    {
                        e.Handled = true;
                    }
                    else
                    {
                        e.Handled = false;
                    }
                }
            }
        }
コード例 #2
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            var            respuesta = clienteService.BuscarPorIdentificacion(txtId.Text);
            List <Cliente> clientes  = new List <Cliente>();

            if ((respuesta.Error))
            {
                MessageBox.Show("No existe el cliente ", "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (txtId.Text.Equals(""))
            {
                MessageBox.Show("Debe digitar una identifiacion ", "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                clientes.Add(respuesta.Cliente);
                dtgcliente.DataSource = clientes;
                //TxtTotal.Text = clienteService.Totalizar().Cuenta.ToString();
                //txtId.Text = clienteService.TotalizarTipo("F").Cuenta.ToString();
            }
        }
コード例 #3
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            Cliente cliente = new Cliente();
            BusquedaClienteRespuesta consulta = new BusquedaClienteRespuesta();

            consulta = service.BuscarPorIdentificacion(txtNumeroDoc.Text);
            if (!consulta.Error)
            {
                cliente = consulta.Cliente;
                txtNombreCliente.Text   = cliente.Nombre;
                txtApellido.Text        = cliente.Apellidos;
                txtBarrioCliente.Text   = cliente.Barrio;
                txtDireccion.Text       = cliente.Direccion;
                txtTelefonoCliente.Text = cliente.Telefono;
            }
            else
            {
                MessageBox.Show("Cliente no esta registrado ", " Atención", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                txtNumeroDoc.Text = "";
            }
        }