示例#1
0
        public Usuario(string correo, string nombre, string contrasenia, string cif, string niu, Rol rol)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Insert("INSERT INTO Usuario VALUES ('" + correo + "','" + nombre + "','" + contrasenia + "','" + cif + "','" + niu + "','" + rol.RolName + "');");
            this.correoUsuario      = correo;
            this.nombreUsuario      = nombre;
            this.contraseniaUsuario = contrasenia;
            if (cif == null || cif.Equals(""))
            {
                this.cif = "";
            }
            else
            {
                this.cif = cif;
            }

            if (niu == null || niu.Equals(""))
            {
                this.niu = "";
            }
            else
            {
                this.niu = niu;
            }
            this.rol = rol;
        }
示例#2
0
        public Noticias(string t, string a, string c, string f)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Insert("INSERT INTO Noticias VALUES ('" + t + "','" + a + "','" + c + "','" + f + "');");
            this.titulo = t;
            this.autor  = a;
            this.cuerpo = c;
            this.fecha  = f;
        }
示例#3
0
        public MaterialActividad(string nombre, string enlace, Actividad actividad)
        {
            //Insert
            SQLSERVERDB miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      sentencia = "INSERT INTO MaterialActividad VALUES (" + actividad.IdActividad + ",'" + nombre + "','" + enlace + "');";

            miBD.Insert(sentencia);

            this.nombre      = nombre;
            this.enlace      = enlace;
            this.idActividad = actividad.IdActividad;
        }
示例#4
0
        public Debate(string creador, string asunto, string mensaje, string fecha)
        {
            SQLSERVERDB miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      sentencia = "INSERT INTO Debate VALUES (" + 0 + ",'" + creador + "', '" + asunto + "','" + mensaje + "','" + fecha + "');";

            miBD.Insert(sentencia);
            this.id               = (int)miBD.SelectScalar("SELECT MAX(id) FROM Debate");
            this.creadorDebate    = creador;
            this.asuntoDebate     = asunto;
            this.mensajeDebate    = mensaje;
            this.fechaPublicacion = fecha;
        }
示例#5
0
        public MaterialCurso(string enlace, Curso curso, String nombre)
        {
            //Insert
            SQLSERVERDB miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      sentencia = "INSERT INTO MaterialCurso VALUES (" + curso.CursoID + ", '" + nombre + "' ,'" + enlace + "');";

            miBD.Insert(sentencia);


            this.enlace  = enlace;
            this.idCurso = curso.CursoID;
            this.nombre  = nombre;
        }
示例#6
0
        public Rol(string name, string des, bool adm)
        {
            SQLSERVERDB miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      sentencia = "INSERT INTO Rol VALUES("
                                    + "'" + name + "',"
                                    + "'" + des + "',"
                                    + (adm ? 1 : 0) + ");";

            miBD.Insert(sentencia);
            rolName = name;
            rolDes  = des;
            admin   = adm;
        }
示例#7
0
        //Insert
        public Mensaje(string emisor, string receptor, int idMensaje, string asunto, string cuerpo, string fecha)
        {
            SQLSERVERDB miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      sentencia = "INSERT INTO Mensaje VALUES('" + emisor + "','" + receptor + "'," + idMensaje + ",'" + asunto + "','" + cuerpo + "','" + fecha + "');";

            miBD.Insert(sentencia);
            this.emisor    = emisor;
            this.receptor  = receptor;
            this.idMensaje = idMensaje;
            this.asunto    = asunto;
            this.cuerpo    = cuerpo;
            this.fecha     = fecha;
        }
示例#8
0
        public Respuesta(Debate debate, Usuario creador, string mensaje, string fecha)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            string sentencia = "INSERT INTO Respuesta VALUES (" + 0 + "," + debate.ID + ",'" + creador.CorreoUsuario + "','" + mensaje + "','" + fecha + "');";

            miBD.Insert(sentencia);

            this.idRespuesta = (int)miBD.SelectScalar("SELECT MAX(idRespuesta) FROM Respuesta;");;
            this.debate      = debate;
            this.mensaje     = mensaje;
            this.creador     = creador;
            this.fecha       = fecha;
        }
        public PruebaConocimiento(string p1, string p2, string p3, string p4, string p5, int idCursoPrueba)
        {
            SQLSERVERDB miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      sentencia = "INSERT INTO PruebaConocimiento VALUES('" + p1 + "','" + p2 + "','" + p3 + "','" + p4 + "','" + p5 + "'," + idCursoPrueba + ");";

            miBD.Insert(sentencia);

            this.p1            = p1;
            this.p2            = p2;
            this.p3            = p3;
            this.p4            = p4;
            this.p5            = p5;
            this.idCursoPrueba = idCursoPrueba;
        }
        public RespuestaPruebaConocimiento(string correo, int id, string rp1, string rp2, string rp3, string rp4, string rp5)
        {
            SQLSERVERDB miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      sentencia = "INSERT INTO RespuestaPrueba VALUES ('" + correo + "'," + id + ", '" + rp1 + "','" + rp2 + "','" + rp3 + "','" + rp4 + "','" + rp5 + "');";

            miBD.Insert(sentencia);
            this.correoUsuario      = correo;
            this.idPrueba           = id;
            this.respuestaPregunta1 = rp1;
            this.respuestaPregunta2 = rp2;
            this.respuestaPregunta3 = rp3;
            this.respuestaPregunta4 = rp4;
            this.respuestaPregunta5 = rp5;
        }
示例#11
0
        public ValoracionCurso(Usuario usuario, Curso curso, int satisfaccion, int lugar, int horario, int organizacion, bool repetir, string comentario)
        {
            SQLSERVERDB miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      sentencia = "INSERT INTO ValoracionCurso VALUES ('" + usuario.CorreoUsuario + "'," + curso.CursoID + "," + satisfaccion + "," + lugar + "," + horario + "," + organizacion + "," + (repetir == true ? 1 : 0) + ",'" + comentario + "');";

            miBD.Insert(sentencia);
            this.user         = usuario;
            this.curso        = curso;
            this.satisfaccion = satisfaccion;
            this.lugar        = lugar;
            this.horario      = horario;
            this.organizacion = organizacion;
            this.repetir      = repetir;
            this.comentario   = comentario;
        }
示例#12
0
        public ValoracionActividad(Usuario user, Actividad act, int s, int l, int h, int o, bool r, String c)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            string sentencia = "INSERT INTO ValoracionActividad VALUES ('" + user.CorreoUsuario + "'," + act.IdActividad + "," + s + "," + l + "," + h + "," + o + "," + (r == true ? 1 : 0) + ",'" + c + "');";

            miBD.Insert(sentencia);
            this.user         = user;
            this.actividad    = act;
            this.satisfaccion = s;
            this.lugar        = l;
            this.horario      = h;
            this.organizacion = o;
            this.repetir      = r;
            this.comentario   = c;
        }
示例#13
0
        public Actividad(Usuario user, string nombreAct, string descrAct, string fIniAct, string fFinAct, string hIniAct, string hFinAct, string lugarAct, int aforoPermitido)
        {
            SQLSERVERDB miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      sentencia = "INSERT INTO Actividad VALUES (" + 0 + ",'" + user.CorreoUsuario + "','" + nombreAct + "','" + descrAct + "','" + fIniAct
                                    + "','" + fFinAct + "','" + hIniAct + "','" + hFinAct + "','" + lugarAct + "'," + aforoPermitido + ");";

            miBD.Insert(sentencia);
            this.idActividad          = (int)miBD.SelectScalar("SELECT MAX(idActividad) FROM Actividad;");
            this.usuarioCreador       = user;
            this.nombreActividad      = nombreAct;
            this.descripcionActividad = descrAct;
            this.fechaInicioActividad = fIniAct;
            this.fechaFinActividad    = fFinAct;
            this.horaInicioActividad  = hIniAct;
            this.horaFinActividad     = hFinAct;
            this.lugarActividad       = lugarAct;
            this.aforoActividad       = aforoPermitido;
        }
示例#14
0
        public ActividadesRealizadas(int numeroActividad, string email)
        { //Constructor del select
            SQLSERVERDB     miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string          sentencia = "SELECT * FROM ActividadesRealizadas WHERE idActividad = " + numeroActividad + " AND correo = '" + email + "';";
            List <object[]> lista     = miBD.Select(sentencia);

            if (lista.Count > 0)
            {
                object[] tupla = lista[0];
                this.idActividad = (int)tupla[0];
                this.correo      = (string)tupla[1];
            }
            else
            {
                sentencia = "INSERT INTO ActividadesRealizadas VALUES (" + numeroActividad + ", '" + email + "');";
                miBD.Insert(sentencia);
                this.idActividad = numeroActividad;
                correo           = email;
            }
        }
示例#15
0
        public Curso(Usuario profesorCurso, string nombreCurso, string descripcionCurso, string fechaInicioCurso
                     , string fechaFinCurso, string horaInicioCurso, string horaFinCurso, string lugarCurso, int aforoCurso, bool online)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            string sentencia = "INSERT INTO Curso VALUES (" + 0 + ",'" + profesorCurso.CorreoUsuario + "','" + nombreCurso + "','" + descripcionCurso + "','"
                               + fechaInicioCurso + "','" + fechaFinCurso + "','" + horaInicioCurso + "','" + horaFinCurso + "','" + lugarCurso + "'," + aforoCurso + "," + (online ? 1 : 0) + ");";

            miBD.Insert(sentencia);
            this.idCurso          = (int)miBD.SelectScalar("SELECT MAX(idCurso) FROM Curso;");
            this.profesorCurso    = profesorCurso;
            this.nombreCurso      = nombreCurso;
            this.descripcionCurso = descripcionCurso;
            this.fechaInicioCurso = fechaInicioCurso;
            this.fechaFinCurso    = fechaFinCurso;
            this.horaInicioCurso  = horaInicioCurso;
            this.horaFinCurso     = horaFinCurso;
            this.lugarCurso       = lugarCurso;
            this.aforoCurso       = aforoCurso;
            this.online           = online;
        }
示例#16
0
        public CursosRealizados(int numeroCurso, string email)
        {
            SQLSERVERDB     miBD      = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string          sentencia = "SELECT * FROM CursosRealizados WHERE idCurso = " + numeroCurso + " AND correo = '" + email + "';";
            List <object[]> lista     = miBD.Select(sentencia);


            if (lista.Count > 0)
            {
                object[] tupla = lista[0];
                this.idCurso = (int)tupla[0];
                this.correo  = (string)tupla[1];
            }
            else
            {
                Console.WriteLine("hola2");
                sentencia = "INSERT INTO CursosRealizados VALUES (" + numeroCurso + ", '" + email + "');";
                miBD.Insert(sentencia);
                this.idCurso = numeroCurso;
                correo       = email;
            }
        }