Beispiel #1
0
        public DTO.Evento GetEventoById(int idEvento)
        {
            using (var db = new SemanaTecnologiaEntities())
            {

                return db.Evento
                    .Where(c => c.PK_EVENT == idEvento)
                    .Select(c => new DTO.Evento() {

                       DATE = c.DATE,
                       DESCRIPTION = c.DESCRIPTION,
                       END_TIME = c.END_TIME,
                       FK_PALESTRANTE = c.FK_PALESTRANTE,
                       HOUR = c.HOUR,
                       LOCATION = c.LOCATION,
                       NAME = c.NAME,
                       NSLOTS = c.NSLOTS,
                       PK_EVENT = c.PK_EVENT,
                       START_TIME = c.START_TIME,
                       TYPE = c.TYPE

                }).FirstOrDefault();

            }
        }
        public DTO.Palestrante CreateNewPalestrante(DTO.Palestrante palestrante)
        {
            using (var db = new SemanaTecnologiaEntities())
            {
                var PalestranteRow = db.Palestrante.Create();

                PalestranteRow.NAME = palestrante.NAME;

                PalestranteRow.EMAIL = palestrante.EMAIL;

                PalestranteRow.CV = palestrante.CV;

                PalestranteRow.CITY = palestrante.CITY;

                PalestranteRow.TEL = palestrante.TEL;

                PalestranteRow.TITRATION = palestrante.TITRATION;

                db.Palestrante.Add(PalestranteRow);

                db.SaveChanges();

                palestrante.PK_PALESTRANTE = PalestranteRow.PK_PALESTRANTE;

                return palestrante;

            }
        }
        public DTO.Participante CreateNewParticipante(DTO.Participante participante)
        {
            using (var db = new SemanaTecnologiaEntities())
            {

                var ParticipanteROW = db.Participante.Create();

                ParticipanteROW.PK_PARTICIPANTE = participante.PK_PARTICIPANTE;

                ParticipanteROW.COURSE = participante.COURSE;

                ParticipanteROW.EMAIL = participante.EMAIL;

                ParticipanteROW.LOGIN = participante.LOGIN;

                ParticipanteROW.NAME = participante.NAME;

                ParticipanteROW.PASSWORD = participante.PASSWORD;

                ParticipanteROW.PERIOD = participante.PERIOD;

                ParticipanteROW.PROFILE = participante.PROFILE;

                ParticipanteROW.TEL = participante.TEL;

                db.Participante.Add(ParticipanteROW);

                db.SaveChanges();

                return participante;

            }
        }
        public List<DTO.Insc_Evento> GetAllInscricoesByIdEvento(int idEvento)
        {
            using (var db = new SemanaTecnologiaEntities())
            {
                return db.Insc_Evento
                    .Where(c => c.FK_EVENTO == idEvento)
                    .Select(c => new DTO.Insc_Evento {

                FK_INSCRICAO = c.FK_INSCRICAO

                }).ToList();

            }
        }
        public DTO.Inscricao GetIdParticipantes(int idInscricao)
        {
            using (var db = new SemanaTecnologiaEntities())
            {
                return db.Inscricao
                    .Where(c => c.PK_INSCRICAO == idInscricao)
                    .Select(c => new DTO.Inscricao {

                    CPF = c.CPF,
                    DATE = c.DATE,
                    PK_INSCRICAO = c.PK_INSCRICAO

                }).FirstOrDefault();
            }
        }
        public List<DTO.Inscricao> GetIncricoesByParticipantes(string idAluno)
        {
            using (var db = new SemanaTecnologiaEntities())
            {

                return db.Inscricao
                    .Where(c => c.CPF == idAluno)
                    .Select(c => new DTO.Inscricao {

                        CPF = c.CPF,
                        DATE = c.DATE,
                        PK_INSCRICAO = c.PK_INSCRICAO

                }).ToList();

            }
        }
        public DTO.Insc_Evento GetCodEventoById(int idInscricao)
        {
            using (var db = new SemanaTecnologiaEntities())
            {

                return db.Insc_Evento
                    .Where(c => c.FK_INSCRICAO == idInscricao)
                    .Select(c => new DTO.Insc_Evento {

                        FK_EVENTO = c.FK_EVENTO,
                        FK_INSCRICAO = c.FK_INSCRICAO,
                        FK_INSC_EVENTO = c.PK_INSC_EVENTO

                    }).FirstOrDefault();

            }
        }
        public DTO.Palestrante GetPalestranteById(int idPalestrante)
        {
            using (var db = new SemanaTecnologiaEntities())
            {
                return db.Palestrante
                    .Where(c => c.PK_PALESTRANTE == idPalestrante)
                    .Select(c => new DTO.Palestrante() {

                        CITY = c.CITY,
                        CV = c.CV,
                        EMAIL = c.EMAIL,
                        NAME = c.NAME,
                        PK_PALESTRANTE = c.PK_PALESTRANTE,
                        TITRATION = c.TITRATION,
                        TEL = c.TEL

                }).FirstOrDefault();
            }
        }
        public DTO.Insc_Evento CreateNewInscEvento(DTO.Insc_Evento insc_Evento)
        {
            using (var db = new SemanaTecnologiaEntities())
            {
                var Insc_EventoRow = db.Insc_Evento.Create();

                Insc_EventoRow.FK_EVENTO = insc_Evento.FK_EVENTO;

                Insc_EventoRow.FK_INSCRICAO = insc_Evento.FK_INSCRICAO;

                db.Insc_Evento.Add(Insc_EventoRow);

                db.SaveChanges();

                insc_Evento.FK_INSC_EVENTO = Insc_EventoRow.PK_INSC_EVENTO;

                return insc_Evento;
            }
        }
        public List<DTO.Palestrante> GetAllPalestrantes()
        {
            using (var db = new SemanaTecnologiaEntities())
            {

                return db.Palestrante
                 .Select(c => new DTO.Palestrante()
                 {
                     CITY = c.CITY,
                     CV = c.CV,
                     EMAIL = c.EMAIL,
                     NAME = c.NAME,
                     TEL = c.TEL,
                     PK_PALESTRANTE = c.PK_PALESTRANTE,
                     TITRATION = c.TITRATION
                 })
                  .ToList();

            }
        }
        public DTO.Inscricao CreateNewInscricao(DTO.Inscricao inscricao)
        {
            using (var db = new SemanaTecnologiaEntities())
            {

                var InscricaoROW = db.Inscricao.Create();

                InscricaoROW.CPF = inscricao.CPF;

                InscricaoROW.DATE = inscricao.DATE;

                db.Inscricao.Add(InscricaoROW);

                db.SaveChanges();

                inscricao.PK_INSCRICAO = InscricaoROW.PK_INSCRICAO;

                return inscricao;

            }
        }
        public List<DTO.Participante> GetAllPArticipantes()
        {
            using (var db = new SemanaTecnologiaEntities())
            {
                return db.Participante
              .Select(c => new DTO.Participante() {

                  COURSE = c.COURSE,
                  EMAIL = c.EMAIL,
                  LOGIN = c.LOGIN,
                  NAME = c.NAME,
                  PASSWORD = c.PASSWORD,
                  PERIOD = c.PERIOD,
                  PK_PARTICIPANTE = c.PK_PARTICIPANTE,
                  PROFILE = c.PROFILE,
                  TEL = c.TEL

              })
              .ToList();
            }
        }
        public DTO.Participante GetParticipante(string idParticipante)
        {
            using (var db = new SemanaTecnologiaEntities())
            {
                return db.Participante
                    .Where(c => c.PK_PARTICIPANTE == idParticipante)
                    .Select(c => new DTO.Participante {

                    COURSE = c.COURSE,
                    EMAIL = c.EMAIL,
                    NAME = c.NAME,
                    LOGIN = c.LOGIN,
                    PASSWORD = c.PASSWORD,
                    PERIOD = c.PERIOD,
                    PK_PARTICIPANTE = c.PK_PARTICIPANTE,
                    PROFILE = c.PROFILE,
                    TEL=c.TEL

                }).FirstOrDefault();

            }
        }
Beispiel #14
0
        public List<DTO.Evento> GetAllEventos()
        {
            using (var db = new SemanaTecnologiaEntities())
            {
                return db.Evento
                    .Select(c => new DTO.Evento() {

                        DATE = c.DATE,
                        DESCRIPTION = c.DESCRIPTION,
                        END_TIME = c.END_TIME,
                        FK_PALESTRANTE = c.FK_PALESTRANTE,
                        HOUR = c.HOUR,
                        LOCATION = c.LOCATION,
                        NAME = c.NAME,
                        NSLOTS = c.NSLOTS,
                        PK_EVENT = c.PK_EVENT,
                        START_TIME = c.START_TIME,
                        TYPE = c.START_TIME

                    })
                    .ToList();
            }
        }
Beispiel #15
0
        public DTO.Evento CreateNewEvento(DTO.Evento evento)
        {
            using (var db = new SemanaTecnologiaEntities())
            {

                var EventoRow = db.Evento.Create();

                EventoRow.DATE = evento.DATE;

                EventoRow.DESCRIPTION = evento.DESCRIPTION;

                EventoRow.END_TIME = evento.END_TIME;

                EventoRow.FK_PALESTRANTE = evento.FK_PALESTRANTE;

                EventoRow.HOUR = evento.HOUR;

                EventoRow.LOCATION = evento.LOCATION;

                EventoRow.NAME = evento.NAME;

                EventoRow.NSLOTS = evento.NSLOTS;

                EventoRow.START_TIME = evento.START_TIME;

                EventoRow.TYPE = evento.TYPE;

                db.Evento.Add(EventoRow);

                db.SaveChanges();

                evento.PK_EVENT = EventoRow.PK_EVENT;

                return evento;

            }
        }