Ejemplo n.º 1
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            if (txtDireccion.Text == "" || txtDNI.Text == "" || txtNombre.Text == "" || txtTelefono.Text == "")
            {
                MessageBox.Show("No puede registar campos vacíos");
            }
            else
            {
                if (TrabajarCliente.VerificarCliente(txtDNI.Text) == true)
                {
                    if (MessageBox.Show("confirms the action?", "Save data", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Cliente oCliente = new Cliente();

                        string dniCliente = (string)dgvClientes.CurrentRow.Cells[0].Value;

                        oCliente.CLI_apellido  = txtApellido.Text;
                        oCliente.CLI_direccion = txtDireccion.Text;
                        oCliente.CLI_nombre    = txtNombre.Text;
                        oCliente.CLI_telefono  = txtTelefono.Text;
                        oCliente.CLI_dni       = dniCliente;

                        TrabajarCliente.ModificarCliente(oCliente);

                        cargarGrilla();
                        limpiarCampos();
                    }
                }
                else
                {
                    MessageBox.Show("Este DNI no está registrado, ingrese uno válido.");
                }
            }
        }