public static List <Laboratorio> ListaLaboratorios()
        {
            List <Laboratorio> labList   = new List <Laboratorio>();
            SQLSERVERDB        dbManager = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (Object[] row in dbManager.Select("select id_laboratorio from tLaboratorio"))
            {
                labList.Add(new Laboratorio((int)row[0]));
            }
            return(labList);
        }
Exemplo n.º 2
0
        public Actividad_Solicitud(Usuario user, Actividad act, EstadoActividadSolicitudE estado)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            String      ins  = "INSERT INTO Actividades_Solicitudes VALUES('" + user.Email + "'," + act.ID_Actividad + ",'" + estado.ToString() + "');";

            miBD.Insert(ins);

            this.usuario         = user;
            this.actividad       = act;
            this.estadoSolicitud = estado;
        }
Exemplo n.º 3
0
        public Rol(string name, string des, bool adm)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Insert("INSERT INTO tRol VALUES('" + name + "', '"
                        + des + "', " + (adm ? 1 : 0) + ");");
            rolName  = name;
            rolDes   = des;
            admin    = adm;
            permisos = new List <Permiso>();
        }
Exemplo n.º 4
0
        public Usuario(string n, string p, Rol r)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Insert("INSERT INTO tUsuario VALUES('" + n + "', '"
                        + p + "', '" + r.RolName + "');");

            nombre   = n;
            password = p;
            rol      = r;
        }
Exemplo n.º 5
0
        public static List <Partido> ListaPartidos()
        {
            List <Partido> lista     = new List <Partido>();
            SQLSERVERDB    dbManager = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (Object[] row in dbManager.Select("select siglas from tPartido;"))
            {
                lista.Add(new Partido((string)row[0]));
            }
            return(lista);
        }
Exemplo n.º 6
0
        public Preferencia(String nombre_preferencia, Usuario user)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            String      ins  = "INSERT INTO Preferencias (nombre_preferencia,emailUser) VALUES ('" + nombre_preferencia + "','" + user.Email + "');";

            miBD.Insert(ins);
            ID_preferencia          = int.Parse(miBD.SelectScalar("SELECT max(ID_Preferencia) FROM Preferencias;").ToString());
            this.nombre_preferencia = nombre_preferencia;
            this.user    = user;
            competencias = null;
        }
Exemplo n.º 7
0
        public Preferencia(String nombre_preferencia, Usuario user, bool t)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            String      sel  = "Select ID_Preferencia FROM Preferencias WHERE nombre_preferencia = '" + nombre_preferencia + "' and emailUser ='******';";

            Object[] tupla = miBD.Select(sel)[0];
            ID_preferencia          = int.Parse(tupla[0].ToString());
            this.nombre_preferencia = nombre_preferencia;
            this.user    = user;
            competencias = null;
        }
Exemplo n.º 8
0
        public Permiso(String r, String p)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            object[] tupla = miBD.Select("SELECT * FROM tPermiso WHERE rolName = '"
                                         + r + "' AND pantalla = '" + p + "';")[0];
            rolName      = (string)tupla[0];
            pantalla     = (string)tupla[1];
            acceso       = (bool)tupla[2];
            modificacion = (bool)tupla[3];
        }
Exemplo n.º 9
0
        public Grado(int id)
        {
            // Crea el objeto cargando sus valores de la base de datos
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            Object[] tupla = miBD.Select("SELECT * FROM Grados "
                                         + "WHERE ID_Grado=" + id + ";")[0];

            ID_grado    = (int)tupla[0];
            nombreGrado = (String)tupla[1];
        }
Exemplo n.º 10
0
        public static List <Persona> ListaProducto()
        {
            List <Persona> lista     = new List <Persona>();
            SQLSERVERDB    dbManager = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (Object[] row in dbManager.Select("select id from tPersona"))
            {
                lista.Add(new Persona((string)row[0]));
            }
            return(lista);
        }
Exemplo n.º 11
0
        public Asignatura(int id)
        {
            // Crea el objeto cargando sus valores de la base de datos
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            Object[] tupla = miBD.Select("SELECT * FROM Asignaturas "
                                         + "WHERE ID_Asignatura=" + id + ";")[0];
            ID_asig    = (int)tupla[0];
            nombreAsig = (String)tupla[1];
            grado      = new Grado((int)tupla[2]);
        }
Exemplo n.º 12
0
        public Permiso(string r, string p, bool a, bool m)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Insert("INSERT INTO tPermiso VALUES('" + r + "', '"
                        + p + "', " + (a ? 1 : 0) + ", " + (m ? 1 : 0) + ");");

            rolName      = r;
            pantalla     = p;
            acceso       = a;
            modificacion = m;
        }
Exemplo n.º 13
0
        public static List <Permiso> ListaPermisosRol(string rolName)
        {
            List <Permiso> lista = new List <Permiso>();
            SQLSERVERDB    miBD  = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (object[] tupla in miBD.Select("SELECT pantalla FROM tPermiso WHERE rolName = '" + rolName + "';"))
            {
                string pantalla = (string)tupla[0];
                lista.Add(new Permiso(rolName, pantalla));
            }
            return(lista);
        }
Exemplo n.º 14
0
        public Actividad_Realizada(Usuario participante, Actividad actividad, Boolean f)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            String      ins  = "INSERT INTO Actividades_Realizadas (emailParticipante,idAct) VALUES ('"
                               + participante.Email + "'," + actividad.ID_Actividad + ");";

            miBD.Insert(ins);

            this.participante      = participante;
            this.actividad         = actividad;
            this.estadoRealizacion = EstadoActividadR.EVALUACION_PARTICIPANTE;
        }
Exemplo n.º 15
0
        public static List <Rol> ListaRoles()
        {
            List <Rol>  lista = new List <Rol>();
            SQLSERVERDB miBD  = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (object[] tupla in miBD.Select("SELECT rolName FROM tRol;"))
            {
                string r = (string)tupla[0];
                lista.Add(new Rol(r));
            }
            return(lista);
        }
Exemplo n.º 16
0
        private void CargarActividades()
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            String      sel  = "SELECT idAct FROM Rel_Proyecto_Actividades WHERE idProy=" + this.ID_Proyecto + ";";

            actividades = new List <Actividad>();
            foreach (Object[] tupla in miBD.Select(sel))
            {
                Actividad act = new Actividad((int)tupla[0]);
                actividades.Add(act);
            }
        }
Exemplo n.º 17
0
        public static List <Producto> ListaProducto()
        {
            List <Producto> lista = new List <Producto>();
            // Retorna una lista con todos los objetos de la clase almacenados en la base de datos
            SQLSERVERDB dbManager = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (Object[] row in dbManager.Select("select codigo from tProducto;"))
            {
                lista.Add(new Producto((int)row[0]));
            }
            return(lista);
        }
Exemplo n.º 18
0
Arquivo: Rol.cs Projeto: DeuneB07/APS
        public Rol(String name, Boolean adm, String des)
        {
            // Crea el objeto y lo inserta en la base de datos
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Insert("INSERT INTO Roles VALUES('" + name +
                        "'," + (adm ? 1 : 0) + ",'" + des + "');");
            nombreRol = name;
            admin     = adm;
            descRol   = des;
            permisos  = null;
        }
Exemplo n.º 19
0
 public static Boolean Contains(Usuario user, Actividad act)
 {
     if (user != null && act != null)
     {
         SQLSERVERDB     miBD  = new SQLSERVERDB(BD_SERVER, BD_NAME);
         List <Object[]> lista = miBD.Select("SELECT * FROM Actividades_Realizadas WHERE emailParticipante='" + user.Email + "' AND idAct=" + act.ID_Actividad + ";");
         return(lista.Count == 1);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 20
0
        public void ModiRol(Usuario u, Rol r)
        {
            if (!this.rol.Admin)
            {
                throw new Error("El usuario " + this.Nombre
                                + " no puede cambiar el rol del usuario " + u.Nombre);
            }
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Update("UPDATE tUsuario SET rolName = '" + r.RolName
                        + "' WHERE nombre = '" + u.Nombre + "';");
            u.rol = r;
        }
Exemplo n.º 21
0
Arquivo: Rol.cs Projeto: DeuneB07/APS
        private List <Permiso> permisos; //Lazzy

        public static List <Rol> ListaRoles()
        {
            // Retorna una lista con todos los obejtos de la clase almacenados en la base de datos
            List <Rol>  lista = new List <Rol>();
            SQLSERVERDB miBD  = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (Object[] tupla in miBD.Select("SELECT nombreRol FROM Roles;"))
            {
                Rol r = new Rol((String)tupla[0]);
                lista.Add(r);
            }
            return(lista);
        }
Exemplo n.º 22
0
        public static List <Paciente> ListaPacientes()
        {
            List <Paciente> lista = new List <Paciente>();
            SQLSERVERDB     miBD  = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (object[] tupla in miBD.Select("SELECT NumSS FROM tPaciente;"))
            {
                int      id = (int)tupla[0];
                Paciente p  = new Paciente(id);
                lista.Add(p);
            }
            return(lista);
        }
Exemplo n.º 23
0
        public static List <Asignatura> ListaAsignaturas(Grado g)
        {
            SQLSERVERDB       miBD  = new SQLSERVERDB(BD_SERVER, BD_NAME);
            List <Asignatura> lista = new List <Asignatura>();

            foreach (object[] tupla in miBD.Select("SELECT ID_Asignatura FROM Asignaturas WHERE idGrado=" + g.ID_Grado + ";"))
            {
                int        id = (int)tupla[0];
                Asignatura a  = new Asignatura(id);
                lista.Add(a);
            }
            return(lista);
        }
Exemplo n.º 24
0
        public static List <Actividad> ListaActividades(EstadoActividadR estado)
        {
            SQLSERVERDB      miBD  = new SQLSERVERDB(BD_SERVER, BD_NAME);
            List <Actividad> lista = new List <Actividad>();

            foreach (Object[] tupla in miBD.Select("SELECT count(emailParticipante), idAct FROM Actividades_Realizadas WHERE estadoRealizacion = '" + estado.ToString() + "' group by idAct;"))
            {
                int       id = (int)tupla[1];
                Actividad aR = new Actividad(id);
                lista.Add(aR);
            }
            return(lista);
        }
Exemplo n.º 25
0
        private List <Competencia> competencias; //lazzy

        public static void ActualizarEstadoActividades()
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            //UPDATE EN_PROCESO
            miBD.Update("UPDATE Actividades SET estadoAct='" + EstadoActividadE.EN_PROCESO.ToString() + "' " +
                        "WHERE fechaInicio<=CONVERT(date,SYSDATETIME()) " +
                        "AND (estadoAct like '" + EstadoActividadE.ABIERTA.ToString() + "' OR estadoAct like '" + EstadoActividadE.CERRADA.ToString() + "')");
            //UPDATE CONCLUIDA
            miBD.Update("UPDATE Actividades SET estadoAct='" + EstadoActividadE.CONCLUIDA.ToString() + "' " +
                        "WHERE fechaFin<=CONVERT(date,SYSDATETIME()) " +
                        "AND estadoAct like '" + EstadoActividadE.EN_PROCESO.ToString() + "'");
        }
Exemplo n.º 26
0
        public static List <Actividad> ListaActividades()    //Devuelve las actividades, sin tener en cuenta Estado
        {
            SQLSERVERDB      miBD  = new SQLSERVERDB(BD_SERVER, BD_NAME);
            List <Actividad> lista = new List <Actividad>();

            foreach (Object[] tupla in miBD.Select("SELECT count(emailParticipante), idAct FROM Actividades_Realizadas group by idAct;"))
            {
                int       id = (int)tupla[1];
                Actividad aR = new Actividad(id);
                lista.Add(aR);
            }
            return(lista);
        }
Exemplo n.º 27
0
        public void BorraMensaje()
        {
            // Actualiza el atributo en memoria y en la base de datos
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Delete("DELETE FROM Mensajes WHERE ID_Mensaje =" + this.ID_mensaje + ";");
            emisor        = receptor = null;
            asunto        = texto = null;
            date          = DateTime.Today;
            borradoEmisor = borradoReceptor = false;
            ID_mensaje    = -1;
            leido         = false;
        }
Exemplo n.º 28
0
        private List <Actividad> actividades;    //lazzy

        public static List <Competencia> ListaCompetencias()
        {
            List <Competencia> lista = new List <Competencia>();
            // Retorna una lista con todos los obejtos de la clase almacenados en la base de datos
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (Object[] tupla in miBD.Select("SELECT idCompetencia FROM Competencias;"))
            {
                int id = (int)tupla[0];
                lista.Add(new Competencia(id));
            }
            return(lista);
        }
Exemplo n.º 29
0
        public static List <Cita> ListaCitas(Paciente p)
        {
            List <Cita> lista = new List <Cita>();
            SQLSERVERDB miDB  = new SQLSERVERDB(BD_SERVER, BD_NAME);

            foreach (object[] tupla in miDB.Select("SELECT id_cita FROM tCita where numsspaciente = " + p.NumeroSS_Paciente + ";"))
            {
                int  id = (int)tupla[0];
                Cita c  = new Cita(id);
                lista.Add(c);
            }
            return(lista);
        }
Exemplo n.º 30
0
        public static List <Asignatura> ListaAsignaturas(Usuario user)
        {
            SQLSERVERDB       miBD  = new SQLSERVERDB(BD_SERVER, BD_NAME);
            List <Asignatura> lista = new List <Asignatura>();

            foreach (object[] tupla in miBD.Select("SELECT idAsig FROM Rel_User_Asig WHERE emailUser='******';"))
            {
                int        id = (int)tupla[0];
                Asignatura a  = new Asignatura(id);
                lista.Add(a);
            }
            return(lista);
        }