Example #1
0
        public List <Object> GetPersonas()
        {
            try
            {
                Persona       u          = new Persona();
                List <Object> lstPersona = UTILS.GET("private/persona", "persona", AuthUser.token, u.GetType());
                if (lstPersona == null || lstPersona.Count == 0)
                {
                    return(null);
                }
                Contacto      c            = new Contacto();
                List <Object> lstContactos = c.getContactos();
                if (lstContactos == null)
                {
                    return(null);
                }
                Direccion     dir         = new Direccion();
                List <Object> direcciones = dir.GetDireccion();

                Persona  per;
                Contacto con;
                for (int i = 0; i < lstPersona.Count; i++)
                {
                    for (int j = 0; j < lstContactos.Count; j++)
                    {
                        con = (Contacto)lstContactos[j];
                        per = (Persona)lstPersona[i];
                        if (per.id_persona.Equals(con.id_persona))
                        {
                            per.contacto  = con;
                            lstPersona[i] = per;
                            break;
                        }
                    }

                    for (int j = 0; j < direcciones.Count; j++)
                    {
                        dir = (Direccion)direcciones[j];
                        per = (Persona)lstPersona[i];
                        if (per.id_direccion.Equals(dir.id_direccion))
                        {
                            per.direccion = dir;
                            lstPersona[i] = per;
                            break;
                        }
                    }
                }

                return(lstPersona);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #2
0
 public void deleteUsuario(string id_usuario)
 {
     try
     {
         Usuario usr = new Usuario();
         UTILS.DELETE("private/usuario/" + id_usuario, "usuario", AuthUser.token, usr.GetType());
     } catch (Exception)
     {
         // do nothing
     }
 }
Example #3
0
        public bool actualizarCurso(Cursos curso)
        {
            try
            {
                string        id_curso = curso.id_curso.ToString();
                List <Object> c        = UTILS.PUT("private/curso/" + id_curso, "curso", AuthUser.token, curso.GetType(), curso);

                return(c != null && c.Count != 0);
            } catch (Exception)
            {
                return(false);
            }
        }
Example #4
0
        public bool actualizarDireccion(Direccion direccion)
        {
            try
            {
                string id = direccion.id_direccion.ToString();

                List <Object> dir = UTILS.PUT("private/direccion/" + id, "direccion", AuthUser.token, direccion.GetType(), direccion);

                return(dir != null && dir.Count != 0);
            } catch (Exception)
            {
                return(false);
            }
        }
Example #5
0
        public Boolean usuarioExists(string usuario)
        {
            try
            {
                Usuario       u        = new Usuario();
                List <Object> usuarios = UTILS.GET("private/usuario?usuario=" + usuario, "usuario", AuthUser.token, u.GetType());

                return(usuarios != null && usuarios.Count > 0);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #6
0
        public Boolean rutExists(string rut)
        {
            try
            {
                Persona       per     = new Persona();
                List <Object> persona = UTILS.GET("private/persona?rut=" + rut, "persona", AuthUser.token, per.GetType());

                return(persona != null && persona.Count > 0);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #7
0
        public bool actualizarPrograma(ProgramaEstudio programa)
        {
            try
            {
                string        id   = programa.id_programa.ToString();
                List <Object> prog = UTILS.PUT("private/programa/" + id, "programa", AuthUser.token, programa.GetType(), programa);

                return(prog != null && prog.Count != 0);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #8
0
        public bool actualizarPersona(Persona persona)
        {
            try
            {
                string id = persona.id_persona.ToString();

                List <Object> per = UTILS.PUT("private/persona/" + id, "persona", AuthUser.token, persona.GetType(), persona);

                return(per != null && per.Count != 0);
            } catch (Exception)
            {
                return(false);
            }
        }
Example #9
0
        public bool actualizarContacto(Contacto contacto)
        {
            try
            {
                string id = contacto.id_contacto.ToString();

                List <Object> cont = UTILS.PUT("private/contacto/" + id, "contacto", AuthUser.token, contacto.GetType(), contacto);

                return(cont != null && cont.Count != 0);
            } catch (Exception)
            {
                return(false);
            }
        }
Example #10
0
        public void envioCorreo(string id_alumno, string estado, string nomb_programa, DateTime?fech_respuesta)
        {
            try
            {
                if (estado.Equals("A"))
                {
                    estado = "Aprobada";
                }
                else if (estado.Equals("R"))
                {
                    estado = "Rechazada";
                }

                Alumno        al     = new Alumno();
                List <Object> alumno = UTILS.GET("private/alumno/" + id_alumno, "alumno", AuthUser.token, al.GetType());
                if (alumno != null && alumno.Count > 0)
                {
                    al = (Alumno)alumno[0];
                    string id_usuario = al.id_usuario.ToString();

                    Persona       per     = new Persona();
                    List <Object> persona = UTILS.GET("private/persona?id_usuario=" + id_usuario, "persona", AuthUser.token, per.GetType());

                    if (persona != null && persona.Count > 0)
                    {
                        per = (Persona)persona[0];
                        string id_persona = per.id_persona.ToString();

                        Contacto      cont     = new Contacto();
                        List <Object> contacto = UTILS.GET("private/contacto?id_persona=" + id_persona, "contacto", AuthUser.token, cont.GetType());

                        if (contacto != null && contacto.Count > 0)
                        {
                            cont = (Contacto)contacto[0];
                            Mail email = new Mail();
                            email.to      = cont.desc_contacto;
                            email.text    = "Estimado Alumno, \n\nHoy " + fech_respuesta.Value.ToShortDateString() + " su postulación al programa \"" + nomb_programa + "\" ha sido " + estado;
                            email.subject = "Respuesta Postulación";

                            UTILS.POST("private/email", "", AuthUser.token, email.GetType(), email);
                        }
                    }
                }
            }
            catch (Exception)
            {
                // do nothing
            }
        }
Example #11
0
 public List <object> getPais()
 {
     try
     {
         Pais          pais    = new Pais();
         List <object> lstPais = UTILS.GET("private/pais", "pais", AuthUser.token, pais.GetType());
         if (lstPais == null || lstPais.Count == 0)
         {
             return(null);
         }
         return(lstPais);
     } catch (Exception)
     {
         return(null);
     }
 }
Example #12
0
 public List <object> getCELS()
 {
     try
     {
         CEL           cel    = new CEL();
         List <object> lstCEL = UTILS.GET("private/cel", "cel", AuthUser.token, cel.GetType());
         if (lstCEL == null || lstCEL.Count == 0)
         {
             return(null);
         }
         return(lstCEL);
     } catch (Exception)
     {
         return(null);
     }
 }
Example #13
0
 public List <object> getCEM()
 {
     try
     {
         CEM           cem    = new CEM();
         List <object> lstCEM = UTILS.GET("private/cem", "cem", AuthUser.token, cem.GetType());
         if (lstCEM == null || lstCEM.Count == 0)
         {
             return(null);
         }
         return(lstCEM);
     } catch (Exception)
     {
         return(null);
     }
 }
Example #14
0
        public List <Object> getRoles()
        {
            try
            {
                Rol           r      = new Rol();
                List <Object> lstRol = UTILS.GET("private/rol", "rol", AuthUser.token, r.GetType());
                if (lstRol == null || lstRol.Count == 0)
                {
                    return(null);
                }

                return(lstRol);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #15
0
        public Contacto guardarContacto(Contacto contacto)
        {
            try
            {
                List <Object> cont = UTILS.POST("private/contacto", "contacto", AuthUser.token, contacto.GetType(), contacto);

                if (cont == null || cont.Count == 0)
                {
                    return(null);
                }
                return((Contacto)cont[0]);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #16
0
        public CEL guardarCEL(CEL cel)
        {
            try
            {
                List <Object> c = UTILS.POST("private/cel", "cel", AuthUser.token, cel.GetType(), cel);

                if (c == null || c.Count == 0)
                {
                    return(null);
                }

                return((CEL)c[0]);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #17
0
        public Usuario guardarUsuario(Usuario usuario)
        {
            try
            {
                List <Object> usr = UTILS.POST("private/usuario", "usuario", AuthUser.token, usuario.GetType(), usuario);
                if (usr == null || usr.Count == 0)
                {
                    return(null);
                }

                return((Usuario)usr[0]);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #18
0
 public List <object> GetProgramasEstudios()
 {
     try
     {
         ProgramaEstudio progEst      = new ProgramaEstudio();
         List <object>   lstProgramas = UTILS.GET("private/programa", "programa", AuthUser.token, progEst.GetType());
         if (lstProgramas == null || lstProgramas.Count == 0)
         {
             return(null);
         }
         return(lstProgramas);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Example #19
0
        public Persona guardarPersona(Persona persona)
        {
            try
            {
                List <Object> per = UTILS.POST("private/persona", "persona", AuthUser.token, persona.GetType(), persona);

                if (per == null || per.Count == 0)
                {
                    return(null);
                }

                return((Persona)per[0]);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #20
0
        public Direccion guardarDireccion(Direccion direccion)
        {
            try
            {
                List <Object> dir = UTILS.POST("private/direccion", "direccion", AuthUser.token, direccion.GetType(), direccion);

                if (dir == null || dir.Count == 0)
                {
                    return(null);
                }

                return((Direccion)dir[0]);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #21
0
        public List <Object> getContactos()
        {
            try
            {
                Contacto      c            = new Contacto();
                List <Object> lstContactos = UTILS.GET("private/contacto", "contacto", AuthUser.token, c.GetType());
                if (lstContactos == null || lstContactos.Count == 0)
                {
                    return(null);
                }

                return(lstContactos);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #22
0
        public List <Object> getSeguros()
        {
            try
            {
                Seguro        se         = new Seguro();
                List <Object> lstSeguros = UTILS.GET("private/seguro", "seguro", AuthUser.token, se.GetType());
                if (lstSeguros == null || lstSeguros.Count == 0)
                {
                    return(null);
                }

                return(lstSeguros);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #23
0
        public List <Object> GetAlumnos()
        {
            try
            {
                Alumno alu = new Alumno();

                List <Object> lstAlumnos = UTILS.GET("private/alumno", "alumno", AuthUser.token, alu.GetType());
                if (lstAlumnos == null || lstAlumnos.Count == 0)
                {
                    return(null);
                }
                Persona       per         = new Persona();
                List <Object> lstPersonas = per.GetPersonas();
                if (lstPersonas == null || lstPersonas.Count == 0)
                {
                    return(null);
                }

                for (int i = 0; i < lstAlumnos.Count; i++)
                {
                    for (int j = 0; j < lstPersonas.Count; j++)
                    {
                        Persona p = (Persona)lstPersonas[j];
                        Alumno  a = (Alumno)lstAlumnos[i];
                        if (p.id_usuario.Equals(a.id_usuario))
                        {
                            a.persona     = p;
                            lstAlumnos[i] = a;
                            break;
                        }
                    }
                }

                return(lstAlumnos);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #24
0
        public List <Object> GetDireccion()
        {
            try
            {
                Direccion     d            = new Direccion();
                Ciudad        ci           = new Ciudad();
                List <Object> lstDireccion = UTILS.GET("private/direccion", "direccion", AuthUser.token, d.GetType());
                if (lstDireccion == null || lstDireccion.Count == 0)
                {
                    return(null);
                }
                List <Object> lstCiudades = ci.GetCiudades();
                if (lstCiudades == null)
                {
                    return(null);
                }

                for (int i = 0; i < lstDireccion.Count; i++)
                {
                    for (int j = 0; j < lstCiudades.Count; j++)
                    {
                        Direccion dir = (Direccion)lstDireccion[i];
                        Ciudad    ciu = (Ciudad)lstCiudades[j];
                        if (dir.id_ciudad.Equals(ciu.id_ciudad))
                        {
                            dir.ciudad      = ciu;
                            lstDireccion[i] = dir;
                            break;
                        }
                    }
                }

                return(lstDireccion);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #25
0
        public List <Object> GetFamilias()
        {
            try
            {
                Familia       f           = new Familia();
                Persona       p           = new Persona();
                List <Object> lstFamilias = UTILS.GET("private/familia", "familia", AuthUser.token, f.GetType());
                if (lstFamilias == null || lstFamilias.Count == 0)
                {
                    return(null);
                }
                List <Object> lstPersonas = p.GetPersonas();
                if (lstPersonas == null)
                {
                    return(null);
                }

                for (int i = 0; i < lstFamilias.Count; i++)
                {
                    for (int j = 0; j < lstPersonas.Count; j++)
                    {
                        Familia fa  = (Familia)lstFamilias[i];
                        Persona per = (Persona)lstPersonas[j];
                        if (fa.id_usuario.Equals(per.id_usuario))
                        {
                            fa.persona     = per;
                            lstFamilias[i] = fa;
                            break;
                        }
                    }
                }
                return(lstFamilias);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #26
0
        public List <Object> GetCiudades()
        {
            try
            {
                Ciudad        cu          = new Ciudad();
                Pais          pa          = new Pais();
                List <Object> lstCiudades = UTILS.GET("private/ciudad", "ciudad", AuthUser.token, cu.GetType());
                if (lstCiudades == null || lstCiudades.Count == 0)
                {
                    return(null);
                }
                List <Object> lstPaises = UTILS.GET("private/pais", "pais", AuthUser.token, pa.GetType());
                if (lstPaises == null || lstPaises.Count == 0)
                {
                    return(null);
                }
                for (int i = 0; i < lstCiudades.Count; i++)
                {
                    for (int j = 0; j < lstPaises.Count; j++)
                    {
                        Ciudad c = (Ciudad)lstCiudades[i];
                        Pais   p = (Pais)lstPaises[j];
                        if (c.id_pais.Equals(p.id_pais))
                        {
                            c.pais         = p;
                            lstCiudades[i] = c;
                            break;
                        }
                    }
                }

                return(lstCiudades);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #27
0
        public List <object> getCursos()
        {
            try
            {
                Cursos        crs       = new Cursos();
                List <object> lstCursos = UTILS.GET("private/curso", "curso", AuthUser.token, crs.GetType());
                if (lstCursos == null || lstCursos.Count == 0)
                {
                    return(null);
                }
                ProgramaEstudio prg         = new ProgramaEstudio();
                List <object>   lstPrograma = prg.GetProgramasEstudios();
                if (lstPrograma == null)
                {
                    lstPrograma = new List <object>();
                }

                for (int i = 0; i < lstCursos.Count; i++)
                {
                    for (int j = 0; j < lstPrograma.Count; j++)
                    {
                        Cursos          c = (Cursos)lstCursos[i];
                        ProgramaEstudio p = (ProgramaEstudio)lstPrograma[j];
                        if (c.id_programa.Equals(p.id_programa))
                        {
                            c.programaEstudio = p;
                            lstCursos[i]      = c;
                            break;
                        }
                    }
                }
                return(lstCursos);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #28
0
        public List <object> GetProgramasEstudiosCEL()
        {
            ProgramaEstudio progEst      = new  ProgramaEstudio();
            List <object>   lstProgramas = UTILS.GET("private/programa", "programa", AuthUser.token, progEst.GetType());

            if (lstProgramas == null || lstProgramas.Count == 0)
            {
                return(null);
            }
            CEL           cl     = new CEL();
            List <object> lstCel = cl.getCELS();

            if (lstCel == null)
            {
                lstCel = new List <object>();
            }

            for (int i = 0; i < lstProgramas.Count; i++)
            {
                for (int j = 0; j < lstCel.Count; j++)
                {
                    CEL             c  = (CEL)lstCel[j];
                    ProgramaEstudio pg = (ProgramaEstudio)lstProgramas[i];
                    if (pg.id_cel.Equals(c.id_cel))
                    {
                        pg.cel          = c;
                        lstProgramas[i] = pg;
                        break;
                    }
                }
            }

            List <Object> arr = filtrarProgramas(lstProgramas);

            return(arr);
        }
Example #29
0
        public List <Object> GetPostulaciones()
        {
            try
            {
                Postulaciones post = new Postulaciones();

                List <object> lstPostulaciones = UTILS.GET("private/postulacion", "postulacion", AuthUser.token, post.GetType());
                if (lstPostulaciones == null || lstPostulaciones.Count == 0)
                {
                    return(null);
                }
                /**/
                Familia       fam         = new Familia();
                List <object> lstFamilias = fam.GetFamilias();
                if (fam == null)
                {
                    lstFamilias = new List <object>();
                }
                /**/
                Alumno        al     = new Alumno();
                List <object> lstAlu = al.GetAlumnos();
                if (lstAlu == null)
                {
                    return(null);
                }

                /* uniendo familia y  alumno con postulacion*/
                for (int i = 0; i < lstPostulaciones.Count; i++)
                {
                    for (int j = 0; j < lstAlu.Count; j++)
                    {
                        Alumno        a  = (Alumno)lstAlu[j];
                        Postulaciones po = (Postulaciones)lstPostulaciones[i];
                        if (po.id_alumno.Equals(a.id_alumno))
                        {
                            po.alumno           = a;
                            lstPostulaciones[i] = po;
                            break;
                        }
                    }

                    for (int k = 0; k < lstFamilias.Count; i++)
                    {
                        Familia       fa = (Familia)lstFamilias[k];
                        Postulaciones po = (Postulaciones)lstPostulaciones[i];
                        if (po.id_familia.Equals(fa.id_familia))
                        {
                            po.familia          = fa;
                            lstPostulaciones[i] = po;
                            break;
                        }
                    }
                }
                /* llamando a seguro y asegurar que no sea nul o 0*/
                Seguro        se         = new Seguro();
                List <Object> lstSeguros = UTILS.GET("private/seguro", "seguro", AuthUser.token, se.GetType());
                if (lstSeguros != null & lstSeguros.Count > 0)
                {
                    se = (Seguro)lstSeguros[0];
                }

                ProgramaEstudio prog         = new ProgramaEstudio();
                List <Object>   lstProgramas = prog.GetProgramasEstudios();
                if (lstProgramas == null || lstProgramas.Count == 0)
                {
                    return(null);
                }
                List <Object> arr         = prog.filtrarProgramas(lstProgramas);
                List <Object> vigentes    = (List <Object>)arr[0];
                List <Object> finalizados = (List <Object>)arr[1];

                bool            vigente;
                Postulaciones   p;
                ProgramaEstudio pe;
                for (int i = 0; i < lstPostulaciones.Count; i++)
                {
                    vigente  = false;
                    p        = (Postulaciones)lstPostulaciones[i];
                    p.seguro = se;
                    for (int j = 0; j < vigentes.Count; j++)
                    {
                        pe = (ProgramaEstudio)vigentes[j];
                        if (p.id_programa.Equals(pe.id_programa))
                        {
                            p.programaEstudio   = pe;
                            lstPostulaciones[i] = p;
                            vigente             = true;
                            break;
                        }
                    }

                    if (!vigente)
                    {
                        for (int j = 0; j < finalizados.Count; j++)
                        {
                            pe = (ProgramaEstudio)finalizados[j];
                            if (p.id_programa.Equals(pe.id_programa))
                            {
                                p.programaEstudio   = pe;
                                lstPostulaciones[i] = p;
                                break;
                            }
                        }
                    }
                }

                List <Object> filtradas = filtrarPostulaciones(lstPostulaciones, arr);

                return(filtradas);
            } catch (Exception)
            {
                return(null);
            }
        }
Example #30
0
        public List <Object> filtrarPostulaciones(List <Object> postulaciones, List <Object> programas)
        {
            List <Object> arr = new List <Object>();

            try
            {
                List <Object> vigentes    = (List <Object>)programas[0];
                List <Object> finalizados = (List <Object>)programas[1];

                List <Object> post_vigentes    = new List <Object>();
                List <Object> post_finalizadas = new List <Object>();

                if (postulaciones != null && postulaciones.Count > 0)
                {
                    bool            vigente;
                    Postulaciones   p;
                    ProgramaEstudio pe;
                    for (int i = 0; i < postulaciones.Count; i++)
                    {
                        vigente = false;
                        p       = (Postulaciones)postulaciones[i];
                        for (int j = 0; j < vigentes.Count; j++)
                        {
                            pe = (ProgramaEstudio)vigentes[j];
                            if (p.estado.Equals("P") && p.id_programa.Equals(pe.id_programa))
                            {
                                post_vigentes.Add(p);
                                vigente = true;
                                break;
                            }
                        }

                        if (!vigente)
                        {
                            for (int j = 0; j < finalizados.Count; j++)
                            {
                                if (p.estado.Equals("R") || p.estado.Equals("A"))
                                {
                                    post_finalizadas.Add(p);
                                    break;
                                }
                                pe = (ProgramaEstudio)finalizados[j];
                                if (p.id_programa.Equals(pe.id_programa))
                                {
                                    if (p.estado.Equals("P"))
                                    {
                                        p.estado = "R";
                                        if (p.fech_respuesta == null)
                                        {
                                            p.fech_respuesta = DateTime.UtcNow.Date;
                                        }
                                        string id = p.id_postulacion.ToString();
                                        UTILS.PUT("private/postulacion/" + id, "postulacion", AuthUser.token, p.GetType(), p);
                                    }
                                    post_finalizadas.Add(p);
                                    break;
                                }
                            }
                        }
                    }
                }

                arr.Add(post_vigentes);
                arr.Add(post_finalizadas);

                return(arr);
            }
            catch (Exception)
            {
                arr.Clear();
                arr.Add(new List <Object>());
                arr.Add(new List <Object>());
                return(arr);
            }
        }