Ejemplo n.º 1
0
        public void AddBid(Model.Participant bidder, int confId, int paper, int value)
        {
            List <Model.Paper> papers = repoPaper.GetByConference(confId);

            foreach (Model.Paper p in papers)
            {
                if (p.Id == paper)
                {
                    Model.Paper newP = p;
                    newP.AddBid(bidder, value);
                    repoPaper.Modify(paper, newP);
                }
            }
        }
Ejemplo n.º 2
0
        public void Add(Model.Paper p)
        {
            Paper paper = new Paper();

            paper.Name             = p.Title;
            paper.Resume           = p.Resume;
            paper.Domain           = p.Domain;
            paper.Subdomain        = p.Subdomain;
            paper.Filepath         = p.Filepath;
            paper.EvaluationResult = Enum.GetName(p.Status.GetType(), p.Status);
            paper.IsEmailSent      = false;
            paper.ConferenceId     = p.ConferenceId;
            paper.UserId           = p.Uploader.IdUser;
            //paper.TopicId get topic by name and conf
            foreach (Topic topic in _context.Topics)
            {
                if (topic.TopicName == p.Topic && topic.ConferenceId == p.ConferenceId)
                {
                    paper.TopicId = topic.TopicId;
                    break;
                }
            }

            _context.Papers.Add(paper);
            _context.SaveChanges();

            foreach (Author author in p.AdditionalAuthors)
            {
                if (_context.AdditionalAuthors.Find(author.IdAuthor) == null)
                {
                    AdditionalAuthor aa = new AdditionalAuthor();
                    aa.Affiliation = author.Affiliation;
                    aa.Name        = author.Name;
                    aa.PaperId     = paper.PaperId;
                    _context.AdditionalAuthors.Add(aa);
                }
            }

            _context.SaveChanges();
        }
Ejemplo n.º 3
0
 public void NewPaper(Model.Conference c, Model.Paper p)
 {
     Console.WriteLine("futai");
 }
Ejemplo n.º 4
0
 public void UpdatePaper(Model.Paper p)
 {
     //updateaza o lucrare, eventual notifica
     throw new NotImplementedException();
 }
Ejemplo n.º 5
0
        public List <Model.Session> GetByConference(int confId)
        {
            List <Model.Session> all = new List <Model.Session>();


            foreach (var s in _context.getSessionsForConference(confId))
            {
                List <Model.Reservation> reservations = new List <Model.Reservation>();

                foreach (var p in _context.getPapersSession(s.SessionId))
                {
                    User        u     = _context.Users.Find(p.UserId);
                    Model.User  user  = new Model.User(u.UserId, u.Username, u.Password, u.Name, u.Affilliation, u.Email, u.canBePCMember, u.WebPage);
                    Model.Paper paper = new Model.Paper(p.PaperId, confId, user, p.Name, p.Filepath, p.Domain, p.Subdomain, p.Resume, p.TopicName);

                    List <Author> authors = new List <Author>();

                    foreach (var a in _context.getAdditionalAuthors(p.PaperId))
                    {
                        Author au = new Author(0, a.Name, a.Affiliation);
                        authors.Add(au);
                    }
                    paper.AdditionalAuthors = authors;

                    foreach (var b in _context.getBidsResult(p.PaperId))
                    {
                        User        use         = _context.Users.Find(b.PCMemberUserId);
                        PCMember    pcm         = _context.PCMembers.Find(b.PCMemberUserId, confId);
                        Model.User  userr       = new Model.User(use.UserId, use.Username, use.Password, use.Name, use.Affilliation, use.Email, use.canBePCMember, use.WebPage);
                        Participant participant = new Participant(userr, confId, pcm.isChair, pcm.isCoChair, true, false);

                        paper.AddBid(participant, b.BiddingEvaluation);
                    }

                    foreach (var r in _context.getReviewsPaper(p.PaperId))
                    {
                        User        use         = _context.Users.Find(r.PCMemberUserId);
                        PCMember    pcm         = _context.PCMembers.Find(r.PCMemberUserId, confId);
                        Model.User  userr       = new Model.User(use.UserId, use.Username, use.Password, use.Name, use.Affilliation, use.Email, use.canBePCMember, use.WebPage);
                        Participant participant = new Participant(userr, confId, pcm.isChair, pcm.isCoChair, true, false);

                        Model.Review rev = new Model.Review(0, participant, (Verdict)r.Evaluation, r.Recommandations);
                        paper.AddReview(rev);
                        paper.AddReviewer(participant);
                    }

                    foreach (var res in _context.getReservationPaper(paper.Id))
                    {
                        string room = "Room: " + res.RoomName + ", Street: " + res.Street + ", City: " + res.City;

                        Reservation rv = new Reservation(0, paper, room, DateTime.Parse(res.Timp.ToString()), res.Duration, DateTime.Parse(res.Data.ToString()));
                        reservations.Add(rv);
                    }
                }

                User        us       = _context.Users.Find(s.SessionChairId);
                PCMember    pc       = _context.PCMembers.Find(s.SessionChairId, confId);
                Model.User  user2    = new Model.User(us.UserId, us.Username, us.Password, us.Name, us.Affilliation, us.Email, us.canBePCMember, us.WebPage);
                Participant sesChair = new Participant(user2, confId, pc.isChair, pc.isCoChair, true, false);

                Model.Session se = new Model.Session(s.SessionId, reservations, sesChair);

                all.Add(se);
            }


            return(all);
        }
Ejemplo n.º 6
0
 public bool addPaper(Model.Paper paper)
 {
     repoPaper.Add(paper);
     return(true);
 }
Ejemplo n.º 7
0
        public List <Model.Paper> GetByConference(int confId)
        {
            List <Model.Paper> all = new List <Model.Paper>();

            foreach (Paper paper in _context.Papers)
            {
                if (paper.ConferenceId == confId)
                {
                    User       u    = _context.Users.Find(paper.UserId);
                    Model.User user = new Model.User(u.UserId, u.Username, u.Password, u.Name, u.Affilliation, u.Email, u.canBePCMember, u.WebPage);

                    Topic t = _context.Topics.Find(paper.TopicId);

                    Model.Paper p = new Model.Paper(paper.PaperId, paper.ConferenceId, user, paper.Name, paper.Filepath, paper.Domain, paper.Subdomain, paper.Resume, t.TopicName);

                    List <Author> authors = new List <Author>();
                    foreach (AdditionalAuthor a in _context.AdditionalAuthors)
                    {
                        if (a.PaperId == paper.PaperId)
                        {
                            Author au = new Author(a.AdditionalAuthorId, a.Name, a.Affiliation);
                            authors.Add(au);
                        }
                    }

                    p.AdditionalAuthors = authors;

                    foreach (Bid b in _context.Bids)
                    {
                        if (b.PaperId == paper.PaperId)
                        {
                            User              us          = _context.Users.Find(b.PCMemberUserId);
                            PCMember          pcm         = _context.PCMembers.Find(b.PCMemberUserId, b.PCMemberConferenceId);
                            Model.User        bidder      = new Model.User(us.UserId, us.Username, us.Password, us.Name, us.Affilliation, us.Email, us.canBePCMember, us.WebPage);
                            Model.Participant participant = new Model.Participant(bidder, b.PCMemberConferenceId, pcm.isChair, pcm.isCoChair, true, false);

                            p.AddBid(participant, b.BiddingEvaluation);
                        }
                    }

                    foreach (var r in _context.getReviewsPaper(paper.PaperId))
                    {
                        User              us          = _context.Users.Find(r.PCMemberUserId);
                        PCMember          pcm         = _context.PCMembers.Find(r.PCMemberUserId, paper.ConferenceId);
                        Model.User        reviewer    = new Model.User(us.UserId, us.Username, us.Password, us.Name, us.Affilliation, us.Email, us.canBePCMember, us.WebPage);
                        Model.Participant participant = new Model.Participant(reviewer, paper.ConferenceId, pcm.isChair, pcm.isCoChair, true, false);

                        Model.Review review;

                        if (r.Evaluation != null)
                        {
                            Verdict v = (Verdict)r.Evaluation;
                            review = new Model.Review(0, participant, v, r.Recommandations);
                            p.AddReview(review);
                        }

                        p.AddReviewer(participant);
                    }

                    all.Add(p);
                }
            }

            return(all);
        }
Ejemplo n.º 8
0
        public void Modify(int paperId, Model.Paper newP)
        {
            Paper paper = _context.Papers.Find(paperId);

            if (paper == null)
            {
                return;
            }
            paper.Name             = newP.Title;
            paper.Resume           = newP.Resume;
            paper.Domain           = newP.Domain;
            paper.Subdomain        = newP.Subdomain;
            paper.Filepath         = newP.Filepath;
            paper.EvaluationResult = Enum.GetName(newP.Status.GetType(), newP.Status);
            paper.IsEmailSent      = false;
            paper.ConferenceId     = newP.ConferenceId;
            paper.UserId           = newP.Uploader.IdUser;

            foreach (Author author in newP.AdditionalAuthors)
            {
                if (_context.AdditionalAuthors.Find(author.IdAuthor) == null)
                {
                    AdditionalAuthor aa = new AdditionalAuthor();
                    aa.Affiliation = author.Affiliation;
                    aa.Name        = author.Name;
                    aa.PaperId     = paperId;
                    _context.AdditionalAuthors.Add(aa);
                }
            }

            foreach (KeyValuePair <Participant, int> bid in newP.Bids)
            {
                //get bid by lucrare, participant add daca nu exista, modify daca exista
                bool exists = false;
                foreach (Bid b in _context.Bids)
                {
                    if (b.PaperId == paperId && b.PCMemberUserId == bid.Key.User.IdUser)
                    {
                        b.BiddingEvaluation = bid.Value;
                        exists = true;
                        break;
                    }
                }
                if (!exists)
                {
                    Bid b = new Bid();
                    b.BiddingEvaluation    = bid.Value;
                    b.PCMemberUserId       = bid.Key.User.IdUser;
                    b.PaperId              = paperId;
                    b.PCMemberConferenceId = newP.ConferenceId;

                    _context.Bids.Add(b);
                }
            }

            foreach (Model.Review review in newP.Reviews)
            {
                //daca nu exista review adauga nou, altfel modifica
                Review r = _context.Reviews.Find(review.Reviewer.User.IdUser, newP.ConferenceId, newP.Id);
                if (r == null)
                {
                    Review rev = new Review();
                    rev.PCMemberUserId       = review.Reviewer.User.IdUser;
                    rev.PCMemberConferenceId = review.Reviewer.ConferenceId;
                    rev.PaperId         = paperId;
                    rev.Evaluation      = (int)review.Verdict;
                    rev.Recommandations = review.Comments;

                    _context.Reviews.Add(rev);
                }
                else
                {
                    r.Evaluation      = (int)review.Verdict;
                    r.Recommandations = review.Comments;
                }
            }

            _context.SaveChanges();
        }
Ejemplo n.º 9
0
 public override string ToString()
 {
     return(User.ToString() + " " + BID.ToString() + " " + Paper.ToString());
 }
Ejemplo n.º 10
0
 public Bid(User usr, BidEnum bid, Paper paper)
 {
     this.User  = usr;
     this.BID   = bid;
     this.Paper = paper;
 }