Beispiel #1
0
        private void btnInsertar_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtCedula.Text) || String.IsNullOrEmpty(txtNombre.Text) || String.IsNullOrEmpty(txtApellido.Text) ||
                String.IsNullOrEmpty(txtCorreo.Text) || String.IsNullOrEmpty(txtTelefono.Text))
            {
                MessageBox.Show("Verificar que no exista un espacio en blanco");
                return;
            }

            MetodosInterfaz metodos = new MetodosInterfaz();

            try
            {
                if (metodos.EsNumero(txtCedula.Text))
                {
                    metodos.InsertarCliente(int.Parse(txtCedula.Text), txtNombre.Text, txtApellido.Text, txtCorreo.Text, txtTelefono.Text);
                    this.Visible = false;
                    MantenimientoClientes mantC = new MantenimientoClientes();
                    mantC.Show();
                }
                else
                {
                    throw new Exception("Digite la cédula correctamente");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }