private void chkRango_CheckedChanged(object sender, EventArgs e)
 {
     if (chkRango.Checked)
     {
         lblPlanilla.Text = "Planilla de los Meses de";
         lblHasta.Visible = true;
         cmbHasta.Visible = true;
         DataTable dtMes1 = new RegistroCN().CargarMes();
         dtMes1.Rows.RemoveAt(dtMes1.Rows.Count - 1);
         cmbMes.DataSource    = dtMes1;
         cmbMes.SelectedIndex = 0;
         DataTable dtMes2 = new RegistroCN().CargarMes();
         dtMes2.Rows.RemoveAt(0);
         cmbHasta.DataSource = dtMes2;
         btnBuscar.Visible   = true;
         dgvMes.DataSource   = null;
     }
     else
     {
         lblPlanilla.Text = "Planilla del Mes de";
         lblHasta.Visible = false;
         cmbHasta.Visible = false;
         LlenarCmbs();
         btnBuscar.Visible = false;
         dgvMes.DataSource = null;
         dgvMes.DataSource = new RegistroCN().ProcesarPlanilla(cmbMes.SelectedValue.ToString());
     }
 }
        private void btnSalida_Click(object sender, EventArgs e)
        {
            TrabajadorCE trabajador = new TrabajadorCN().BuscarByDni(txtDni.Text);
            string       resultado  = new RegistroCN().Registrar(trabajador, "Salida", Convert.ToDateTime(txtHora.Text));

            MostrarResultado(resultado, "Salida");
            txtDni.Clear();
        }
Beispiel #3
0
        private void btnGuardarRegistro_Click(object sender, EventArgs e)
        {
            if (dgvDatos.Rows.Count > 0)
            {
                if (txtIdProfesor.Text.Length > 0 && txtProfesor.Text.Length > 0 &&
                    txtIdCurso.Text.Length > 0 && txtCurso.Text.Length > 0 &&
                    txtIdEstudiante.Text.Length > 0 && txtEstudiante.Text.Length > 0)
                {
                    DialogResult rpta = MessageBox.Show("Está a punto de GUARDAR los REGISTROS y sus detalles. ¿Está seguro?",
                                                        "Registros", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
                    if (rpta == DialogResult.Yes)
                    {
                        int        idProfesor   = Convert.ToInt32(txtIdProfesor.Text);
                        int        idCurso      = Convert.ToInt32(txtIdCurso.Text);
                        DateTime   fechaInicio  = dtpFInicio.Value;
                        DateTime   fechaTermino = dtpFTermino.Value;
                        RegistroCE registroCE   = new RegistroCE(0, idProfesor, idCurso, fechaInicio, fechaTermino);
                        RegistroCN registroCN   = new RegistroCN();

                        int idRegistro = registroCN.Crear(registroCE);

                        foreach (DataGridViewRow fila in dgvDatos.Rows)
                        {
                            int    idEstudiante = Convert.ToInt32(fila.Cells["idEstudiante"].Value);
                            int    idEvaluacion = Convert.ToInt32(fila.Cells["idEvaluacion"].Value);
                            double nota         = Convert.ToDouble(fila.Cells["nota"].Value);

                            NotasCE notasCE = new NotasCE(0, idEstudiante, idEvaluacion, idRegistro, nota);
                            NotasCN notasCN = new NotasCN();

                            int idNotas = notasCN.Crear(notasCE);

                            Console.WriteLine("Registro guardado => " + idRegistro + " / " + idNotas);
                        }
                        LimpiarTodo();
                        CalcularPromedio();
                    }
                }
                else
                {
                    MessageBox.Show("Al parecer hay ciertos datos incompletos. Por favor, completelo para guardar los registros.");
                }
            }
            else
            {
                MessageBox.Show("No hay registros introducidos.");
            }
        }
        private void cmbMes_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (!chkRango.Checked)
            {
                dgvMes.DataSource = new RegistroCN().ProcesarPlanilla(cmbMes.SelectedValue.ToString());
            }
            DataTable dtMes = new RegistroCN().CargarMes();

            cmbHasta.DataSource = dtMes;
            int indice = cmbMes.SelectedIndex;

            for (int i = 0; i <= indice; i++)
            {
                dtMes.Rows.RemoveAt(0);
            }
            cmbHasta.DataSource    = dtMes;
            cmbHasta.SelectedIndex = cmbHasta.Items.Count - 1;
        }