public List<reportesDTO.reportesG> cg_reporteGrupo(reportesDTO.reportess m) { try { List<reportesDTO.reportesG> v = new List<reportesDTO.reportesG>(); // Si retorna DIFERENTE DE NULL quiere decir que si hay para este grupo y periodo // Por tanto devolvemos uno listo para MODIFICAR o ELIMINAR. v = verificarGrupo(m); if (v != null) { return v;// si retorna quiere decir que ya hay reportes asignados. } else // Si retorna NULL quiere decir que no hay para este grupo y periodo // Por tanto devolvemos uno listo para REGISTRAR. { List<matricula2> n = null; n = bd.matricula2.Where(t => t.id_grupo == m.id_grupo).ToList(); List<reportesDTO.reportesG> d = new List<reportesDTO.reportesG>(); foreach (matricula2 item in n) { reportesDTO.reportesG no = new reportesDTO.reportesG(); no.id_estudiante = item.id_estudiante.ToString(); // OJO QUE NO SEA QUE DEVUELVA ES EL PROGESOR no.apellidos = item.personas1.apellidos.ToString(); no.nombres = item.personas1.nombres.ToString(); no.acceso = false; no.notificacion = "PENDIENTE"; no.uid = "NUEVO_REGISTRO"; d.Add(no); } if (d.Count != 0) { d = d.OrderBy(p => p.apellidos).ToList(); return d; } else { return null; } } } catch { return null; } }
public List<reportesDTO.reportesG> cg_reporteGrupo(reportesDTO.reportess m) { try { List<reportesDTO.reportesG> v = new List<reportesDTO.reportesG>(); v = verificarGrupo(m); if (v != null) return v; else { List<matricula2> n = null; n = bd.matricula2.Where(t => t.id_grupo == m.id_grupo).ToList(); List<reportesDTO.reportesG> d = new List<reportesDTO.reportesG>(); foreach (matricula2 item in n) { reportesDTO.reportesG no = new reportesDTO.reportesG(); no.id_estudiante = item.id_estudiante.ToString(); no.apellidos = item.personas1.apellidos.ToString(); no.nombres = item.personas1.nombres.ToString(); no.acceso = false; no.notificacion = "PENDIENTE"; no.uid = "NUEVO_REGISTRO"; d.Add(no); } if (d.Count != 0) { d = d.OrderBy(p => p.apellidos).ToList(); return d; } else return null; } } catch { return null; } }
//_-------------------------------------------------------------------- public List<reportesDTO.reportesG> verificarGrupo(reportesDTO.reportess m) { try { List<reportes> n = bd.reportes.Where(t => t.id_grupo == m.id_grupo && t.id_periodo == m.id_periodo ).ToList(); if (n.Count != 0) { // QUIERE DECIR ENTONCES QUE SI HAY REGISTROS EN REPORTES List<reportesDTO.reportesG> y = new List<reportesDTO.reportesG>(); foreach (reportes item in n) { reportesDTO.reportesG no = new reportesDTO.reportesG(); no.id_estudiante = item.id_estudiante.ToString(); // OJO QUE NO SEA QUE DEVUELVA ES EL PROGESOR no.apellidos = item.personas.apellidos.ToString(); no.nombres = item.personas.nombres.ToString(); if (item.acceso.ToString() == "TRUE") { no.acceso = true; } else if (item.acceso.ToString() == "FALSE") { no.acceso = false; } no.notificacion = item.notificacion; no.uid = "LISTO_PARA_MODIFICAR"; y.Add(no); } y = y.OrderBy(t => t.apellidos).ToList(); return y; } else { // SINO ENTONCES, NO HAY REGISTROS return null; } } catch { { return null; } } }
public List<reportesDTO.reportesG> verificarGrupo(reportesDTO.reportess m) { try { List<reportes> n = bd.reportes.Where(t => t.id_grupo == m.id_grupo && t.id_periodo == m.id_periodo ).ToList(); if (n.Count != 0) { List<reportesDTO.reportesG> y = new List<reportesDTO.reportesG>(); foreach (reportes item in n) { reportesDTO.reportesG no = new reportesDTO.reportesG(); no.id_estudiante = item.id_estudiante.ToString(); no.apellidos = item.personas.apellidos.ToString(); no.nombres = item.personas.nombres.ToString(); if (item.acceso.ToString() == "TRUE") no.acceso = true; else if (item.acceso.ToString() == "FALSE") no.acceso = false; no.notificacion = item.notificacion; no.uid = "LISTO_PARA_MODIFICAR"; y.Add(no); } y = y.OrderBy(t => t.apellidos).ToList(); return y; } else return null; } catch { { return null; } } }