public PollReportViewModel(int pollID, String name, IList<Question> questions, IDictionary<Question, IDictionary<String, int>> responses, ParticipantField field, bool include, String[] tick)
 {
     var pollRepository = new PollRepository(NHibernateHelper.GetCurrentSession());
     this.pollID = pollID;
     this.name = name;
     this.poll = pollRepository.GetPollByID(pollID);
     this.field = field;
     this.include = include;
     this.tick = tick;
     this.questions = questions;
     this.responses = responses;
     this.poll = pollRepository.GetPollByID(pollID);
     this.selectedEntities = new List<Entity>();
 }
 public void AddGroup(int pollID, String name)
 {
     var pollRepository = new PollRepository(session);
     ParticipantGroup group = new ParticipantGroup(name);
     pollRepository.GetPollByID(pollID).groups.Add(group);
     session.SaveOrUpdate(group);
 }
 public PollReportViewModel(int pollID, String name, IList<Participant> participants)
 {
     var pollRepository = new PollRepository(NHibernateHelper.GetCurrentSession());
     this.pollID = pollID;
     this.name = name;
     this.participants = participants;
     this.include = true;
     this.poll = pollRepository.GetPollByID(pollID);
     this.selectedEntities = new List<Entity>();
 }
 public IList<Entity> GetEndEntities(int pollID)
 {
     var pollRepository = new PollRepository(session);
     var all = pollRepository.GetPollByID(pollID).entities;
     var entities = (from item1 in all from item2 in all
                     where item2.parent!=null && item1.entityID == item2.parent.entityID
                     select item1);
     var answer = (from item in all where !(entities.Contains(item)) select item);
     return answer.ToList<Entity>();
 }
 public PollReportViewModel(int pollID, String name, IList<Question> questions, IDictionary<Question, IDictionary<String, int>> responses)
 {
     var pollRepository = new PollRepository(NHibernateHelper.GetCurrentSession());
     this.pollID = pollID;
     this.name = name;
     this.questions = questions;
     this.responses = responses;
     this.poll = pollRepository.GetPollByID(pollID);
     this.include = true;
     this.selectedEntities = new List<Entity>();
 }
 public PollReportViewModel(int pollID, String name)
 {
     var pollRepository = new PollRepository(NHibernateHelper.GetCurrentSession());
     this.pollID = pollID;
     this.name = name;
     this.poll = pollRepository.GetPollByID(pollID);
     this.include = true;
     uri = "../../resources/MyFirstPDF" + Helpers.CodeFile1.FILE + ".pdf";
     this.field = new ParticipantField();
     this.selectedEntities = new List<Entity>();
 }
 public IList<int[]> GetAllQuestionResults(int pollID)
 {
     var pollRepository = new PollRepository(session);
     var poll = pollRepository.GetPollByID(pollID);
     var questions = poll.questions.Where(m => m.deletionTime == null);
     List<int[]> questionResults = new List<int[]>();
     foreach (var question in questions)
     {
         questionResults.Add(GetQuestionResults(question.questionID));
     }
     return questionResults;
 }
        public String[] GetNextGridResponses(int pollID)
        {
            var pollRepository = new PollRepository(session);
            var poll = pollRepository.GetPollByID(pollID);
            var keypads = from item in poll.gridResponses
                          select item.DeviceID;
            var responses = new List<String>();
            responses.AddRange(keypads);
            poll.gridResponses = null;
            pollRepository.UpdatePoll(poll);

            return responses.ToArray<String>();
        }
 public DetailsViewModel(int participantID, int pollID)
 {
     var pollRepository = new PollRepository(NHibernateHelper.GetCurrentSession());
     var participantRepository = new ParticipantRepository(NHibernateHelper.GetCurrentSession());
     this.poll = pollRepository.GetPollByID(pollID);
     Dictionary<Participant, Dictionary<String, String>> groupies = new Dictionary<Participant, Dictionary<String, String>>();
     if (poll.isGroup)
     {
         foreach (Participant participant in participantRepository.GetParticipantsOfGroup(participantRepository.GetGroupByGroupID(participantID), poll))
             groupies.Add(participant,participantRepository.GetParticipantDetailsByParticipantID(participant.participantID,pollID));
         participants = groupies;
         this.group = participantRepository.GetGroupByGroupID(participantID);
     }
     else this.fieldValues = participantRepository.GetParticipantDetailsByParticipantID(participantID,pollID);
 }
 public NewParticipantViewModel(Boolean success,int pollID)
 {
     var pollRepository = new PollRepository(NHibernateHelper.GetCurrentSession());
     this.success = success;
     this.poll = pollRepository.GetPollByID(pollID);
 }
 public void DeleteGroup(int groupID, int pollID)
 {
     var pollRepository = new PollRepository(session);
     ParticipantGroup group = GetGroupByGroupID(groupID);
     foreach (Participant participant in pollRepository.GetPollByID(pollID).participants)
         if (participant.group == group) participant.group = null;
     session.Delete(group);
 }