private void btnAgregar_Click(object sender, EventArgs e) { if ((txtNombre.Text == "") || (txtDireccion.Text == "") || (txtTelefono.Text == "")) { MessageBox.Show("Los campos con asterisco son obligatorios"); } else { try { Cliente mCliente = new Cliente(); mCliente.Nombre = txtNombre.Text; mCliente.Direccion = txtDireccion.Text; mCliente.Referencias = txtReferencias.Text; mCliente.Telefono = txtTelefono.Text; ControlCliente mControl = new ControlCliente(); mControl.agregarCliente(mCliente); MessageBox.Show("Cliente Guardado!"); } catch (Exception error) { MessageBox.Show("Error al actualizar"); } this.Close(); } }
private void button1_Click(object sender, EventArgs e) { controlCLiente = new ControlCliente(); String nombre1 = textBoxNombre.Text, nombre2 = textBoxNombre2.Text, apellido1 = textBoxApellido.Text, apellido2 = textBoxApellido2.Text, cedula = textBoxCedula.Text, correo = textBoxCorreo.Text, telefono = textBoxTelefono.Text , ruc = textBoxRUC.Text; if (vVacios(listatb()) && cbP()) { String pais = cbPais.SelectedItem.ToString(); controlCLiente.agregarCliente(nombre1, nombre2, apellido1, apellido2, cedula, pais, correo, telefono, ruc); MessageBox.Show("Cliente Registrado Exitosamente"); } else { MessageBox.Show("Error al Ingresar los datos"); } }