private void btnRegistrar_Click(object sender, EventArgs e)
        {
            dgvVoluntarios.Rows.Clear();

            try
            {
                if (MessageBox.Show("¿Está seguro de querer guardar los datos anteriores?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                {
                }
                else
                {
                    clsVoluntarios objVoluntarios = new clsVoluntarios();
                    objVoluntarios.Registrar(txtNombre.Text, txtPaterno.Text, txtMaterno.Text, idHora, txtTelefono.Text);
                    var lista = objVoluntarios.ConsultarVoluntariosTODO(txtPaterno.Text, txtMaterno.Text);
                    foreach (clsVoluntarios.dato dato in lista)
                    {
                        dgvVoluntarios.Rows.Add(dato.idVoluntario, dato.Nombres, dato.ApellidoP, dato.ApellidoM, dato.idHorario, dato.Telefono);
                    }
                    lblResult.Text = "Registrado correctamente";
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
                throw;
            }
        }
        private void cbAlfabeto_SelectionChangeCommitted(object sender, EventArgs e)
        {
            dgvVoluntarios.Rows.Clear();
            clsVoluntarios objVoluntarios = new clsVoluntarios();
            var            lista          = objVoluntarios.ConsultarInicial(cbAlfabeto.SelectedItem.ToString());

            foreach (clsVoluntarios.dato dato in lista)
            {
                dgvVoluntarios.Rows.Add(dato.idVoluntario, dato.NombreCompleto, dato.Horario, dato.Telefono);
            }
        }
Пример #3
0
        private void cbIDvoluntarios_SelectionChangeCommitted(object sender, EventArgs e)
        {
            clsVoluntarios objVoluntarios = new clsVoluntarios();
            var            voluntario     = objVoluntarios.ConsultarPorID(Convert.ToInt32(cbIDvoluntarios.SelectedItem.ToString()));

            lblApellidoM.Text = voluntario.ApellidoM;
            lblApellidoP.Text = voluntario.ApellidoP;
            lblHorario.Text   = voluntario.Horario;
            lblTel.Text       = voluntario.Telefono;
            lblNombre.Text    = voluntario.Nombres;
        }
Пример #4
0
        public frmEliminarVoluntario()
        {
            InitializeComponent();
            clsVoluntarios objVoluntarios = new clsVoluntarios();
            var            lista          = objVoluntarios.listaIDs();

            foreach (clsVoluntarios.dato dato in lista)
            {
                cbIDvoluntarios.Items.Add(dato.idVoluntario.ToString());
            }
        }
 private void frmConsultarVoluntarios_Load(object sender, EventArgs e)
 {
     try
     {
         clsVoluntarios objVoluntarios = new clsVoluntarios();
         var            lista          = objVoluntarios.ConsultarVoluntarios();
         foreach (clsVoluntarios.dato dato in lista)
         {
             dgvVoluntarios.Rows.Add(dato.idVoluntario, dato.NombreCompleto, dato.Horario, dato.Telefono);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     //Vuelve a cargar la tabla completa
     try
     {
         dgvVoluntarios.Rows.Clear();
         clsVoluntarios objVoluntarios = new clsVoluntarios();
         var            lista          = objVoluntarios.ConsultarVoluntarios();
         foreach (clsVoluntarios.dato dato in lista)
         {
             dgvVoluntarios.Rows.Add(dato.idVoluntario, dato.NombreCompleto, dato.Horario, dato.Telefono);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #7
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("¿Está seguro de querer guardar los datos anteriores?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
         {
         }
         else
         {
             clsVoluntarios objVoluntarios = new clsVoluntarios();
             objVoluntarios.Eliminar(Convert.ToInt32(cbIDvoluntarios.SelectedItem.ToString()));
             lblApellidoM.Text = lblApellidoP.Text = lblHorario.Text = lblNombre.Text = lblTel.Text = string.Empty;
             lblResult.Text   += " Eliminados";
         }
     }
     catch (Exception)
     {
         throw;
     }
 }