private void btnAddHorario_Click(object sender, EventArgs e) { if (curso == null) { frmMensaje mensaje = new frmMensaje("Seleccione un curso", "Error", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } return; } frmGestionarHorario formGestionarHorario = new frmGestionarHorario(curso); if (formGestionarHorario.ShowDialog() == DialogResult.OK) { horario = formGestionarHorario.HorarioSeleccionado; Service.asistencia a = new Service.asistencia(); horarios.Add(horario); Object[] filaHorario = new Object[7]; filaHorario[0] = horario.clase; filaHorario[1] = horario.horaIni.ToShortTimeString(); filaHorario[2] = horario.horaFin.ToShortTimeString(); if (horario.colaborador.idPersona != 0) { filaHorario[3] = horario.colaborador.nombre; } else { filaHorario[3] = "-"; } filaHorario[4] = horario.fecha.ToShortDateString(); filaHorario[5] = horario.sede.direccion; filaHorario[6] = horario.numVacantes; dgvHorarios.Rows.Add(filaHorario); } }
private void btnRegistrar_Click(object sender, EventArgs e) { if (asistencias.Any()) { Service.asistencia a = asistencias[dgvPorAsistir.CurrentRow.Index]; a.asistio = true; asistencias.RemoveAt(dgvPorAsistir.CurrentRow.Index); Program.dbController.actualizarAsistencia(a); Object[] fila = new Object[5]; fila[0] = dgvPorAsistir.CurrentRow.Cells[0].Value; fila[1] = dgvPorAsistir.CurrentRow.Cells[1].Value; fila[2] = dgvPorAsistir.CurrentRow.Cells[2].Value; fila[3] = dgvPorAsistir.CurrentRow.Cells[3].Value; fila[4] = dgvPorAsistir.CurrentRow.Cells[4].Value; dgvYaAsistieron.Rows.Add(fila); dgvPorAsistir.Rows.RemoveAt(dgvPorAsistir.CurrentRow.Index); frmMensaje mensaje = new frmMensaje("Asistencia registrada", "Mensaje de confirmación", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } ; } else { frmMensaje mensaje = new frmMensaje("No hay asistentes el día de hoy", "Mensaje de error", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } }
private void btnbuscarCurso_Click(object sender, EventArgs e) { dgvHorarios.Rows.Clear(); horarios = new BindingList <Service.horario>(); //dgvHorarios.RowCount = 0; frmBuscarCurso formBuscarCurso = new frmBuscarCurso(false); if (formBuscarCurso.ShowDialog() == DialogResult.OK) { curso = formBuscarCurso.CursoSeleccionado; txtNombreServicio.Text = curso.nombre; if (Program.dbController.listarHorariosPorCurso(curso.id_servicio) != null) { foreach (Service.horario h in Program.dbController.listarHorariosPorCurso(curso.id_servicio)) { Service.asistencia a = new Service.asistencia(); a.horario = h; horarios.Add(h); Object[] filaHorario = new Object[7]; filaHorario[0] = h.clase; filaHorario[1] = h.horaIni.ToShortTimeString(); filaHorario[2] = h.horaFin.ToShortTimeString(); if (h.colaborador.idPersona != 0) { filaHorario[3] = h.colaborador.nombre; a.persona = h.colaborador; } else { filaHorario[3] = "-"; } filaHorario[4] = h.fecha.ToShortDateString(); filaHorario[5] = h.sede.direccion; filaHorario[6] = h.numVacantes; dgvHorarios.Rows.Add(filaHorario); asist.Add(a); } } } }
private void btnSeleccionarHorario_Click(object sender, EventArgs e) { if (dgvHorarios.RowCount != 0) { Service.horario h = horarios[dgvHorarios.CurrentRow.Index]; Service.asistencia a = new Service.asistencia(); a.horario = h; if (cliente is Service.gestante) { a.persona = cliente; } else { a.persona = (Service.persona)cboBebes.SelectedItem; } Program.dbController.registrarClienteEnHorario(a); frmMensaje mensaje = new frmMensaje("Cliente registrado en horario", "Mensaje Confirmación", "Confirmar"); } }
private void btnSeleccionarHorario_Click(object sender, EventArgs e) { if (dgvHorarios.RowCount != 0) { Service.horario h = horarios[dgvHorarios.CurrentRow.Index]; Service.asistencia a = new Service.asistencia(); a.horario = h; if (cliente is Service.gestante) { a.persona = cliente; } else { a.persona = (Service.persona)cboBebes.SelectedItem; } IEnumerable <Service.curso> cur = Program.dbController.cruceHorario(horarios[dgvHorarios.CurrentRow.Index], cliente.idPersona); if (cur == null) { Program.dbController.registrarClienteEnHorario(a); frmMensaje mensaje = new frmMensaje("Cliente registrado en horario", "Mensaje Confirmación", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } } else { foreach (Service.curso c in cur) { frmMensaje mensaje = new frmMensaje("Cuce de horarios con la clase " + c.horario[0].clase + " del curso " + c.nombre, "Advertencia", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } break; } } } }
private void btnRegistrar_Click(object sender, EventArgs e) { if (asistencias.Any()) { Service.asistencia a = asistencias[dgvPorAsistir.CurrentRow.Index]; a.asistio = true; asistencias.RemoveAt(dgvPorAsistir.CurrentRow.Index); Program.dbController.actualizarAsistencia(a); Object[] fila = new Object[5]; fila[0] = dgvPorAsistir.CurrentRow.Cells[0].Value; fila[1] = dgvPorAsistir.CurrentRow.Cells[1].Value; fila[2] = dgvPorAsistir.CurrentRow.Cells[2].Value; fila[3] = dgvPorAsistir.CurrentRow.Cells[3].Value; fila[4] = dgvPorAsistir.CurrentRow.Cells[4].Value; dgvYaAsistieron.Rows.Add(fila); dgvPorAsistir.Rows.RemoveAt(dgvPorAsistir.CurrentRow.Index); MessageBox.Show("Asistencia registrada", "Mensaje de confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No hay asistentes el día de hoy", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frmAsistenciaCliente() { InitializeComponent(); Formateador f = new Formateador(); f.iniFormAsistencia(this, "Asistencia de cliente", pnlCtn, btnRegistrar); cboCursos.SelectedIndexChanged -= new EventHandler(cboCursos_SelectedIndexChanged); IEnumerable <Service.curso> dataSource = Program.dbController.listarCursosPorNombre(""); if (dataSource != null) { Service.curso cu = new Service.curso(); cu.nombre = "Todos"; data.Add(cu); data.AddRange(dataSource.ToList()); cboCursos.DataSource = data; } else { cboCursos.DataSource = dataSource; } cboCursos.DisplayMember = "Nombre"; cboCursos.SelectedIndexChanged += new EventHandler(cboCursos_SelectedIndexChanged); cursos = Program.dbController.listarClientesDelDia(); if (cursos != null) { foreach (Service.curso c in cursos) { if (c.horario != null) { foreach (Service.horario h in c.horario) { if (h.participantes != null) { foreach (Service.persona p in h.participantes) { Object[] fila = new Object[5]; fila[0] = p.dni; fila[1] = p.nombre; fila[2] = c.nombre; fila[3] = h.horaIni.ToShortTimeString(); fila[4] = h.horaFin.ToShortTimeString(); dgvPorAsistir.Rows.Add(fila); Service.asistencia a = new Service.asistencia(); a.horario = h; a.persona = p; asistencias.Add(a); } } } } } } cursosAsis = Program.dbController.listarClientesYaAsistieron(); if (cursosAsis != null) { foreach (Service.curso c in cursosAsis) { if (c.horario != null) { foreach (Service.horario h in c.horario) { if (h.participantes != null) { foreach (Service.persona p in h.participantes) { Object[] fila = new Object[5]; fila[0] = p.dni; fila[1] = p.nombre; fila[2] = c.nombre; fila[3] = h.horaIni.ToShortTimeString(); fila[4] = h.horaFin.ToShortTimeString(); dgvYaAsistieron.Rows.Add(fila); } } } } } } }
private void cboCursos_SelectedIndexChanged(object sender, EventArgs e) { dgvPorAsistir.RowCount = 0; dgvYaAsistieron.RowCount = 0; if (cboCursos.SelectedIndex != 0) { cursos = Program.dbController.listarClientesDelDiaPorCurso(((Service.curso)cboCursos.SelectedItem).id_servicio); if (cursos != null) { foreach (Service.curso c in cursos) { if (c.horario != null) { foreach (Service.horario h in c.horario) { if (h.participantes != null) { foreach (Service.persona p in h.participantes) { Object[] fila = new Object[5]; fila[0] = p.dni; fila[1] = p.nombre; fila[2] = c.nombre; fila[3] = h.horaIni.ToShortTimeString(); fila[4] = h.horaFin.ToShortTimeString(); dgvPorAsistir.Rows.Add(fila); Service.asistencia a = new Service.asistencia(); a.horario = h; a.persona = p; asistencias.Add(a); } } } } } } cursosAsis = Program.dbController.listarClientesYaAsistieronPorCurso(((Service.curso)cboCursos.SelectedItem).id_servicio); if (cursosAsis != null) { foreach (Service.curso c in cursosAsis) { if (c.horario != null) { foreach (Service.horario h in c.horario) { if (h.participantes != null) { foreach (Service.persona p in h.participantes) { Object[] fila = new Object[5]; fila[0] = p.dni; fila[1] = p.nombre; fila[2] = c.nombre; fila[3] = h.horaIni.ToShortTimeString(); fila[4] = h.horaFin.ToShortTimeString(); dgvYaAsistieron.Rows.Add(fila); } } } } } } } else { cursos = Program.dbController.listarClientesDelDia(); if (cursos != null) { foreach (Service.curso c in cursos) { if (c.horario != null) { foreach (Service.horario h in c.horario) { if (h.participantes != null) { foreach (Service.persona p in h.participantes) { Console.WriteLine("1"); Object[] fila = new Object[5]; fila[0] = p.dni; fila[1] = p.nombre; fila[2] = c.nombre; fila[3] = h.horaIni.ToShortTimeString(); fila[4] = h.horaFin.ToShortTimeString(); dgvPorAsistir.Rows.Add(fila); Service.asistencia a = new Service.asistencia(); a.horario = h; a.persona = p; asistencias.Add(a); } } } } } } cursosAsis = Program.dbController.listarClientesYaAsistieron(); if (cursosAsis != null) { foreach (Service.curso c in cursosAsis) { if (c.horario != null) { foreach (Service.horario h in c.horario) { if (h.participantes != null) { foreach (Service.persona p in h.participantes) { Object[] fila = new Object[5]; fila[0] = p.dni; fila[1] = p.nombre; fila[2] = c.nombre; fila[3] = h.horaIni.ToShortTimeString(); fila[4] = h.horaFin.ToShortTimeString(); dgvYaAsistieron.Rows.Add(fila); } } } } } } } }