private void txtRuc_Leave(object sender, EventArgs e)
        {
            Cliente cRegistrado = ClienteNEG.Instancia().VerificarPorRuc(txtPlaca.Text);

            if (txtPlaca.TextLength != 11)
            {
                MessageBox.Show("El RUC debe tener 11 digitos");
                //txtRuc.Focus();
            }
            else if (cRegistrado.idCliente > 0)
            {
                txtColor.Text = cRegistrado.Nombres;

                /*txtDireccion.Text = cRegistrado.Direccion;
                 * txtTelefono.Text = cRegistrado.Telefono;
                 * txtEmail.Text = cRegistrado.Email;*/
                txtId.Text = (cRegistrado.idCliente).ToString();

                MessageBox.Show("Ese RUC ya esta registrado");
            }

            /*else
             * {
             *
             *  txtNombre.Clear();
             *  txtDireccion.Clear();
             *  txtDepartamento.Clear();
             *  btnGuardar.Text = "Guardar";
             *
             * }*/
        }
        public void BuscarCliente()
        {
            Cliente c = new Cliente();

            c.Nombres = txtNombre_Busqueda.Text;
            c.Ruc     = txtRuc_Busqueda.Text;
            dgvClientes.DataSource = ClienteNEG.Instancia().Buscar(c);
        }
Esempio n. 3
0
        private void SeleccionarCliente_Load(object sender, EventArgs e)
        {
            //ClienteNEG bl = new ClienteNEG();
            Cliente c = new Cliente();

            //dgvCliente.DataSource = bl.Listar(c);
            dgvCliente.DataSource = ClienteNEG.Instancia().Listar(c);
        }
Esempio n. 4
0
        private void txtNombre_TextChanged(object sender, EventArgs e)
        {
            //ClienteNEG bl = new ClienteNEG();
            Cliente c = new Cliente();

            c.Nombres = txtNombre.Text;
            c.Ruc     = txtRuc.Text;
            //dgvCliente.DataSource = bl.Buscar(c);
            dgvCliente.DataSource = ClienteNEG.Instancia().Buscar(c);
        }
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            //ClienteNEG bl = new ClienteNEG();
            Cliente c = new Cliente();

            c.Nombres = txtNombre_Busqueda.Text;
            c.Ruc     = txtRuc_Busqueda.Text;
            //dgvClientes.DataSource = bl.Buscar(c);
            dgvVehiculos.DataSource = ClienteNEG.Instancia().Buscar(c);
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (ValidarDatos())
            {
                email_bien_escrito(txtEmail.Text);
                Cliente c = new Cliente();
                c.Nombres   = txtNombre.Text;
                c.Direccion = txtDireccion.Text;
                c.Ruc       = txtRuc.Text;
                c.Telefono  = txtTelefono.Text;
                c.Email     = txtEmail.Text;

                if (radActivo.Enabled == true)
                {
                    c.Estado = true;
                }
                else if (radInactivo.Enabled == true)
                {
                    c.Estado = false;
                }
                if (txtId.Text == "" && ClienteNEG.Instancia().Guardar(c) == true)
                {
                    MessageBox.Show("El Cliente se registró con exito");
                    this.Dispose();
                }
                else
                {
                    c.idCliente = Convert.ToInt32(txtId.Text);
                    if (ClienteNEG.Instancia().Modificar(c) == true)
                    {
                        MessageBox.Show("Los datos del Cliente se actualizarón correctamente");
                        this.Dispose();
                    }
                }
            }

            else
            {
                MessageBox.Show("No se realizó el registro", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }