コード例 #1
0
        public User_Conference convertToPOCOModel(User_ConferenceDTO model)
        {
            User_Conference poco = new User_Conference();

            poco.Id           = model.Id;
            poco.ConferenceId = model.ConferenceId;
            poco.UserId       = model.UserId;
            poco.Role         = (UserRole)Enum.Parse(typeof(UserRole), model.Role, true);

            return(poco);
        }
コード例 #2
0
        public void TestUserConference()
        {
            Conference c = new Conference
            {
                Id                = 123,
                Name              = "conf",
                Edition           = 1,
                StartDate         = new DateTime(2017, 10, 25),
                EndDate           = new DateTime(2017, 10, 27),
                Domain            = "domeniu",
                AbstractDeadline  = new DateTime(2017, 10, 01),
                FullPaperDeadline = new DateTime(2017, 10, 05),
                MainDescription   = "descriere",
                Price             = 25,
                State             = ConferenceState.Accepted
            };

            User user = new User
            {
                Id        = 20,
                Username  = "******",
                Password  = "******",
                FirstName = "ion",
                LastName  = "last",
                Email     = "*****@*****.**",
                WebPage   = "page.ro",
                Admin     = false
            };

            User_Conference userConf = new User_Conference
            {
                Id           = 1,
                Role         = UserRole.Listener,
                ConferenceId = 123,
                UserId       = 20
            };

            int      expectedId       = 1;
            UserRole userRoleExpected = UserRole.Listener;
            int      confIdExpected   = 123;
            int      userIdExpected   = 20;

            int      actualIdUC   = userConf.Id;
            UserRole actualRole   = userConf.Role;
            int      actualConfId = userConf.ConferenceId;
            int      actualUserID = userConf.UserId;

            Assert.AreEqual(expectedId, actualIdUC);
            Assert.AreEqual(userRoleExpected, actualRole);
            Assert.AreEqual(confIdExpected, actualConfId);
            Assert.AreEqual(userIdExpected, actualUserID);
        }
コード例 #3
0
        public User_ConferenceDTO buyTicket(int idU, int idC)
        {
            using (var uow = new UnitOfWork())
            {
                var repo = uow.getRepository <User_Conference>();
                repo.save(new User_Conference {
                    UserId = idU, ConferenceId = idC
                });
                uow.saveChanges();
                var                item         = repo.getAll().Where(x => x.ConferenceId == idC && x.UserId == idU);
                User_Conference    existingItem = item.ElementAt(0);
                User_ConferenceDTO newitem      = new User_ConferenceDTO();
                newitem.Id           = existingItem.Id;
                newitem.Role         = existingItem.Role.ToString();
                newitem.UserId       = existingItem.UserId;
                newitem.ConferenceId = existingItem.ConferenceId;

                return(newitem);
            }
        }
コード例 #4
0
        public User_ConferenceDTO BuyTicket(int idUser, int idConference)
        {
            using (var uow = new UnitOfWork())
            {
                var userConferenceRepository = uow.getRepository <User_Conference>();
                var existing = userConferenceRepository.getAll().FirstOrDefault(uc => uc.ConferenceId == idConference &&
                                                                                uc.UserId == idUser);
                if (existing != null)
                {
                    return(null);
                }
                var userConference = new User_Conference()
                {
                    ConferenceId = idConference,
                    UserId       = idUser,
                    Role         = UserRole.Listener
                };
                var userConferenceReturned = userConferenceRepository.save(userConference);
                uow.saveChanges();

                return(_converter.convertToDTOModel(userConferenceReturned));
            }
        }
コード例 #5
0
        public ConferenceDTO AddConference(int idUser, ConferenceDTO conferenceDTO)
        {
            using (var uow = new UnitOfWork())
            {
                //adaugare in tabela conferinta
                var conferenceRepo = uow.getRepository <Conference>();
                conferenceDTO.Edition = conferenceRepo.getAll().Count(c => c.Name.Equals(conferenceDTO.Name)) + 1;
                var conference = conferenceRepo.save(converter.convertToPOCOModel(conferenceDTO));
                conferenceDTO.Id = conference.Id;

                //adaugare in tabela de legatuara
                var userConfereceRepo = uow.getRepository <User_Conference>();
                var userConference    = new User_Conference
                {
                    ConferenceId = conferenceDTO.Id,
                    Role         = UserRole.Chair,
                    UserId       = idUser
                };
                userConfereceRepo.save(userConference);
                uow.saveChanges();

                return(conferenceDTO);
            }
        }
コード例 #6
0
        protected override void Seed(DatabaseContext context)
        {
            var users = new User[] {
                new User {
                    Id = 1, Username = "******", Password = "******", FirstName = "Alina", LastName = "Toader", Email = "*****@*****.**", WebPage = "alinatoader.wordpress.com", Admin = true, Validation = AccountState.Validated
                },
                new User {
                    Id = 2, Username = "******", Password = "******", FirstName = "Bogdan", LastName = "Vorobet", Email = "*****@*****.**", WebPage = "bogdanvorobet.wordpress.com", Admin = true, Validation = AccountState.Validated
                },
                new User {
                    Id = 3, Username = "******", Password = "******", FirstName = "Andrea", LastName = "Major", Email = "*****@*****.**", WebPage = "andreamajor.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 4, Username = "******", Password = "******", FirstName = "Oana", LastName = "Jisa", Email = "*****@*****.**", WebPage = "oanajisa.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 5, Username = "******", Password = "******", FirstName = "Claudiu", LastName = "Ursuta", Email = "*****@*****.**", WebPage = "claudiursuta.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 6, Username = "******", Password = "******", FirstName = "Guntter", LastName = "Gotha", Email = "*****@*****.**", WebPage = "gunttergotha.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 7, Username = "******", Password = "******", FirstName = "Ella", LastName = "Cioca", Email = "*****@*****.**", WebPage = "ellacioca.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 8, Username = "******", Password = "******", FirstName = "Raluca", LastName = "Manea", Email = "*****@*****.**", WebPage = "ralucamanea.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 9, Username = "******", Password = "******", FirstName = "Ana", LastName = "Pop", Email = "*****@*****.**", WebPage = "anapop.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 10, Username = "******", Password = "******", FirstName = "Maria", LastName = "Ionescu", Email = "*****@*****.**", WebPage = "mariaionescu.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 11, Username = "******", Password = "******", FirstName = "Elena", LastName = "Popa", Email = "*****@*****.**", WebPage = "elenapopa.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 12, Username = "******", Password = "******", FirstName = "Marta", LastName = "Gurau", Email = "*****@*****.**", WebPage = "martagurau.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 13, Username = "******", Password = "******", FirstName = "Laura", LastName = "Ionescu", Email = "*****@*****.**", WebPage = "lauraionescu.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 14, Username = "******", Password = "******", FirstName = "Alex", LastName = "Pop", Email = "*****@*****.**", WebPage = "alexpop.wordpress.com", Admin = false, Validation = AccountState.Validated
                },
                new User {
                    Id = 9, Username = "******", Password = "******", FirstName = "Ana", LastName = "Pop", Email = "*****@*****.**", WebPage = "anapop.wordpress.com", Admin = false, Validation = AccountState.Waiting
                },
                new User {
                    Id = 10, Username = "******", Password = "******", FirstName = "Maria", LastName = "Ionescu", Email = "*****@*****.**", WebPage = "mariaionescu.wordpress.com", Admin = false, Validation = AccountState.Waiting
                },
                new User {
                    Id = 11, Username = "******", Password = "******", FirstName = "Elena", LastName = "Popa", Email = "*****@*****.**", WebPage = "elenapopa.wordpress.com", Admin = false, Validation = AccountState.Waiting
                },
                new User {
                    Id = 12, Username = "******", Password = "******", FirstName = "Marta", LastName = "Gurau", Email = "*****@*****.**", WebPage = "martagurau.wordpress.com", Admin = false, Validation = AccountState.Waiting
                },
                new User {
                    Id = 13, Username = "******", Password = "******", FirstName = "Laura", LastName = "Ionescu", Email = "*****@*****.**", WebPage = "lauraionescu.wordpress.com", Admin = false, Validation = AccountState.Waiting
                },
                new User {
                    Id = 14, Username = "******", Password = "******", FirstName = "Alex", LastName = "Pop", Email = "*****@*****.**", WebPage = "alexpop.wordpress.com", Admin = false, Validation = AccountState.Waiting
                },
            };

            var conferences = new Conference[]
            {
                new Conference {
                    Id = 1, Name = "Conferinta1", StartDate = new DateTime(2017, 8, 1), EndDate = new DateTime(2017, 12, 5), AbstractDeadline = new DateTime(2017, 7, 1), FullPaperDeadline = new DateTime(2017, 7, 5), Domain = "IT", Price = 550.5f, Edition = 1, MainDescription = "description1", State = ConferenceState.Accepted
                },
                new Conference {
                    Id = 2, Name = "Conferinta2", StartDate = new DateTime(2018, 5, 23), EndDate = new DateTime(2018, 7, 23), AbstractDeadline = new DateTime(2017, 1, 1), FullPaperDeadline = new DateTime(2017, 1, 2), Domain = "Biology", Price = 480.7f, Edition = 1, MainDescription = "description2", State = ConferenceState.Accepted
                },
                new Conference {
                    Id = 3, Name = "Conferinta3", StartDate = new DateTime(2019, 5, 23), EndDate = new DateTime(2019, 7, 23), AbstractDeadline = new DateTime(2019, 1, 1), FullPaperDeadline = new DateTime(2019, 1, 2), Domain = "Astronomy", Price = 480.7f, Edition = 1, MainDescription = "description3", State = ConferenceState.Accepted
                },
                new Conference {
                    Id = 4, Name = "Conferinta4", StartDate = new DateTime(2020, 8, 1), EndDate = new DateTime(2020, 12, 5), AbstractDeadline = new DateTime(2020, 7, 1), FullPaperDeadline = new DateTime(2020, 7, 5), Domain = "IT", Price = 550.5f, Edition = 1, MainDescription = "description14", State = ConferenceState.Accepted
                },
                new Conference {
                    Id = 5, Name = "Conferinta5", StartDate = new DateTime(2021, 5, 23), EndDate = new DateTime(2021, 7, 23), AbstractDeadline = new DateTime(2021, 1, 1), FullPaperDeadline = new DateTime(2021, 1, 2), Domain = "Biology", Price = 480.7f, Edition = 1, MainDescription = "description5", State = ConferenceState.Accepted
                },
                new Conference {
                    Id = 6, Name = "Conferinta6", StartDate = new DateTime(2022, 5, 23), EndDate = new DateTime(2022, 7, 23), AbstractDeadline = new DateTime(2022, 1, 1), FullPaperDeadline = new DateTime(2022, 1, 2), Domain = "Astronomy", Price = 480.7f, Edition = 1, MainDescription = "description6", State = ConferenceState.Accepted
                },
                new Conference {
                    Id = 7, Name = "Conferinta7", StartDate = new DateTime(2023, 8, 1), EndDate = new DateTime(2023, 12, 5), AbstractDeadline = new DateTime(2023, 7, 1), FullPaperDeadline = new DateTime(2023, 7, 5), Domain = "IT", Price = 550.5f, Edition = 1, MainDescription = "description7", State = ConferenceState.Accepted
                },
                new Conference {
                    Id = 8, Name = "Conferinta8", StartDate = new DateTime(2024, 5, 23), EndDate = new DateTime(2024, 7, 23), AbstractDeadline = new DateTime(2024, 1, 1), FullPaperDeadline = new DateTime(2024, 1, 2), Domain = "Biology", Price = 480.7f, Edition = 1, MainDescription = "description8", State = ConferenceState.Accepted
                },
                new Conference {
                    Id = 9, Name = "Conferinta9", StartDate = new DateTime(2025, 5, 23), EndDate = new DateTime(2025, 7, 23), AbstractDeadline = new DateTime(2025, 1, 1), FullPaperDeadline = new DateTime(2025, 1, 2), Domain = "Astronomy", Price = 480.7f, Edition = 1, MainDescription = "description9", State = ConferenceState.Proposed
                },
                new Conference {
                    Id = 10, Name = "Conferinta8", StartDate = new DateTime(2008, 5, 23), EndDate = new DateTime(2008, 7, 23), AbstractDeadline = new DateTime(2008, 1, 1), FullPaperDeadline = new DateTime(2008, 1, 2), Domain = "Biology", Price = 480.7f, Edition = 1, MainDescription = "description8", State = ConferenceState.Accepted
                },
            };

            var participations = new User_Conference[]
            {
                new User_Conference {
                    Id = 1, UserId = 1, ConferenceId = 1, Role = UserRole.Chair
                },
                new User_Conference {
                    Id = 2, UserId = 2, ConferenceId = 1, Role = UserRole.CoChair
                },
                new User_Conference {
                    Id = 3, UserId = 3, ConferenceId = 1, Role = UserRole.CoChair
                },
                new User_Conference {
                    Id = 4, UserId = 4, ConferenceId = 1, Role = UserRole.CoChair
                },
                new User_Conference {
                    Id = 5, UserId = 5, ConferenceId = 1, Role = UserRole.Reviewer
                },
                new User_Conference {
                    Id = 6, UserId = 6, ConferenceId = 1, Role = UserRole.Reviewer
                },
                new User_Conference {
                    Id = 7, UserId = 7, ConferenceId = 1, Role = UserRole.Reviewer
                },
                new User_Conference {
                    Id = 8, UserId = 8, ConferenceId = 1, Role = UserRole.Reviewer
                },
                new User_Conference {
                    Id = 9, UserId = 9, ConferenceId = 1, Role = UserRole.Listener
                },
                new User_Conference {
                    Id = 10, UserId = 10, ConferenceId = 1, Role = UserRole.Listener
                },
                new User_Conference {
                    Id = 11, UserId = 11, ConferenceId = 1, Role = UserRole.Listener
                },
                new User_Conference {
                    Id = 12, UserId = 12, ConferenceId = 1, Role = UserRole.Listener
                },
                new User_Conference {
                    Id = 13, UserId = 13, ConferenceId = 1, Role = UserRole.Listener
                },
                new User_Conference {
                    Id = 14, UserId = 14, ConferenceId = 1, Role = UserRole.Listener
                },

                new User_Conference {
                    Id = 15, UserId = 1, ConferenceId = 2, Role = UserRole.CoChair
                },
                new User_Conference {
                    Id = 16, UserId = 1, ConferenceId = 3, Role = UserRole.CoChair
                },
                new User_Conference {
                    Id = 17, UserId = 1, ConferenceId = 4, Role = UserRole.Reviewer
                },
                new User_Conference {
                    Id = 18, UserId = 1, ConferenceId = 5, Role = UserRole.Listener
                },

                new User_Conference {
                    Id = 19, UserId = 2, ConferenceId = 2, Role = UserRole.Chair
                },
                new User_Conference {
                    Id = 20, UserId = 3, ConferenceId = 3, Role = UserRole.Chair
                },
                new User_Conference {
                    Id = 21, UserId = 4, ConferenceId = 4, Role = UserRole.Chair
                },
                new User_Conference {
                    Id = 22, UserId = 5, ConferenceId = 5, Role = UserRole.Chair
                },
                new User_Conference {
                    Id = 23, UserId = 6, ConferenceId = 6, Role = UserRole.Chair
                },
                new User_Conference {
                    Id = 24, UserId = 7, ConferenceId = 7, Role = UserRole.Chair
                },
                new User_Conference {
                    Id = 25, UserId = 8, ConferenceId = 8, Role = UserRole.Chair
                },
                new User_Conference {
                    Id = 26, UserId = 8, ConferenceId = 9, Role = UserRole.Chair
                },
            };

            var proposals = new Proposal[]
            {
                new Proposal {
                    Id = 1, Title = "Proposal1", Subject = "Subject1", Abstract = "url abstract 1", FullPaper = "url paper 1", Keywords = "k1,k2,k3,k4", ParticipationId = 14, ProposalState = ProposalState.Accepted
                },
                new Proposal {
                    Id = 2, Title = "Proposal2", Subject = "Subject2", Abstract = "url abstract 2", FullPaper = "url paper 2", Keywords = "k5,k6", ParticipationId = 13, ProposalState = ProposalState.Declined
                },
                new Proposal {
                    Id = 3, Title = "Proposal3", Subject = "Subject3", Abstract = "url abstract 3", FullPaper = "url paper 3", Keywords = "k7,k8", ParticipationId = 12, ProposalState = ProposalState.Pending
                },
                new Proposal {
                    Id = 4, Title = "Proposal4", Subject = "Subject4", Abstract = "url abstract 4", FullPaper = "url paper 4", Keywords = "k9,k10,k11,k12", ParticipationId = 11, ProposalState = ProposalState.Pending
                },
                new Proposal {
                    Id = 5, Title = "Proposal5", Subject = "Subject5", Abstract = "url abstract 5", FullPaper = "url paper 5", Keywords = "k9,k10,k11,k12", ParticipationId = 10, ProposalState = ProposalState.Pending
                },
                new Proposal {
                    Id = 6, Title = "Proposal6", Subject = "Subject6", Abstract = "url abstract 6", FullPaper = "url paper 6", Keywords = "k9,k10,k11,k12", ParticipationId = 9, ProposalState = ProposalState.Pending
                },
            };

            var reviews = new Review[]
            {
                new Review {
                    Id = 1, Mark = Mark.BorderlinePaper, ReviewerId = 8, ProposalId = 1, Recommendation = "recomm1"
                },
                new Review {
                    Id = 2, Mark = Mark.Accept, ReviewerId = 7, ProposalId = 1, Recommendation = "recomm2"
                },
                new Review {
                    Id = 3, Mark = Mark.StrongAccept, ReviewerId = 6, ProposalId = 1, Recommendation = "recomm3"
                },
                new Review {
                    Id = 4, Mark = Mark.WeakAccept, ReviewerId = 5, ProposalId = 1, Recommendation = "recomm4"
                },

                new Review {
                    Id = 5, Mark = Mark.Reject, ReviewerId = 5, ProposalId = 2, Recommendation = "recomm5"
                },
                new Review {
                    Id = 6, Mark = Mark.StrongReject, ReviewerId = 6, ProposalId = 2, Recommendation = "recomm6"
                },
            };

            foreach (var p in participations)
            {
                users[0].ConferenceParticipations.Add(p);
            }

            context.Users.AddOrUpdate(users);
            context.Conferences.AddOrUpdate(conferences);
            context.ConferenceParticipations.AddOrUpdate(participations);
            context.Proposals.AddOrUpdate(proposals);
            context.Reviews.AddOrUpdate(reviews);
        }