Ejemplo n.º 1
0
        public string r_nota(notasDTO.notass n)
        {
            try
            {
                bdsigameEntities bd = new bdsigameEntities();
                string m = verificar_nota(n);
                if (m == "0")
                {
                    notas no = new notas();
                    no.id_estudiante = n.id_estudiante;
                    no.id_asignatura = n.id_asignatura;
                    no.id_grupo = n.id_grupo;
                    no.id_periodo = n.id_periodo;
                    no.id_profesor = n.id_profesor;
                    no.id_logro = n.id_logro;
                    no.nota = n.nota;
                    no.equivalencia = n.equivalencia;
                    no.nota_s = n.nota_s;
                    no.equivalencia_s = n.equivalencia_s;

                    bd.notas.Add(no);
                    bd.SaveChanges();
                    return "¡Se agregó el registro de la nota exitosamente!";
                }
                else
                {
                    return "¡Error de congruencia de datos. Recuerde que usted no puede asignar notas al mismo estudiante en el mismo periodo, grupo y asignatura <strong>dos veces</strong>. Revise!";
                }
            }
            catch (Exception e)
            {
                { return ("Error Con Codigo 1:" + e.Message.ToString()); }
            }
        }
Ejemplo n.º 2
0
 public string e_nota(notasDTO.notass m)
 {
     try
     {
         bdsigameEntities bd = new bdsigameEntities();
         notas n = bd.notas.Where(t =>
         t.id_grupo == m.id_grupo &&
         t.id_profesor == m.id_profesor &&
         t.id_estudiante == m.id_estudiante &&
         t.id_periodo == m.id_periodo &&
         t.id_asignatura == m.id_asignatura
         ).FirstOrDefault();
         if (n != null)
         {
             bd.notas.Remove(n);
             bd.SaveChanges();
             return "¡Eliminación exitosa!";
         }
         else { return null; }
     }
     catch (Exception ex)
     {
         return ("Error Con Codigo 2:" + ex.Message.ToString());
     }
 }
Ejemplo n.º 3
0
 public List<dtoG> c_gradosDelProfe(dtoG dto)
 {
     try
     {
         using (var ctx = new bdsigameEntities())
         {
             string sql = "SELECT DISTINCT `grados`.`id-grado` FROM `matricula1`,`grados`,`grupos` WHERE `id-profesor`= '" + dto.id + "' and `grupos`.`id-grupo`=`matricula1`.`id-grupo` and `grados`.`id-grado`=`grupos`.`id-grado`";
             var m = ctx.Database.SqlQuery<string>(sql).ToList();
             List<dtoG> mm = new List<dtoG>();
             if (m.Count != 0)
             {
                 for (int i = 0; i < m.Count; i++)
                 {
                     dtoG ll = new dtoG();
                     ll.id = m[i];
                     mm.Add(ll);
                 }
                 return mm;
             }
             else
                 return null;
         }
     }
     catch
     {
         return null;
     }
 }
Ejemplo n.º 4
0
        //-----------------------------------------------------------------------------------
        public List<personasDTO.UsuariosDTOs> c_datosUsuariosSistema()
        {
            try
            {

                bdsigameEntities bd = new bdsigameEntities();
                usuariosDTO no = new usuariosDTO();

                List<personasDTO.UsuariosDTOs> destino = new List<personasDTO.UsuariosDTOs>();
                List<usuarios> n = bd.usuarios.OrderBy(t=> t.id).ToList();
                if (n.Count != 0)
                {
                    foreach (usuarios item in n)
                    {
                        personasDTO.UsuariosDTOs p = new personasDTO.UsuariosDTOs();
                        p.nombres = item.personas.nombres.ToString();
                        p.apellidos = item.personas.apellidos.ToString();
                        p.id = item.personas.id.ToString();
                        p.id_tipo = item.personas.id_tipo.ToString();
                        if (item.personas.jornada !=null)
                        {
                            p.jornada = item.personas.jornada.ToString();
                        }
                        if (item.personas.rol != null)
                        {
                            p.rol = item.personas.rol.ToString();
                        }

                        if ( item.personas.cel != null)
                        {
                            p.cel = item.personas.cel.ToString();
                        }
                        if ( item.personas.edad  != null)
                        {
                           p.edad = item.personas.edad.ToString();
                        }

                        p.password = item.password.ToString();
                        p.acceso = item.acceso.ToString();

                        destino.Add(p);
                    }
                    destino = destino.OrderBy(t => t.rol).ToList();
                    return destino;
                }
                else
                {
                    return null;
                }
            }
            catch
            {
                return null;
            }
        }
        //-----------------------------------------------------------------------------------
        public personasDTO.UsuariosDTOs c_usuario(string  userid, string passR)
        {
            try
            {
                bdsigameEntities bd = new bdsigameEntities();
                usuarios u = new usuarios();

                notas nn = new notas();
                personasDTO.UsuariosDTOs p = new personasDTO.UsuariosDTOs();
                u = bd.usuarios.Where(t => t.id == userid).FirstOrDefault();
                if (u != null)
                {

                    if (u.acceso.Equals("TRUE")) //denegamos el acceso al sistema
                    {
                        if (u.password.Equals(passR)) //validamos el password
                        {
                            p.nombres = u.personas.nombres.ToString();
                            p.apellidos = u.personas.apellidos.ToString();
                            p.id = u.id.ToString();
                            p.id_tipo = u.personas.id_tipo.ToString();
                            //p.jornada = u.personas.jornada.ToString();
                            // p.cel = u.personas.cel.ToString();
                            // p.direccion = u.personas.direccion.ToString();
                            p.sexo = u.personas.sexo.ToString();
                            p.rol = u.personas.rol.ToString();
                            p.rol_secundario = u.personas.rol_secundario.ToString();
                            p.rol_terciario = u.personas.rol_terciario.ToString();
                            p.email = u.personas.email.ToString();
                            // p.telefono = u.personas.telefono.ToString();
                            p.acceso = u.acceso.ToString();
                            p.password = u.password.ToString();
                            return p;
                        }
                        return null;
                    }
                    else
                    {
                        p.acceso = u.acceso.ToString();
                        return p;
                    }
                }
                return null;
            }
            catch
            {
                return null;
            }




        }
Ejemplo n.º 6
0
 public string m_idpersona(string idOld, string idNew)
 {
     using (var ctx = new bdsigameEntities())
     {
         string sql;
         sql = "UPDATE `personas` SET `id` = '" + idNew + "' WHERE `personas`.`id` = '" + idOld + "'";
         var m = ctx.Database.ExecuteSqlCommand(sql);
         if (m == 1)
             return "Modificación de identificación de manera existosa.";
         else
             return "La modificación no se realizó con exito. Tenga presente que las identificaciones son unicas. No se admiten duplicados.";
     }
 }
Ejemplo n.º 7
0
 public string vaciarBitacora()
 {
     try
     {
         using (var ctx = new bdsigameEntities())
         {
             string sql = "TRUNCATE TABLE `bitacora`";
             var m = ctx.Database.ExecuteSqlCommand(sql);
             return "¡Bitacora vaciada de forma exitosa! ";
         }
     }
     catch
     {
         return null;
     }
 }
Ejemplo n.º 8
0
 public personasDTO.UsuariosDTOs c_usuario(string userid, string passR)
 {
     try
     {
         bdsigameEntities bd = new bdsigameEntities();
         usuarios u = new usuarios();
         notas nn = new notas();
         personasDTO.UsuariosDTOs p = new personasDTO.UsuariosDTOs();
         u = bd.usuarios.Where(t => t.id == userid).FirstOrDefault();
         if (u != null)
         {
             if (u.acceso.Equals("TRUE"))
             {
                 if (u.password.Equals(passR))
                 {
                     p.nombres = u.personas.nombres.ToString();
                     p.apellidos = u.personas.apellidos.ToString();
                     p.id = u.id.ToString();
                     p.id_tipo = u.personas.id_tipo.ToString();
                     p.sexo = u.personas.sexo.ToString();
                     p.rol = u.personas.rol.ToString();
                     p.rol_secundario = u.personas.rol_secundario.ToString();
                     p.rol_terciario = u.personas.rol_terciario.ToString();
                     p.email = u.personas.email.ToString();
                     p.acceso = u.acceso.ToString();
                     p.password = u.password.ToString();
                     return p;
                 }
                 return null;
             }
             else
                 p.acceso = u.acceso.ToString();
                 return p;
         }
         return null;
     }
     catch
     {
         return null;
     }
 }
Ejemplo n.º 9
0
        public personasDTO.personaImgDTO c_imgFoto(string idPersona) // para consultar la imagen de la persona registrada
        {
            try
            {
                bdsigameEntities bd = new bdsigameEntities();
                personas u = new personas();
                personasDTO.personaImgDTO p = new personasDTO.personaImgDTO();
                u = bd.personas.Where(t => t.id == idPersona).FirstOrDefault();
                if (u != null)
                {
                    p.id = u.id.ToString();
                    if (u.imagen == null)
                    {
                        u = bd.personas.Where(t => t.id == "1234").FirstOrDefault();
                        p.imagen = u.imagen;
                        p.imagentype = u.imagentype;
                    }
                    else
                    {
                        p.imagen = u.imagen;
                        p.imagentype = u.imagentype;
                    }
                    return p;
                }
                else
                {
                    u = bd.personas.Where(t => t.id == "1234").FirstOrDefault();
                    p.id = u.id.ToString();
                    p.imagen = u.imagen;
                    p.imagentype = u.imagentype;
                    return p;
                }
            }
            catch
            {
                return null;

            }
        }
Ejemplo n.º 10
0
 public usuariosDTO c_usuario(usuariosDTO uu)
 {
     try
     {
         bdsigameEntities bd = new bdsigameEntities();
         usuariosDTO ur = new usuariosDTO();
         usuarios u = bd.usuarios.Where(t => t.id == uu.id).FirstOrDefault();
         if ((uu != null))
         {
             ur.id = u.id;
             ur.password = u.password;
             ur.acceso = u.acceso;
             ur.niu_mobil = u.niu_mobil;
             return ur;
         }
         else
             return null;
     }
     catch
     {
         return null;
     }
 }
Ejemplo n.º 11
0
 public List<usuariosDTOExport> c_usuariosGrupo(dtoG dto)
 {
     try
     {
         List<matricula2> n = null;
         bdsigameEntities bd = new bdsigameEntities();
         personasDTO.personass no = new personasDTO.personass();
         n = bd.matricula2.Where(t => t.id_grupo == dto.id).ToList();
         n = n.OrderBy(t => t.personas1.apellidos).ToList();
         List<usuariosDTOExport> d = new List<usuariosDTOExport>();
         int i = 1;
         foreach (matricula2 item in n)
         {
             usuariosDTOExport p = new usuariosDTOExport();
             p.firstname = item.personas1.nombres.ToString();
             p.lastname = item.personas1.apellidos.ToString();
             p.id = item.personas1.id.ToString();
             p.password = "******";
             p.username = item.personas1.id.ToString();
             p.institution = "SIGAME";
             if (item.personas.email.ToString() == "")
                 p.email = "sigame" + item.id_grupo.ToString() + "_" + i + "@sigame.co";
             else
                 p.email = item.personas.email.ToString();
             i++;
             d.Add(p);
         }
         if (d.Count != 0)
         {
             d = d.OrderBy(t => t.lastname).ToList();
             return d;
         }
         else
         {
             return null;
         }
     }
     catch
     {
         return null;
     }
 }
Ejemplo n.º 12
0
 public List<usuariosDTOExport> c_usuariosProfes()
 {
     try
     {
         List<personas> n = null;
         bdsigameEntities bd = new bdsigameEntities();
         personasDTO.personass no = new personasDTO.personass();
         n = bd.personas.Where(t => t.rol == "PROFESOR").ToList();
         List<usuariosDTOExport> destino = new List<usuariosDTOExport>();
         if (n.Count != 0)
         {
             foreach (personas item in n)
             {
                 usuariosDTOExport p = new usuariosDTOExport();
                 p.firstname = item.nombres.ToString();
                 p.lastname = item.apellidos.ToString();
                 p.id = item.id.ToString();
                 p.password = "******";
                 p.username = item.id.ToString();
                 p.institution = "SIGAME";
                 if (item.email.ToString() == "")
                     p.email = "*****@*****.**";
                 else
                     p.email = item.email.ToString();
                 destino.Add(p);
             }
             destino = destino.OrderBy(t => t.lastname).ToList();
             return destino;
         }
         else
             return null;
     }
     catch
     {
         return null;
     }
 }
Ejemplo n.º 13
0
        public List<personasDTO.personass> c_personasXNombres(dtoG dto)
        {

            try
            {
                using (var ctx = new bdsigameEntities())
                {
                    string sql = "SELECT `id` FROM `personas` WHERE `nombres` LIKE '%" + dto.id + "%'";
                    var m = ctx.Database.SqlQuery<string>(sql).ToList();
                    List<personasDTO.personass> destino = new List<personasDTO.personass>();
                    if (m.Count != 0)
                    {
                        for (int i = 0; i < m.Count; i++)
                        {
                            string id = Convert.ToString(m[i]);
                            personasDTO.personass ll = new personasDTO.personass();
                            personas u = bd.personas.Where(t => t.id == id).FirstOrDefault();
                            AutoMapper.Mapper.CreateMap<personas, personasDTO.personass>();
                            AutoMapper.Mapper.Map(u, ll);
                            if (ll.f_naci != null)
                                ll.f_naci = Convert.ToString(ll.f_naci).Substring(0, 10);
                            destino.Add(ll);
                        }
                        destino = destino.OrderBy(t => t.apellidos).ToList();
                        return destino;
                    }
                    else
                        return null;
                }
            }
            catch (Exception)
            {
                return null;
            }
        }
Ejemplo n.º 14
0
        public List<bitacorasDTO> c_bitacoraFecha(string fechaIni, string fechaFin)
        {
            try
            {
                string[] f_I = fechaIni.Split('/');
                string[] f_F = fechaFin.Split('/');
                string f_Ini = f_I[2] + "-" + f_I[1] + "-" + f_I[0] + " 00:00:00 a.m.";
                string f_Fin = f_F[2] + "-" + f_F[1] + "-" + f_F[0] + " 11:59:59 p.m.";
                using (var ctx = new bdsigameEntities())
                {
                    string sql = "SELECT `id-bitacora` FROM `bdcompriletsoft`.`bitacora`  WHERE `fecha` BETWEEN '" + f_Ini + "' AND '" + f_Fin + "'";
                    var m = ctx.Database.SqlQuery<string>(sql).ToList();
                    List<bitacorasDTO> destino = new List<bitacorasDTO>();
                    if (m != null)
                    {
                        if (m.Count != 0)
                        {
                            for (int i = 0; i < m.Count; i++)
                            {
                                bitacorasDTO ll = new bitacorasDTO();
                                int Refe = Convert.ToInt16(m[i]);
                                bitacora u = bd.bitacora.Where(t => t.id_bitacora == Refe).FirstOrDefault();
                                AutoMapper.Mapper.CreateMap<bitacora, bitacorasDTO>();
                                AutoMapper.Mapper.Map(u, ll);
                                destino.Add(ll);
                            }
                            destino = destino.OrderBy(t => t.fecha).ToList();
                            return destino;
                        }
                        else
                            return null;
                    }
                    else
                        return null;
                }
            }
            catch
            {
                return null;
            }

        }
Ejemplo n.º 15
0
        public List<puestosDef> OrganizarPuestos(string idPeriodo, string idGrupo)
        {
            bdsigameEntities bd = new bdsigameEntities();
            List<matricula2> k = bd.matricula2.Where(t =>
             t.id_grupo == idGrupo).ToList();

            List<notas> n = bd.notas.Where(t =>
               t.id_grupo == idGrupo &&
               t.id_periodo == idPeriodo
               ).OrderBy(t => t.id_estudiante).ToList();
            if (k.Count != 0)
            {
                List<puestos> PuestoL = new List<puestos>();
                foreach (matricula2 item in k)
                {
                    float nota_prom = 0;
                    int conta = 0;
                    puestos Puesto = new puestos();
                    foreach (notas item2 in n)
                    {

                        if (item.id_estudiante.ToString() == item2.id_estudiante.ToString())
                        {
                            // aca ajustamos la nota al formato de c#, ya que  para manejarlas necesitamo que los valores tengan , y no .
                            
                            string cn = item2.nota_s.ToString();
                            if (cn != "0") //Hubu superacion
                            {
                                item2.nota = item2.nota_s.ToString();
                            }
                            else { item2.nota = item2.nota.ToString(); }
                            
                            Puesto.nota_prom = (Convert.ToSingle(item2.nota.ToString())) + nota_prom;
                            nota_prom = Puesto.nota_prom;
                            Puesto.id_estudiante = item2.id_estudiante.ToString();
                            conta = conta + 1;
                        }
                    }
                    Puesto.nota_prom = Puesto.nota_prom / conta;

                    PuestoL.Add(Puesto);
                }
                PuestoL = PuestoL.OrderByDescending(t => t.nota_prom).ToList();
                int No = 1;
                List<puestosDef> PuestoDef = new List<puestosDef>();
                foreach (puestos item in PuestoL)
                {
                    puestosDef PuestoD = new puestosDef();
                    PuestoD.No = No;
                    PuestoD.nota_prom = item.nota_prom;
                    PuestoD.id_estudiante = item.id_estudiante;
                    PuestoDef.Add(PuestoD);
                    No = No + 1;
                }
                return PuestoDef;

            }
            return null;
        }
Ejemplo n.º 16
0
 public string c_iniciarPruebaHere(usuariosDTO dto)
 {
     try
     {
         bdsigameEntities bd = new bdsigameEntities();
         asignatura f = bd.asignatura.FirstOrDefault();
         return "Yes luis";
     }
     catch (Exception ex)
     {
         return ex.Message.ToString();
     }
 }
Ejemplo n.º 17
0
 public string m_nota(notasDTO.notass m)
 {
     try
     {
         bdsigameEntities bd = new bdsigameEntities();
         notas n = bd.notas.Where(t =>
         t.id_grupo == m.id_grupo &&
         t.id_profesor == m.id_profesor &&
         t.id_periodo == m.id_periodo &&
         t.id_asignatura == m.id_asignatura &&
          t.id_estudiante == m.id_estudiante
         ).FirstOrDefault();
         if (n != null)
         {
             n.id_logro = m.id_logro;
             n.nota = m.nota;
             n.equivalencia = m.equivalencia;
             n.nota_s = m.nota_s;
             n.equivalencia_s = m.equivalencia_s;
             bd.SaveChanges();
             return "¡Se modificó la nota exitosamente!";
         }
         else { return null; }
     }
     catch (Exception ex)
     {
         return ("Error Con Codigo 3:" + ex.Message.ToString());
     }
 }
Ejemplo n.º 18
0
 public List<observacionesDTO.observatorioss> c_porFecha(string fechaIni, string fechaFin)
 {
     string[] f_I = fechaIni.Split('/');
     string[] f_F = fechaFin.Split('/');
     string f_Ini = f_I[2] + "-" + f_I[1] + "-"+ f_I[0] +" 00:00:00 a.m.";
     string f_Fin = f_F[2] + "-" + f_F[1] + "-"+ f_F[0] +" 11:59:59 p.m.";
     using (var ctx = new bdsigameEntities())
     {
         string sql = "SELECT `referencia` FROM `bdcompriletsoft`.`observatorio`  WHERE `fecha` BETWEEN '" + f_Ini + "' AND '" + f_Fin + "'";
         var m = ctx.Database.SqlQuery<string>(sql).ToList();
          List<observacionesDTO.observatorioss> destino = new List<observacionesDTO.observatorioss>();
          if (m.Count != 0)
          {
              for (int i = 0; i < m.Count; i++)
              {
                  observacionesDTO.observatorioss ll = new observacionesDTO.observatorioss();
                  int Refe = Convert.ToInt16(m[i]);
                  observatorio u = bd.observatorio.Where(t => t.referencia == Refe).FirstOrDefault();
                  AutoMapper.Mapper.CreateMap<observatorio, observacionesDTO.observatorioss>();
                  AutoMapper.Mapper.Map(u, ll);
                  destino.Add(ll);
              }
              destino = destino.OrderBy(t => t.fecha).ToList();
              return destino;
          }
          else
              return null;
     }
 } 
Ejemplo n.º 19
0
 public personasDTO.personass c_personaXNombreAndGrupo(dtoGEst dto)
 {
     try
     {
         using (var ctx = new bdsigameEntities())
         {
             string sql = "SELECT `id` FROM `personas` WHERE `nombres` LIKE '%" + dto.id + "%'";
             var m = ctx.Database.SqlQuery<string>(sql).ToList();
             if (m.Count != 0)
             {
                 personasDTO.personass ll = new personasDTO.personass();
                 for (int i = 0; i < m.Count; i++)
                 {
                     if (i == 0)
                     {
                         string id = Convert.ToString(m[i]);
                         matricula2 pp = bd.matricula2.Where(t => t.id_estudiante == id && t.id_grupo == dto.id_grupo).FirstOrDefault();
                         if (pp != null)
                         {
                             personas u = bd.personas.Where(t => t.id == id).FirstOrDefault();
                             AutoMapper.Mapper.CreateMap<personas, personasDTO.personass>();
                             AutoMapper.Mapper.Map(u, ll);
                             if (ll.f_naci != null)
                                 ll.f_naci = Convert.ToString(ll.f_naci).Substring(0, 10);
                             return ll;
                         }
                         else
                             return null;
                     }
                 }
                 return null;
             }
             else return null;
         }
     }
     catch (Exception)
     {
         return null;
     }
 }
Ejemplo n.º 20
0
 public List<dtoGMatriculaProfe> c_mProfesXIdForHorario(string idprofe)
 {
     try
     {
         using (var ctx = new bdsigameEntities())
         {
             string sql = "SELECT DISTINCT `id-grupo` FROM `matricula1` WHERE `id-profesor`= '" + idprofe + "'";
             var m = ctx.Database.SqlQuery<string>(sql).ToList();
             if (m.Count != 0)
             {
                 personas per = bd.personas.Where(t => t.id == idprofe).FirstOrDefault();
                 List<dtoGMatriculaProfe> dss = new List<dtoGMatriculaProfe>();
                 for (int i = 0; i < m.Count; i++)
                 {
                     dtoG ll = new dtoG();
                     string g = Convert.ToString(m[i]);
                     grupos n = bd.grupos.Where(t => t.id_grupo == g).FirstOrDefault();
                     dtoGMatriculaProfe ds = new dtoGMatriculaProfe();
                     ds.nombres = per.nombres.ToString();
                     ds.apellidos = per.apellidos.ToString();
                     ds.año = n.año.ToString();
                     ds.grado = n.grados.nom_grado.ToString();
                     ds.id_grupo = n.id_grupo.ToString();
                     ds.id_profesor = idprofe;
                     ds.f_naci = per.f_naci.ToString();
                     dss.Add(ds);
                 }
                 return dss;
             }
             else
             {
                 return null;
             }
         }
     }
     catch (Exception e)
     {
         string m = e.Message.ToString();
         return null;
     }
 }
Ejemplo n.º 21
0
        public string v_reporteGrados()
        {
            {
                try
                {
                    using (var ctx = new bdsigameEntities())
                    {
                        string sql;
                        sql = "CREATE OR REPLACE VIEW `v_gradosAll` (`ID`,`NOMBRE`) ";
                        sql += "AS SELECT * FROM  `grados`";
                        var m = ctx.Database.ExecuteSqlCommand(sql);
                        return "S"; // S indica que si lo hizo


                    }
                }
                catch
                {
                    return null;
                }

            }
        }
Ejemplo n.º 22
0
        public List<puestosDef> OrganizarPuestosBoletinFinal(string idGrupo)
        {
            string[] Ano = idGrupo.Split('-');
            string ano = Ano[0];
            bdsigameEntities bd = new bdsigameEntities();
            List<matricula2> k = bd.matricula2.Where(t =>
            t.id_grupo == idGrupo).OrderBy(t => t.id_estudiante).ToList();
            List<matricula1> kk = bd.matricula1.Where(t =>
            t.id_grupo == idGrupo).ToList();
            List<notas> n = bd.notas.Where(t => t.id_grupo == idGrupo
               ).OrderBy(t => t.id_estudiante).ToList();
            if (k.Count != 0)
            {
                List<puestosFin> pl = new List<puestosFin>();
                List<puestos> PuestoL = new List<puestos>();
                int c = 0;
                foreach (matricula2 item in k) 
                {
                    int conta = 0;
                    float nota_prom = 0;
                    float nota_promV = 0;

                    foreach (matricula1 item2 in kk) 
                    {
                        int I = 0; int II = 0; int III = 0; int IV = 0;
                        string eitem = item.id_estudiante.ToString();
                        string aitem2 = item2.id_asignatura.ToString();
                        notas NI = bd.notas.Where(t => t.id_grupo == idGrupo && t.id_estudiante == eitem &&
                                                  t.id_periodo == (ano + "-" + "I") && t.id_asignatura == aitem2).FirstOrDefault();
                        notas NII = bd.notas.Where(t => t.id_grupo == idGrupo && t.id_estudiante == eitem &&
                                                 t.id_periodo == (ano + "-" + "II") && t.id_asignatura == aitem2).FirstOrDefault();
                        notas NIII = bd.notas.Where(t => t.id_grupo == idGrupo && t.id_estudiante == eitem &&
                                                 t.id_periodo == (ano + "-" + "III") && t.id_asignatura == aitem2).FirstOrDefault();
                        notas NIV = bd.notas.Where(t => t.id_grupo == idGrupo && t.id_estudiante == eitem &&
                                                 t.id_periodo == (ano + "-" + "IV") && t.id_asignatura == aitem2).FirstOrDefault();
                        if (NI == null) 
                        { I = 0; }
                        else
                        {
                            I = AjustarNenEnEnteros(NI.nota_s.ToString());
                            if (I == 0)
                            { I = AjustarNenEnEnteros(NI.nota.ToString()); }
                            else 
                            { I = AjustarNenEnEnteros(NI.nota_s.ToString()); }
                        }
                        if (NII == null) 
                        { II = 0; }
                        else
                        {
                            II = AjustarNenEnEnteros(NII.nota_s.ToString());
                            if (II == 0)
                            { II = AjustarNenEnEnteros(NII.nota.ToString()); }
                            else 
                            { II = AjustarNenEnEnteros(NII.nota_s.ToString()); }
                        }
                        if (NIII == null)
                        { III = 0; }
                        else
                        {
                            III = AjustarNenEnEnteros(NIII.nota_s.ToString());
                            if (III == 0)
                            { III = AjustarNenEnEnteros(NIII.nota.ToString()); }
                            else 
                            { III = AjustarNenEnEnteros(NIII.nota_s.ToString()); }
                        }

                        if (NIV == null)
                        { IV = 0; }
                        else
                        {
                            IV = AjustarNenEnEnteros(NIV.nota_s.ToString());
                            if (IV == 0)
                            { IV = AjustarNenEnEnteros(NIV.nota.ToString()); }
                            else 
                            { IV = AjustarNenEnEnteros(NIV.nota_s.ToString()); }
                        }
                        nota_promV = (I + II + III + IV) / 4; 
                        nota_prom = nota_promV + nota_prom; 
                        conta++;
                    }
                    nota_prom = nota_prom / conta; 
                    puestos u = new puestos();
                    u.id_estudiante = item.id_estudiante.ToString();
                    u.nota_prom = nota_prom;
                    PuestoL.Add(u);
                    c = c + 1;
                }
                PuestoL = PuestoL.OrderByDescending(t => t.nota_prom).ToList();
                int No = 1;
                List<puestosDef> PuestoDef = new List<puestosDef>();
                foreach (puestos item5 in PuestoL)
                {
                    puestosDef PuestoD = new puestosDef();
                    PuestoD.No = No;
                    PuestoD.nota_prom = item5.nota_prom;
                    PuestoD.id_estudiante = item5.id_estudiante.ToString();
                    PuestoDef.Add(PuestoD);
                    No = No + 1;
                }
                return PuestoDef;
            }
            else { return null; }
        }
Ejemplo n.º 23
0
        // lo que devuelve esta funcion es lo se manda a llamar  en el dsObserEst
        public List<observacionesDTO.observatoriosDTOReport> c_observacionesEst(string id, string id_grupo)
        {
            try
            {
                List<observacionesDTO.observatoriosDTOReport> Obser = new List<observacionesDTO.observatoriosDTOReport>();
                List<observatorio> RR = bd.observatorio.Where(t => t.id_estudiante == id && t.id_grupo == id_grupo).OrderBy(t => t.fecha).ToList();
                if (RR.Count != 0)
                {
                    //COMO VA A GENERAR UN PDF, ENTONCES SE ENTIENDE QUE LO HA VISTO TODAS LAS DE ESTE ESTUDIANTE EN ESTE GRUPO, POR TANTO CAMBIO LA NOTIFICACION
                    using (var ctx = new bdsigameEntities())
                    {
                        string sql;
                        sql = "UPDATE `observatorio` SET `notificacion` = 'VISTA' WHERE `observatorio`.`notificacion` = 'PENDIENTE' AND `observatorio`.`id-grupo` = '" + id_grupo + "' AND `observatorio`.`id-estudiante` = '" + id + "'";
                        var m = ctx.Database.ExecuteSqlCommand(sql);
                    }
                    List<observatorio> R = bd.observatorio.Where(t => t.id_estudiante == id && t.id_grupo == id_grupo).OrderBy(t => t.fecha).ToList();
                    foreach (observatorio item in R)
                    {
                        observacionesDTO.observatoriosDTOReport O = new observacionesDTO.observatoriosDTOReport();
                        O.estudiante = item.personas.apellidos.ToString() + " " + item.personas.nombres.ToString();
                        O.ano = item.grupos.año.ToString();
                        O.grado = item.grupos.grados.nom_grado.ToString();
                        O.grupo = item.id_grupo.ToString();
                        O.id = item.id_estudiante.ToString();
                        O.periodo = item.id_periodo.ToString();
                        O.asignatura = item.asignatura.nombre.ToString();
                        O.descripcion = item.observacion.ToString();
                        O.fecha = item.fecha.ToString();
                        O.tipo = item.tipo.ToString();
                        O.notificacion = item.notificacion.ToString();

                        O.resultado = "c_yes";
                        Obser.Add(O);
                    }
                    return Obser;
                }
                else
                {
                    observacionesDTO.observatoriosDTOReport O = new observacionesDTO.observatoriosDTOReport();
                    O.resultado = "c_no";
                    Obser.Add(O);
                    return Obser;
                }
            }
            catch
            {
                return null;
            }
        }
Ejemplo n.º 24
0
        public string eg_reporteGrupo(List<reportesDTO.reportess> n)
        {
            try
            {
                using (bd = new bdsigameEntities())
                {
                    string m = null;
                    foreach (reportesDTO.reportess item in n)
                    {
                        m = e_report(item);
                    }
                    bd.SaveChanges();
                    return "¡Eliminación exitosa¡";
                }
            }
            catch (Exception ex)
            {
                return ("Error Con Codigo 9:" + ex.Message.ToString());
            }

        }
Ejemplo n.º 25
0
        public List<puestosDef> OrganizarPuestosBoletinFinal(string idGrupo)
        {
            string[] Ano = idGrupo.Split('-');
            string ano = Ano[0];

            bdsigameEntities bd = new bdsigameEntities();
            List<matricula2> k = bd.matricula2.Where(t =>
            t.id_grupo == idGrupo).OrderBy(t => t.id_estudiante).ToList();

            // OBTENEMOS LAS ASIGNATURAS QUE TIENE ESE GRUPO
            List<matricula1> kk = bd.matricula1.Where(t =>
           t.id_grupo == idGrupo).ToList();

            List<notas> n = bd.notas.Where(t => t.id_grupo == idGrupo
               ).OrderBy(t => t.id_estudiante).ToList();

            if (k.Count != 0)
            {
                List<puestosFin> pl = new List<puestosFin>();
                List<puestos> PuestoL = new List<puestos>();
                int c = 0;
                foreach (matricula2 item in k) // CHEQUEO LOS ESTUDIANTES QUE CONTIENE EL GRUPO
                {
                    int conta = 0;
                    float nota_prom = 0;
                    float nota_promV = 0;

                    foreach (matricula1 item2 in kk) // CHEQUEO LAS ASIGNATURAS QUE CONTIENE EL GRUPO
                    {
                        int I = 0;
                        int II = 0;
                        int III = 0;
                        int IV = 0;
                        string eitem = item.id_estudiante.ToString();
                        string aitem2 = item2.id_asignatura.ToString();
                        notas NI = bd.notas.Where(t => t.id_grupo == idGrupo && t.id_estudiante == eitem &&
                                                  t.id_periodo == (ano+"-"+"I") && t.id_asignatura == aitem2).FirstOrDefault();
                        notas NII = bd.notas.Where(t => t.id_grupo == idGrupo && t.id_estudiante == eitem &&
                                                 t.id_periodo == (ano+"-"+"II") && t.id_asignatura == aitem2).FirstOrDefault();
                        notas NIII = bd.notas.Where(t => t.id_grupo == idGrupo && t.id_estudiante == eitem &&
                                                 t.id_periodo == (ano+"-"+"III") && t.id_asignatura == aitem2).FirstOrDefault();
                        notas NIV = bd.notas.Where(t => t.id_grupo == idGrupo && t.id_estudiante == eitem &&
                                                 t.id_periodo == (ano+"-"+"IV") && t.id_asignatura == aitem2).FirstOrDefault();

                        if (NI == null) // registramos como 0  si no hay nada
                        { I = 0; }
                        else
                        {
                            I = AjustarNenEnEnteros(NI.nota_s.ToString());
                            if (I == 0)//Quiere decir que NO hay superacion y configuramos con la nota principal
                            { I = AjustarNenEnEnteros(NI.nota.ToString()); }
                            else //Quiere decir que SI hay superacion y configuramos con la nota superada
                            { I = AjustarNenEnEnteros(NI.nota_s.ToString()); }
                        }
                        if (NII == null) // registramos como 0  si no hay nada
                        { II = 0; }
                        else
                        {
                            II = AjustarNenEnEnteros(NII.nota_s.ToString());
                            if (II == 0)//Quiere decir que NO hay superacion y configuramos con la nota principal
                            { II = AjustarNenEnEnteros(NII.nota.ToString()); }
                            else //Quiere decir que SI hay superacion y configuramos con la nota superada
                            { II = AjustarNenEnEnteros(NII.nota_s.ToString()); }
                        }

                        if (NIII == null) // registramos como 0  si no hay nada
                        { III = 0; }
                        else
                        {
                            III = AjustarNenEnEnteros(NIII.nota_s.ToString());
                            if (III == 0)//Quiere decir que NO hay superacion y configuramos con la nota principal
                            { III = AjustarNenEnEnteros(NIII.nota.ToString()); }
                            else //Quiere decir que SI hay superacion y configuramos con la nota superada
                            { III = AjustarNenEnEnteros(NIII.nota_s.ToString()); }
                        }

                        if (NIV == null) // registramos como 0  si no hay nada
                        { IV = 0; }
                        else
                        {
                            IV = AjustarNenEnEnteros(NIV.nota_s.ToString());
                            if (IV == 0)//Quiere decir que NO hay superacion y configuramos con la nota principal
                            { IV = AjustarNenEnEnteros(NIV.nota.ToString()); }
                            else //Quiere decir que SI hay superacion y configuramos con la nota superada
                            { IV = AjustarNenEnEnteros(NIV.nota_s.ToString()); }
                        }
                        nota_promV = (I + II + III + IV) / 4; // Esta seria la nota promedio de la asignatura en el periodo V
                        nota_prom = nota_promV + nota_prom; // Esta seria la nota final del estudiante para sus asignaturas
                        conta++;
                    }


                    nota_prom = nota_prom / conta; // Este seria el promedio del estudiante general en el V
                    puestos u = new puestos();
                    u.id_estudiante = item.id_estudiante.ToString();
                    u.nota_prom = nota_prom;
                    PuestoL.Add(u);
                    c = c + 1;
                }

                // AHORA ORGANIZAMOS
                PuestoL = PuestoL.OrderByDescending(t => t.nota_prom).ToList();
                int No = 1;
                List<puestosDef> PuestoDef = new List<puestosDef>();
                foreach (puestos item5 in PuestoL)
                {

                    puestosDef PuestoD = new puestosDef();
                    PuestoD.No = No;
                    PuestoD.nota_prom = item5.nota_prom;
                    PuestoD.id_estudiante = item5.id_estudiante.ToString();
                    PuestoDef.Add(PuestoD);
                    No = No + 1;
                }
                return PuestoDef;
            }
            else { return null; }
        }
Ejemplo n.º 26
0
 public string mg_reporteGrupo(List<reportesDTO.reportess> n)
 {
     try
     {
         using (bd = new bdsigameEntities())
         {
             string m = null;
             foreach (reportesDTO.reportess item in n)
             {
                 m = m_report(item);
             }
             bd.SaveChanges();
             return "¡Se modificaron los estados de los reportes de este grupo exitosamente!";
         }
     }
     catch (Exception ex)
     {
         return ("Error Con Codigo 9:" + ex.Message.ToString());
     }
 }
Ejemplo n.º 27
0
 public notasDTO.notass c_nota(notasDTO.notass m)
 {
     try
     {
         bdsigameEntities bd = new bdsigameEntities();
         notas n = bd.notas.Where(t =>
         t.id_grupo == m.id_grupo &&
         t.id_profesor == m.id_profesor &&
         t.id_periodo == m.id_periodo &&
         t.id_asignatura == m.id_asignatura &&
          t.id_estudiante == m.id_estudiante
         ).FirstOrDefault();
         if (n != null)
         {
             m.id_logro = n.id_logro.ToString() + "/ " + n.logros.descripcion.ToString(); ;
             m.nota = n.nota;
             m.equivalencia = n.equivalencia;
             m.nota_s = n.nota_s;
             m.equivalencia_s = n.equivalencia_s;
             return m;
         }
         else { return null; }
     }
     catch (Exception )
     {
         return null;
     }
 }
Ejemplo n.º 28
0
 public string m_imgFirma(string idPersona, byte[] img, string contType)
 {
     try
     {
         bdsigameEntities bd = new bdsigameEntities();
         personas u = new personas();
         personasDTO.personaImgDTO p = new personasDTO.personaImgDTO();
         u = bd.personas.Where(t => t.id == idPersona).FirstOrDefault();
         u.firma = img;
         bd.SaveChanges();
         return "Subida exitosa";
     }
     catch (Exception e)
     {
         string m = e.Message.ToString();
         if (m.StartsWith("Error de validación para una o varias entidades. Vea la propiedad 'EntityValidationErrors' para obtener más detalles."))
         { return "No se guardo la imagen. La imagen del coordinador excede la capacidad Máxima de 64 kb"; }
         else
         { return null; }
     }
 }
Ejemplo n.º 29
0
        //_--------------------------------------------------------------------
        public string r_notasGrupo(List<notasDTO.notass> n)
        {
            try
            {
                string m =null;
                foreach (notasDTO.notass item in n)
                {
                    m=r_nota(item);
                }
                if (m == "¡Se agregó el registro de la nota exitosamente!")
                {
                    return "¡Se agrego el registro de notas de este grupo exitosamente!";
                }
                else
                {
                    //Eliminamos las que se alcanzaron a enviar para no tener inconsistencias
                    try
                    {
                        // Capturo los datos que necesito para eliminar el intento fallido

                        foreach (notasDTO.notass item in n)
                        {
                            string IDGrupo = item.id_grupo;
                            string IDProfesor = item.id_profesor;
                            string IDPer = item.id_periodo;
                            string IDAsig = item.id_asignatura;
                            string IDEst = item.id_estudiante;

                            bdsigameEntities bd = new bdsigameEntities();
                            notas ne = bd.notas.Where(t =>
                            t.id_grupo == IDGrupo &&
                            t.id_profesor == IDProfesor &&
                            t.id_periodo == IDPer &&
                            t.id_asignatura == IDAsig &&
                            t.id_estudiante == IDEst
                            ).FirstOrDefault();
                            int l = 0;
                            if (ne == null)
                            {
                                l = 0;
                            }
                            else
                            {
                                bd.notas.Remove(ne);
                                bd.SaveChanges();
                            }
                        }
                    }
                    catch (Exception EX)
                    {
                        string s = EX.Message.ToString();
                    }

                    return "Lo sentimos. Tuvimos procesar este grupo. Al parecer no envió los datos correctos. Tenga en cuenta que debe enviar la nota de cada estudiante con su respectiva nota, logro alcanzado y periodo academico. Revise y reintente. "; }
                }
            catch
            {
                { return null; }
            }
        }
Ejemplo n.º 30
0
 public string e_notasGrupoV2(List<notasDTO.notass> n)
 {
     try
     {
         using (bd = new bdsigameEntities())
         {
             string m = null;
             foreach (notasDTO.notass item in n)
             {
                 m = e_notaV2(item);
             }
             bd.SaveChanges();
             return "Se Eliminarón los registros de manera exitosa";
         }
     }
     catch (Exception ex)
     {
         return ("Error Con Codigo 6:" + ex.Message.ToString());
     }
 }