示例#1
0
        private void btnAgregar_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) == false)
                {
                    if (MessageBox.Show("confirms the action?", "Save data", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Cliente oCliente = new Cliente();

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

                        TrabajarCliente.AgregarCliente(oCliente);

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