Ejemplo n.º 1
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if ((string.IsNullOrEmpty(txtCue.Text)) || (string.IsNullOrEmpty(txtNombre.Text)) || (string.IsNullOrEmpty(txtApellido.Text)) || (string.IsNullOrEmpty(txtDni.Text)))
            {
                MessageBox.Show("Todos los campos (menos mail) son obligatorios");
                return;
            }

            string resul = new DConectar().InsertarPersona(txtApellido.Text, txtNombre.Text, txtDni.Text, txtMail.Text, chkDocente.Checked, id);

            if (resul.Equals("ok"))
            {
                MessageBox.Show("La persona fue registrada correctamente");
                this.Dispose();
            }
            else
            {
                MessageBox.Show("Error al registrar a la persona");
            }
        }
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            List <string> lista = new List <string>();

            for (int i = 0; i < dgvInscriptos.RowCount; i++)
            {
                if ((bool)dgvInscriptos.Rows[i].Cells["chk"].Value == true)
                {
                    lista.Add(dgvInscriptos.Rows[i].Cells["RowId"].Value.ToString());
                }
            }
            string resul = new DConectar().Insertar(lista);

            if (resul.Equals("ok"))
            {
                MessageBox.Show("Alumnos registrados correctamente", "Registro OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }
            else
            {
                MessageBox.Show("Se produjo un error al guardar el registro", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }