Example #1
0
        public Actividad(String nombreAct, String descAct, int numPlazas, int numHoras, TurnoE turno,
                         DateTime fechaInicio, DateTime fechaFin, String lugar, Usuario organizador,
                         EstadoActividadE estadoAct, AmbitoTrabajo ambitoTrabajo, TipoTrabajo tipoTrabajo)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            String      ins  = "INSERT INTO Actividades (nombreAct,descripcionAct,numPlazas,numHoras, turno,"
                               + "fechaInicio, fechaFin,lugar,emailOrganizador,estadoAct,idAmbitoTrabajo,idTipoTrabajo) "
                               + "VALUES ('" + nombreAct + "','"
                               + descAct + "'," + numPlazas + "," + numHoras + ",'" + turno.ToString() + "','"
                               + fechaInicio.ToShortDateString() + "','" + fechaFin.ToShortDateString() + "','" + lugar + "','" + organizador.Email + "','"
                               + estadoAct + "'," + ambitoTrabajo.ID_AmbitoTrabajo + "," + tipoTrabajo.ID_TipoTrabajo + ");";

            miBD.Insert(ins);
            this.ID_actividad  = (int)miBD.SelectScalar("SELECT max(ID_Actividad) FROM Actividades;");
            this.nombreAct     = nombreAct;
            this.descAct       = descAct;
            this.numPlazas     = numPlazas;
            this.numHoras      = numHoras;
            this.turno         = turno;
            this.fechaInicio   = fechaInicio;
            this.fechaFin      = fechaFin;
            this.lugar         = lugar;
            this.organizador   = organizador;
            this.estadoAct     = estadoAct;
            this.ambitoTrabajo = ambitoTrabajo;
            this.tipoTrabajo   = tipoTrabajo;
            competencias       = null;
        }
Example #2
0
        public TipoTrabajo(string tipoTrabajo)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      ins  = "INSERT INTO Tipo_Trabajo (tipoTrabajo) VALUES ('" + tipoTrabajo + "');";

            miBD.Insert(ins);
            this.id          = (int)miBD.SelectScalar("SELECT max(ID_TipoTrabajo) FROM Tipo_Trabajo;");
            this.tipoTrabajo = tipoTrabajo;
        }
Example #3
0
        public Grado(String nombreGrado)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            String      ins  = "INSERT INTO Grados VALUES ('" + nombreGrado + "')";

            miBD.Insert(ins);
            ID_grado         = (int)miBD.SelectScalar("SELECT max(ID_Grado) FROM Grados;");
            this.nombreGrado = nombreGrado;
        }
Example #4
0
        public AmbitoTrabajo(string ambitoTrabajo)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            string      ins  = "INSERT INTO Ambito_Trabajo (ambitoTrabajo) VALUES ('" + ambitoTrabajo + "');";

            miBD.Insert(ins);
            this.id            = (int)miBD.SelectScalar("SELECT max(ID_AmbitoTrabajo) FROM Ambito_Trabajo;");
            this.ambitoTrabajo = ambitoTrabajo;
        }
Example #5
0
        public Asignatura(String nA, Grado g)
        {
            // Crea el objeto y lo inserta en la base de datos
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Insert("INSERT INTO Asignaturas VALUES ('" + nA + "'," + g.ID_Grado + ");");
            ID_asig    = (int)miBD.SelectScalar("SELECT max(ID_Asignatura) FROM Asignaturas;");
            nombreAsig = nA;
            grado      = g;
        }
Example #6
0
        public Concejal(string siglas, string nombre)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Insert("INSERT INTO tConcejal VALUES('" + siglas + "', '" + nombre + "');");

            this.id     = (int)miBD.SelectScalar("SELECT MAX(ID) FROM tConcejal;");
            this.siglas = siglas;
            this.nombre = nombre;
        }
Example #7
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;
        }
Example #8
0
        public Proyecto(EstadoProyectoE estadoProy, Usuario resp, String nombreProy)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            String      ins  = "INSERT INTO Proyectos (estadoProy,emailResponsable,nombreProy) "
                               + "VALUES ('" + tipoProy.ToString() + "','" + estadoProy.ToString() + "','" + resp.Email
                               + "','" + nombreProy + "','" + descProy + "');";

            miBD.Insert(ins);

            ID_proyecto      = (int)miBD.SelectScalar("SELECT max(ID_Proyecto) FROM Proyectos;");
            this.estadoProy  = estadoProy;
            this.responsable = resp;
            this.nombreProy  = nombreProy;
            actividades      = new List <Actividad>();
        }
Example #9
0
        public Mensaje(String asunto, String texto, DateTime date, Usuario emisor, Usuario receptor)
        {
            // Crea el objeto y lo inserta en la base de datos
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);

            miBD.Insert("INSERT INTO Mensajes (asunto,texto,fecha,emailEmisor, emailReceptor, borradoEmisor, borradoReceptor, leido) VALUES("
                        + "'" + asunto + "', '" + texto + "', '" + date.ToShortDateString() + "', '" + emisor.Email + "', '" + receptor.Email + "', " + 0 + ", " + 0 + ", " + 0 + ");");
            this.asunto          = asunto;
            this.texto           = texto;
            this.date            = date;
            this.emisor          = emisor;
            this.receptor        = receptor;
            this.borradoEmisor   = false;
            this.borradoReceptor = false;
            this.leido           = false;
            ID_mensaje           = (int)miBD.SelectScalar("SELECT max(ID_Mensaje) FROM Mensajes;");
        }
Example #10
0
        public Competencia(String nombreComp, String descComp)
        {
            SQLSERVERDB miBD = new SQLSERVERDB(BD_SERVER, BD_NAME);
            String      ins;

            if (descComp == null)
            {
                ins = "INSERT INTO Competencias (nombreComp) VALUES ('" + nombreComp + "');";
            }
            else
            {
                ins = "INSERT INTO Competencias VALUES ('" + nombreComp + "','" + descComp + "');";
            }
            miBD.Insert(ins);
            this.idCompetencia = (int)miBD.SelectScalar("SELECT max(idCompetencia) FROM Competencias;");
            this.nombreComp    = nombreComp;
            this.descComp      = descComp;
            preferencias       = null;
            actividades        = null;
        }