public ParticipantFieldViewModel(Poll poll)
 {
     var participantRepository = new ParticipantRepository(NHibernateHelper.GetCurrentSession());
     var fieldsTemplateRepository = new FieldsTemplateRepository(NHibernateHelper.GetCurrentSession());
     this.poll = poll;
     if (poll.isGroup == false)
         this.fieldValues = participantRepository.GetParticipantValuesByPollID(poll.pollID).OrderBy(first=>first["Device ID"])
             .OrderBy(first => first["First Name"]).OrderBy(first => first["Last Name"]).ToList();
     else
     {
         this.fieldValues = participantRepository.GetGroupValuesByPollID(poll.pollID).OrderBy(first => first["Name"]).ToList();
         hasdem = new List<bool>();
         hascom = new List<bool>();
         foreach (ParticipantField f in poll.participantFields)
         {
             hasdem.Add(poll.questions.Where
                 (q => q.type == QuestionType.Demographic)
                 .Cast<DemographicQuestion>().Any(p => p.linkedField != null
                     && p.linkedField.fieldID == f.fieldID));
             hascom.Add(poll.questions.Where(q => q.type == QuestionType.Demographic)
                 .Cast<DemographicQuestion>().Any(p => p.linkedField != null
                     && p.linkedField.fieldID == f.fieldID && p.compareWith != null));
         }
     }
     entities = getChildEntites();
     this.selectedTemplateID = -1;
     this.templates = fieldsTemplateRepository.GetFieldsTemplates();
     this.hasdems = poll.questions.Where
             (q => q.type == QuestionType.Demographic)
             .Cast<DemographicQuestion>().Any(p => p.linkedField != null);
     this.hasCompare = poll.questions.Where
             (q => q.type == QuestionType.Demographic)
             .Cast<DemographicQuestion>().Any(p => p.linkedField != null && p.compareWith != null);
 }
 public ParticipantFieldViewModel(Poll poll, ParticipantGroup group)
 {
     var fieldsTemplateRepository = new FieldsTemplateRepository(NHibernateHelper.GetCurrentSession());
     this.poll = poll;
     IList<Participant> part = new List<Participant>();
     part = poll.participants.Where(participant => participant.group != group).ToList<Participant>();
     this.participants=part;
     this.group = group;
     entities = getChildEntites();
     this.selectedTemplateID = -1;
     this.templates = fieldsTemplateRepository.GetFieldsTemplates();
 }
 public ApplicationController(ISession session)
 {
     this.session = session;
     this.transaction = session.BeginTransaction();
     this.clientCodeRepository = new ClientCodeRepository(session);
     this.entityRepository = new EntityRepository(session);
     this.fieldsTemplateRepository = new FieldsTemplateRepository(session);
     this.messageRepository = new MessageRepository(session);
     this.participantRepository = new ParticipantRepository(session);
     this.pollRepository = new PollRepository(session);
     this.questionRepository = new QuestionRepository(session);
     this.reportRepository = new ReportRepository(session);
     this.responseRepository = new ResponseRepository(session);
     this.roleRepository = new RoleRepository(session);
     this.templateRepository = new TemplateRepository(session);
     this.userRepository = new UserRepository(session);
 }