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 ParticipantFieldValue(ParticipantGroup groupd, String value)
 {
     this.fieldValueID = -1;
     this.groupd = groupd;
     this.value = value;
     this.participant = 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();
 }
示例#4
0
 public Participant(String deviceID, ParticipantType type, ParticipantGroup group, String firstName, String lastName)
 {
     this.participantID = -1;
     this.deviceID = deviceID;
     this.type = type;
     this.group = group;
     this.linkedUser = null;
     this.attended = false;
     this.firstName = firstName;
     this.lastName = lastName;
     this.isTestParticipant = false;
     this.entity = null;
     this.votingWeight = 1;
 }
 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 EditParticipantViewModel(int participantID, String deviceID, ParticipantGroup group, String firstName, String lastName, IList<ParticipantFieldValueViewModel> fields, Entity entity, int votingWeight)
 {
     this.ParticipantID = participantID;
     this.DeviceID = deviceID;
     if (group == null)
     {
         group = new ParticipantGroup();
     }
     this.Group = group;
     this.FirstName = firstName;
     this.LastName = lastName;
     if (fields == null)
     {
         fields = new List<ParticipantFieldValueViewModel>();
     }
     this.Fields = fields;
     if (entity == null)
     {
         entity = new Entity();
     }
     this.Entity = entity;
     this.VotingWeight = votingWeight;
 }
        public void Populate()
        {
            var session = NHibernateHelper.GetCurrentSession();
            var transaction = session.BeginTransaction();
            using (transaction)
            {
                Membership.CreateUser("Andrew", "facebook", "*****@*****.**");
                Membership.CreateUser("Jared", "facebook", "*****@*****.**");
                Membership.CreateUser("Katrina", "facebook", "*****@*****.**");
                Membership.CreateUser("TienWei", "facebook", "*****@*****.**");
                Membership.CreateUser("Jen", "facebook", "*****@*****.**");
                Membership.CreateUser("Steve", "facebook", "*****@*****.**");
                Membership.CreateUser("Bill", "facebook", "*****@*****.**");
                Membership.CreateUser("Tim", "facebook", "*****@*****.**");
                Membership.CreateUser("Billy", "facebook", "*****@*****.**");
                Membership.CreateUser("Mary", "facebook", "*****@*****.**");
                Membership.CreateUser("Patricia", "facebook", "*****@*****.**");
                Membership.CreateUser("Elizabeth", "facebook", "*****@*****.**");
                Membership.CreateUser("Maria", "facebook", "*****@*****.**");
                Membership.CreateUser("Susan", "facebook", "*****@*****.**");
                Membership.CreateUser("Margaret", "facebook", "*****@*****.**");
                Membership.CreateUser("Lisa", "facebook", "*****@*****.**");
                Membership.CreateUser("Karen", "facebook", "*****@*****.**");
                Membership.CreateUser("Helen", "facebook", "*****@*****.**");
                Membership.CreateUser("Sandra", "facebook", "*****@*****.**");
                Membership.CreateUser("Sharon", "facebook", "*****@*****.**");
                Membership.CreateUser("Michelle", "facebook", "*****@*****.**");
                Membership.CreateUser("Laura", "facebook", "*****@*****.**");
                Membership.CreateUser("Kimberly", "facebook", "*****@*****.**");
                Membership.CreateUser("Deborah", "facebook", "*****@*****.**");
                Membership.CreateUser("James", "facebook", "*****@*****.**");
                Membership.CreateUser("Robert", "facebook", "*****@*****.**");
                Membership.CreateUser("Michael", "facebook", "*****@*****.**");
                Membership.CreateUser("David", "facebook", "*****@*****.**");
                Membership.CreateUser("Charles", "facebook", "*****@*****.**");
                Membership.CreateUser("Thomas", "facebook", "*****@*****.**");
                Membership.CreateUser("Christopher", "facebook", "*****@*****.**");
                Membership.CreateUser("Edward", "facebook", "*****@*****.**");
                Membership.CreateUser("Tom", "facebook", "*****@*****.**");
                Membership.CreateUser("Brad", "facebook", "*****@*****.**");
                Roles.CreateRole("Poll Administrator");
                Roles.CreateRole("Poll Creator");
                Roles.CreateRole("Poll Master");
                Roles.CreateRole("Poll User");
                Roles.CreateRole("System Administrator");
                Roles.AddUserToRole("Jared", "Poll Administrator");
                Roles.AddUserToRole("Jared", "Poll Creator");
                Roles.AddUserToRole("Jared", "Poll Master");
                Roles.AddUserToRole("Jared", "Poll User");
                Roles.AddUserToRole("Andrew", "Poll Administrator");
                Roles.AddUserToRole("Andrew", "Poll Creator");
                Roles.AddUserToRole("Andrew", "Poll Master");
                Roles.AddUserToRole("Andrew", "Poll User");
                Roles.AddUserToRole("Katrina", "Poll User");
                Roles.AddUserToRole("TienWei", "Poll User");
                Roles.AddUserToRole("Jen", "Poll Creator");
                Roles.AddUserToRole("Jen", "Poll Master");
                Roles.AddUserToRole("Jen", "Poll User");
                Roles.AddUserToRole("Steve", "Poll Creator");
                Roles.AddUserToRole("Steve", "Poll Master");
                Roles.AddUserToRole("Steve", "Poll User");
                Roles.AddUserToRole("Bill", "Poll User");
                Roles.AddUserToRole("Tim", "Poll User");
                Roles.AddUserToRole("Billy", "Poll User");
                Roles.AddUserToRole("Mary", "Poll Master");
                Roles.AddUserToRole("Mary", "Poll User");
                Roles.AddUserToRole("Patricia", "Poll Creator");
                Roles.AddUserToRole("Patricia", "Poll Master");
                Roles.AddUserToRole("Patricia", "Poll User");
                Roles.AddUserToRole("Elizabeth", "Poll User");
                Roles.AddUserToRole("Maria", "Poll User");
                Roles.AddUserToRole("Susan", "Poll User");
                Roles.AddUserToRole("Margaret", "Poll Creator");
                Roles.AddUserToRole("Margaret", "Poll Master");
                Roles.AddUserToRole("Margaret", "Poll User");
                Roles.AddUserToRole("Lisa", "Poll Creator");
                Roles.AddUserToRole("Lisa", "Poll Master");
                Roles.AddUserToRole("Lisa", "Poll User");
                Roles.AddUserToRole("Karen", "Poll Creator");
                Roles.AddUserToRole("Karen", "Poll Master");
                Roles.AddUserToRole("Karen", "Poll User");
                Roles.AddUserToRole("Helen", "Poll User");
                Roles.AddUserToRole("Sandra", "Poll User");
                Roles.AddUserToRole("Sharon", "Poll User");
                Roles.AddUserToRole("Michelle", "Poll User");
                Roles.AddUserToRole("Laura", "Poll Master");
                Roles.AddUserToRole("Laura", "Poll User");
                Roles.AddUserToRole("Kimberly", "Poll Creator");
                Roles.AddUserToRole("Kimberly", "Poll Master");
                Roles.AddUserToRole("Kimberly", "Poll User");
                Roles.AddUserToRole("Deborah", "Poll User");
                Roles.AddUserToRole("James", "Poll User");
                Roles.AddUserToRole("Robert", "Poll User");
                Roles.AddUserToRole("Michael", "Poll Master");
                Roles.AddUserToRole("Michael", "Poll User");
                Roles.AddUserToRole("David", "Poll Creator");
                Roles.AddUserToRole("David", "Poll Master");
                Roles.AddUserToRole("David", "Poll User");
                Roles.AddUserToRole("Charles", "Poll Master");
                Roles.AddUserToRole("Charles", "Poll User");
                Roles.AddUserToRole("Thomas", "System Administrator");
                Roles.AddUserToRole("Christopher", "Poll User");
                Roles.AddUserToRole("Edward", "Poll User");
                Roles.AddUserToRole("Tom", "Poll Creator");
                Roles.AddUserToRole("Tom", "Poll Master");
                Roles.AddUserToRole("Tom", "Poll User");
                Roles.AddUserToRole("Brad", "Poll Creator");
                Roles.AddUserToRole("Brad", "Poll Master");
                Roles.AddUserToRole("Brad", "Poll User");
                transaction.Commit();
            }
            transaction = session.BeginTransaction();

            using (transaction)
            {
                var userRepository = new UserRepository(session);
                var roleRepository = new RoleRepository(session);
                var role1 = roleRepository.GetRoleByName("Poll Administrator");
                var role2 = roleRepository.GetRoleByName("Poll Creator");
                var role3 = roleRepository.GetRoleByName("Poll Master");
                var role4 = roleRepository.GetRoleByName("Poll User");
                var role5 = roleRepository.GetRoleByName("System Administrator");
                role1.CanCreate = role2;
                role2.CanCreate = role3;
                role3.CanCreate = role4;
                role5.CanCreate = role1;
                role1.InheritedRoles.Add(role2);
                role1.InheritedRoles.Add(role3);
                role1.InheritedRoles.Add(role4);
                role2.InheritedRoles.Add(role3);
                role2.InheritedRoles.Add(role4);
                role3.InheritedRoles.Add(role4);
                OptionsTemplate optionsTemplate1 = new OptionsTemplate("True/False");
                OptionsTemplate optionsTemplate2 = new OptionsTemplate("Yes/No/Abstain");
                OptionsTemplate optionsTemplate3 = new OptionsTemplate("Opinion Scale 1");
                OptionsTemplate optionsTemplate4 = new OptionsTemplate("Opinion Scale 2");
                optionsTemplate1.options.Add(new Option("True", 1));
                optionsTemplate1.options.Add(new Option("False", 2));
                optionsTemplate2.options.Add(new Option("Yes", 1));
                optionsTemplate2.options.Add(new Option("No", 2));
                optionsTemplate2.options.Add(new Option("Abstain", 3));
                optionsTemplate3.options.Add(new Option("Strongly Agree", 1));
                optionsTemplate3.options.Add(new Option("Agree", 2));
                optionsTemplate3.options.Add(new Option("Neutral", 3));
                optionsTemplate3.options.Add(new Option("Disagree", 4));
                optionsTemplate3.options.Add(new Option("Strongly Disagree", 5));
                optionsTemplate4.options.Add(new Option("Strongly Agree", 1));
                optionsTemplate4.options.Add(new Option("Agree", 2));
                optionsTemplate4.options.Add(new Option("Somewhat Agree", 3));
                optionsTemplate4.options.Add(new Option("Neutral", 4));
                optionsTemplate4.options.Add(new Option("Somewhat Disagree", 5));
                optionsTemplate4.options.Add(new Option("Disagree", 6));
                optionsTemplate4.options.Add(new Option("Strongly Disagree", 7));
                session.Save(optionsTemplate1);
                session.Save(optionsTemplate2);
                session.Save(optionsTemplate3);
                session.Save(optionsTemplate4);
                FieldsTemplate fieldsTemplate1 = new FieldsTemplate("Education");
                FieldsTemplate fieldsTemplate2 = new FieldsTemplate("Corporate");
                fieldsTemplate1.fields.Add(new Field("Student ID", 1));
                fieldsTemplate1.fields.Add(new Field("Gender", 2));
                fieldsTemplate1.fields.Add(new Field("Degree", 3));
                fieldsTemplate1.fields.Add(new Field("Major", 4));
                fieldsTemplate2.fields.Add(new Field("Title", 1));
                fieldsTemplate2.fields.Add(new Field("Gender", 2));
                fieldsTemplate2.fields.Add(new Field("Company", 3));
                fieldsTemplate2.fields.Add(new Field("Department", 4));
                fieldsTemplate2.fields.Add(new Field("Address 1", 5));
                fieldsTemplate2.fields.Add(new Field("Address 2", 6));
                fieldsTemplate2.fields.Add(new Field("City", 7));
                fieldsTemplate2.fields.Add(new Field("State/Province", 8));
                fieldsTemplate2.fields.Add(new Field("Zip/Postal Code", 9));
                fieldsTemplate2.fields.Add(new Field("Phone", 10));
                fieldsTemplate2.fields.Add(new Field("Mobile", 11));
                fieldsTemplate2.fields.Add(new Field("Email", 12));
                session.Save(fieldsTemplate1);
                session.Save(fieldsTemplate2);
                var poll1 = new Poll(-27.4709180316061, 153.023501693512);
                var poll2 = new Poll(-27.4709180316061, 153.023501693512);
                var poll3 = new Poll(-27.4709180316061, 153.023501693512);
                var poll4 = new Poll(-27.5002091890658, 153.014312445427);
                poll1.name = "UQ Meeting";
                poll2.name = "Staff Meeting 1";
                poll3.name = "Staff Meeting 2";
                poll4.name = "Final Presentation";
                poll3.pollStart = DateTime.Now;
                poll3.pollClose = DateTime.Now.AddHours(1);
                poll4.pollClose = DateTime.Now.AddHours(1);
                var question1 = new CustomQuestion(1);
                var question2 = new CustomQuestion(2);
                var question3 = new CustomQuestion(3);
                var question4 = new CustomQuestion(4);
                var question5 = new CustomQuestion(5);
                var question6 = new RankingQuestion(6);
                var question7 = new RankingQuestion(7);
                var question8 = new CustomQuestion(8);
                var question9 = new CustomQuestion(9);
                var question10 = new CustomQuestion(10);
                var question11 = new CustomQuestion(11);
                var question12 = new CustomQuestion(12);
                var question13 = new CustomQuestion(13);
                var question14 = new DemographicQuestion(14);
                var question15 = new NumericQuestion(15);
                var question16 = new AlphanumericQuestion(16);
                var question17 = new CustomQuestion(17);
                var question18 = new CustomQuestion(18);
                var question19 = new CustomQuestion(19);
                var question20 = new CustomQuestion(20);
                var question21 = new CustomQuestion(1);
                var question22 = new DemographicQuestion(2);
                var question23 = new CustomQuestion(3);
                var question24 = new CustomQuestion(4);
                var question25 = new CustomQuestion(5);
                var question26 = new AlphanumericQuestion(6);
                var question27 = new CustomQuestion(7);
                var question28 = new CustomQuestion(8);
                var question29 = new NumericQuestion(9);
                var question30 = new DemographicQuestion(10);
                var question31 = new CustomQuestion(1);
                var question32 = new CustomQuestion(2);
                var question33 = new CustomQuestion(3);
                var question34 = new CustomQuestion(4);
                var question35 = new CustomQuestion(5);
                var question36 = new CustomQuestion(6);
                var question37 = new CustomQuestion(7);
                var question38 = new RankingQuestion(8);
                var question39 = new NumericQuestion(9);
                var question40 = new AlphanumericQuestion(10);
                var question41 = new CustomQuestion(1);
                var question42 = new CustomQuestion(2);
                var question43 = new CustomQuestion(3);
                var question44 = new CustomQuestion(4);
                var question45 = new CustomQuestion(5);
                var question46 = new RankingQuestion(6);
                var question47 = new NumericQuestion(7);
                var question48 = new NumericQuestion(8);
                question41.resultsChart.chartType = "Pie";
                question47.resultsChart.chartType = "Horizontal Bar";
                question43.resultsChart.colours = "red, green, orange, yellow";
                question45.resultsChart.colours = "orange, yellow, green, red";
                question42.resultsChart.valueType = "Count";
                question46.resultsChart.valueType = "Count";
                question41.countdownTimer.active = true;
                question41.countdownTimer.countdownAmount = 41;
                question42.countdownTimer.active = true;
                question42.countdownTimer.countdownAmount = 40;
                question43.countdownTimer.active = true;
                question43.countdownTimer.countdownAmount = 40;
                question44.countdownTimer.active = true;
                question44.countdownTimer.countdownAmount = 40;
                question45.countdownTimer.active = true;
                question45.countdownTimer.countdownAmount = 47;
                question46.countdownTimer.active = true;
                question46.countdownTimer.countdownAmount = 61;
                question47.countdownTimer.active = true;
                question47.countdownTimer.countdownAmount = 36;
                question48.countdownTimer.active = true;
                question48.countdownTimer.countdownAmount = 36;
                question41.responseCounter.active = true;
                question42.responseCounter.active = true;
                question43.responseCounter.active = true;
                question44.responseCounter.active = true;
                question45.responseCounter.active = true;
                question46.responseCounter.active = true;
                question47.responseCounter.active = true;
                question48.responseCounter.active = true;
                question41.correctAnswerIndicator.active = true;
                question42.correctAnswerIndicator.active = true;
                question43.correctAnswerIndicator.active = true;
                question44.correctAnswerIndicator.active = true;
                question45.correctAnswerIndicator.active = true;
                question46.correctAnswerIndicator.active = true;
                question47.correctAnswerIndicator.active = true;
                question48.correctAnswerIndicator.active = true;
                question1.question = "Do you like Brisbane?";
                question2.question = "Do you like Brisbane?";
                question3.question = "How fast can you run?";
                question4.question = "Do you think your council rates are?";
                question5.question = "Do you think your council services are?";
                question6.question = "Which services would you increase with higher rates (choose two)";
                question6.allowedAnswers = 2;
                question7.question = "Which services would you reduce with lower rates (choose two)";
                question7.allowedAnswers = 2;
                question8.question = "Would you like to see more green initiatives by your council:";
                question9.question = "Do you rate your council as effective:";
                question10.question = "Do you think your council should amalgamate with neighbouring councils to form larger councils:";
                question11.question = "Do you think council amalgamations should more so result in?";
                question12.question = "Have you met your local council representative?";
                question13.question = "How do you rate your council?";
                question14.question = "What is your gender?";
                question15.question = "How fast can a lion travel (in km/h)?";
                question16.question = "Who is the maker of the iPod?";
                question17.question = "Why did John B. Watson reject the structuralist study of mental events?";
                question18.question = "The “plum pudding” model of the atom was devised by who?";
                question19.question = "Bohr’s model of the atom was able to accurately explain:";
                question20.question = "All isotopes are radioactive.";
                question21.question = "Explaining a student's poor performance on an exam to the unfair difficulty level of the questions refers to what kind of cause?";
                question22.question = "What is your current city?";
                question23.question = "Which of the following is NOT a laboratory safety rule?";
                question24.question = "Do you think this poll is useful?";
                question25.question = "Do you think this poll is useful?";
                question26.question = "Explain the independent variable in an experiment.";
                question27.question = "“Qualitative results” refer to:";
                question28.question = "When drawing a graph that measures family average income over a period of 50 years, the independent variable is:";
                question29.question = "How many significant figures are present in the number 10,450?";
                question30.question = "What is your gender?";
                question31.question = "What group used the agricultural method of terracing in the Andes Mountains during the 15th century?";
                question32.question = "A symmetry of potential outcomes means that the project:";
                question33.question = "What is the difference between research questions and research objectives?";
                question34.question = "Which one of these is normally associated with observation?";
                question35.question = "Supporters of observation consider it to be:";
                question36.question = "An observation form must not:";
                question37.question = "Observation is a form of:";
                question38.question = "What are your favourite sorting algorithms? (rank them from 1 to 5)";
                question39.question = "What is 30 divided by 3?";
                question40.question = "Name a product made by Apple.";
                question41.question = "The term 'cyberpunk' was originally coined in:";
                question42.question = "What is the first name of the founder of DELL computers?";
                question43.question = "Who was the first actor to play Doctor Who?";
                question44.question = "Which artist and which writer created the infamous caped crusader, Batman?";
                question45.question = "The first interactive electronic game was patented as a...";
                question46.question = "Rank the following books in order of most- to least copies sold";
                question47.question = "Approximately what percentage of web browser users are still on Internet Explorer?";
                question48.question = "The oldest person, Jeanne Calment, was aged...";
                question1.options.Add(new QuestionOption("Yes", 1));
                question1.options.Add(new QuestionOption("No", 2));
                question2.options.Add(new QuestionOption("Yes", 1));
                question2.options.Add(new QuestionOption("No", 2));
                question2.compareWith = question1;
                question3.options.Add(new QuestionOption("very fast", 1));
                question3.options.Add(new QuestionOption("fast", 2));
                question3.options.Add(new QuestionOption("slow", 3));
                question3.options.Add(new QuestionOption("very slow", 4));
                question4.options.Add(new QuestionOption("Too high", 1));
                question4.options.Add(new QuestionOption("At an expected level", 2));
                question4.options.Add(new QuestionOption("Too low", 3));
                question5.options.Add(new QuestionOption("At the right level", 1));
                question5.options.Add(new QuestionOption("Should be expanded with an increase in rates", 2));
                question5.options.Add(new QuestionOption("Should be contracted with a decrease in rates", 3));
                question5.options.Add(new QuestionOption("Should be re-weighted with no increase in rates", 4));
                question6.options.Add(new QuestionOption("Garbage collection", 1));
                question6.options.Add(new QuestionOption("Roads & paths maintenance", 2));
                question6.options.Add(new QuestionOption("Street lighting", 3));
                question6.options.Add(new QuestionOption("Library services", 4));
                question6.options.Add(new QuestionOption("Children’s services", 5));
                question6.options.Add(new QuestionOption("Aged & disability services", 6));
                question6.options.Add(new QuestionOption("Park & recreational amenities", 7));
                question7.options.Add(new QuestionOption("Garbage collection", 1));
                question7.options.Add(new QuestionOption("Roads & paths maintenance", 2));
                question7.options.Add(new QuestionOption("Street lighting", 3));
                question7.options.Add(new QuestionOption("Library services", 4));
                question7.options.Add(new QuestionOption("Children’s services", 5));
                question7.options.Add(new QuestionOption("Aged & disability services", 6));
                question7.options.Add(new QuestionOption("Park & recreational amenities", 7));
                question8.options.Add(new QuestionOption("No", 1));
                question8.options.Add(new QuestionOption("Yes, if increase in rates limited to 2.5% or so", 2));
                question8.options.Add(new QuestionOption("Yes, if increase in rates limited to 5 % or so", 3));
                question8.options.Add(new QuestionOption("Yes, if increase in rates limited to 10% or so", 4));
                question9.options.Add(new QuestionOption("Yes", 1));
                question9.options.Add(new QuestionOption("No", 2));
                question9.options.Add(new QuestionOption("Never thought about it", 3));
                question10.options.Add(new QuestionOption("Definitely", 1));
                question10.options.Add(new QuestionOption("Maybe", 2));
                question10.options.Add(new QuestionOption("No", 3));
                question10.options.Add(new QuestionOption("Already happened / Not applicable", 4));
                question10.options.Add(new QuestionOption("No opinion at this time", 5));
                question11.options.Add(new QuestionOption("Lower rates", 1));
                question11.options.Add(new QuestionOption("Higher services", 2));
                question12.options.Add(new QuestionOption("Yes- regularly", 1));
                question12.options.Add(new QuestionOption("Yes- once or twice", 2));
                question12.options.Add(new QuestionOption("Never", 3));
                question13.options.Add(new QuestionOption("Professional", 1));
                question13.options.Add(new QuestionOption("Adequate", 2));
                question13.options.Add(new QuestionOption("Sub-standard", 3));
                question13.options.Add(new QuestionOption("No opinion", 4));
                question14.options.Add(new QuestionOption("Male", 1));
                question14.options.Add(new QuestionOption("Female", 2));
                question15.greaterThan = 100;
                question15.lessThan = 200;
                question16.answers.Add(new CorrectAnswer("Apple"));
                question17.options.Add(new QuestionOption("He believed that structuralism relied too heavily on scientific methods.", 1));
                question17.options.Add(new QuestionOption("He rejected the concept that psychologists should study observable behavior.", 2));
                question17.options.Add(new QuestionOption("He believed that scientists should focus on what is objectively observable.", 3));
                question17.options.Add(new QuestionOption("He actually embraced both structuralism and functionalism.", 4));
                question18.options.Add(new QuestionOption("Dalton", 1));
                question18.options.Add(new QuestionOption("Democritus", 2));
                question18.options.Add(new QuestionOption("Rutherford", 3));
                question18.options.Add(new QuestionOption("none of the above answers is correct", 4));
                question19.options.Add(new QuestionOption("Why spectral lines appear when atoms are heated.", 1));
                question19.options.Add(new QuestionOption("The energies of the spectral lines for each element.", 2));
                question19.options.Add(new QuestionOption("Why electrons travel in circular orbits around the nucleus.", 3));
                question19.options.Add(new QuestionOption("none of the above answers is correct.", 4));
                question20.options.Add(new QuestionOption("True", 1));
                question20.options.Add(new QuestionOption("False", 2));
                question21.options.Add(new QuestionOption("immediate, external cause", 1));
                question21.options.Add(new QuestionOption("immediate, internal cause", 2));
                question21.options.Add(new QuestionOption("developmental cause", 3));
                question21.options.Add(new QuestionOption("necessary and sufficient cause", 4));
                question21.options.Add(new QuestionOption("weak cause", 5));
                question21.options[1].correctCurrent = true;
                question22.options.Add(new QuestionOption("Brisbane", 1));
                question22.options.Add(new QuestionOption("Sydney", 2));
                question22.options.Add(new QuestionOption("Melbourne", 3));
                question23.options.Add(new QuestionOption("You should never mix acids with bases", 1));
                question23.options.Add(new QuestionOption("You should tie back your long hair", 2));
                question23.options.Add(new QuestionOption("You should never add water to acid", 3));
                question23.options.Add(new QuestionOption("All of the above are valid safety rules", 4));
                question23.options[3].correctCurrent = true;
                question24.options.Add(new QuestionOption("Yes", 1));
                question24.options.Add(new QuestionOption("No", 2));
                question24.options[1].correctCurrent = true;
                question25.options.Add(new QuestionOption("Yes", 1));
                question25.options.Add(new QuestionOption("No", 2));
                question25.options[1].correctCurrent = true;
                question26.answers.Add(new CorrectAnswer("The variable you change in an experiment."));
                question27.options.Add(new QuestionOption("Results that can be observed during an experiment.", 1));
                question27.options.Add(new QuestionOption("Results that are difficult to observe during an experiment.", 2));
                question27.options.Add(new QuestionOption("Results that require numerical data.", 3));
                question27.options.Add(new QuestionOption("none of these is correct.", 4));
                question27.options[3].correctCurrent = true;
                question28.options.Add(new QuestionOption("Income", 1));
                question28.options.Add(new QuestionOption("Average", 2));
                question28.options.Add(new QuestionOption("Years", 3));
                question28.options.Add(new QuestionOption("It is impossible to say", 4));
                question28.options[1].correctCurrent = true;
                question29.lessThan = 4;
                question29.greaterThan = 4;
                question30.options.Add(new QuestionOption("Male", 1));
                question30.options.Add(new QuestionOption("Female", 2));
                question31.options.Add(new QuestionOption("Mayans", 1));
                question31.options.Add(new QuestionOption("Aztecs", 2));
                question31.options.Add(new QuestionOption("Incas", 3));
                question31.options[2].correctCurrent = true;
                question31.options[2].pointsCurrent = 3;
                question31.options[1].pointsCurrent = 0;
                question32.options.Add(new QuestionOption("will be valuable whatever the outcome.", 1));
                question32.options.Add(new QuestionOption("will be reliable whatever the outcome.", 2));
                question32.options.Add(new QuestionOption("starts with a quantitative stage and ends with a quantitative stage.", 3));
                question32.options.Add(new QuestionOption("starts with a qualitative stage and ends with a qualitative stage.", 4));
                question32.options[1].correctCurrent = true;
                question32.options[1].pointsCurrent = 3;
                question33.options.Add(new QuestionOption("The question is worded by the researcher, the objective is not.", 1));
                question33.options.Add(new QuestionOption("One of these is proposed by a supervisor.", 2));
                question33.options.Add(new QuestionOption("No difference, they are the same.", 3));
                question33.options.Add(new QuestionOption("The wording of one is likely to be more specific than the other.", 4));
                question33.options[3].correctCurrent = true;
                question32.options[3].pointsCurrent = 3;
                question34.options.Add(new QuestionOption("Problem people.", 1));
                question34.options.Add(new QuestionOption("Problem causation.", 2));
                question34.options.Add(new QuestionOption("Problem identification.", 3));
                question34.options.Add(new QuestionOption("Problem solving.", 4));
                question34.options[1].correctCurrent = true;
                question32.options[1].pointsCurrent = 3;
                question35.options.Add(new QuestionOption("subjective.", 1));
                question35.options.Add(new QuestionOption("creative.", 2));
                question35.options.Add(new QuestionOption("negative.", 3));
                question35.options.Add(new QuestionOption("objective.", 4));
                question35.options[2].correctCurrent = true;
                question32.options[2].pointsCurrent = 3;
                question36.options.Add(new QuestionOption("be easy to use.", 1));
                question36.options.Add(new QuestionOption("record irrelevant details.", 2));
                question36.options.Add(new QuestionOption("be self explanatory.", 3));
                question36.options.Add(new QuestionOption("cover the objectives.", 4));
                question36.options[0].correctCurrent = true;
                question32.options[0].pointsCurrent = 3;
                question37.options.Add(new QuestionOption("quantitative research.", 1));
                question37.options.Add(new QuestionOption("primary research.", 2));
                question37.options.Add(new QuestionOption("qualitative research.", 3));
                question37.options.Add(new QuestionOption("all of the above.", 4));
                question37.options.Add(new QuestionOption("none of the above.", 5));
                question37.options[0].correctCurrent = true;
                question37.options[0].pointsCurrent = 3;
                question37.options[4].pointsCurrent = 0;
                question38.options.Add(new QuestionOption("Bubble sort", 1));
                question38.options.Add(new QuestionOption("Quicksort", 2));
                question38.options.Add(new QuestionOption("Bucket sort", 3));
                question38.options.Add(new QuestionOption("Heap sort", 4));
                question38.options.Add(new QuestionOption("Merge sort", 5));
                question38.rankValues[0].value = 5;
                question38.rankValues[1].value = 4;
                question38.rankValues[2].value = 3;
                question38.rankValues[3].value = 2;
                question38.rankValues[4].value = 1;
                question38.allowedAnswers = 5;
                question39.greaterThan = 5;
                question39.lessThan = 15;
                question40.answers.Add(new CorrectAnswer("iPad"));
                question40.answers.Add(new CorrectAnswer("iPod"));
                question40.answers.Add(new CorrectAnswer("iPhone"));
                question41.options.Add(new QuestionOption("1902", 1));
                question41.options.Add(new QuestionOption("1967", 2));
                question41.options.Add(new QuestionOption("1983", 3));
                question41.options.Add(new QuestionOption("1991", 4));
                question41.options[2].correctCurrent = true;
                question41.options[2].pointsCurrent = 5;
                question42.options.Add(new QuestionOption("Michael", 1));
                question42.options.Add(new QuestionOption("James", 2));
                question42.options.Add(new QuestionOption("Stephen", 3));
                question42.options.Add(new QuestionOption("Vivian", 4));
                question42.options[0].correctCurrent = true;
                question42.options[0].pointsCurrent = 5;
                question43.options.Add(new QuestionOption("David Tennant", 1));
                question43.options.Add(new QuestionOption("Peter Davison", 2));
                question43.options.Add(new QuestionOption("William Hartnell", 3));
                question43.options.Add(new QuestionOption("John Cleese", 4));
                question43.options[2].correctCurrent = true;
                question43.options[2].pointsCurrent = 5;
                question44.options.Add(new QuestionOption("Jerry Robinson", 1));
                question44.options.Add(new QuestionOption("Paul Dini", 2));
                question44.options.Add(new QuestionOption("Bob Kane", 3));
                question44.options.Add(new QuestionOption("Frank Miller", 4));
                question44.options.Add(new QuestionOption("Bill Finger", 5));
                question44.allowedAnswers = 2;
                question44.options[2].correctCurrent = true;
                question44.options[4].correctCurrent = true;
                question44.options[2].pointsCurrent = 5;
                question44.options[4].pointsCurrent = 5;
                question45.options.Add(new QuestionOption("“cathode ray tube amusement device”", 1));
                question45.options.Add(new QuestionOption("“cathode ray tube device”", 2));
                question45.options.Add(new QuestionOption("“reticle control amusement device”", 3));
                question45.options.Add(new QuestionOption("“CRT simulated amusement device”", 4));
                question45.options[0].correctCurrent = true;
                question45.options[0].pointsCurrent = 5;
                question46.options.Add(new QuestionOption("Agatha Christie's “And Then There Were None”", 1));
                question46.options.Add(new QuestionOption("J. R. R. Tolkien's “The Lord of the Rings”", 2));
                question46.options.Add(new QuestionOption("Dan Brown's “The Da Vinci Code”", 3));
                question46.options.Add(new QuestionOption("Roald Dahl's “Charlie and the Chocolate Factory”", 4));
                question46.options.Add(new QuestionOption("Vladimir Nabokov's “Lolita”", 5));
                question46.allowedAnswers = 5;
                question46.rankValues[0].value = 5;
                question46.rankValues[1].value = 4;
                question46.rankValues[2].value = 3;
                question46.rankValues[3].value = 2;
                question46.rankValues[4].value = 1;
                question47.greaterThan = 30;
                question47.lessThan = 40;
                question48.greaterThan = 121;
                question48.lessThan = 123;
                poll1.questions.Add(question1);
                poll1.questions.Add(question2);
                poll1.questions.Add(question3);
                poll1.questions.Add(question4);
                poll1.questions.Add(question5);
                poll1.questions.Add(question6);
                poll1.questions.Add(question7);
                poll1.questions.Add(question8);
                poll1.questions.Add(question9);
                poll1.questions.Add(question10);
                poll1.questions.Add(question11);
                poll1.questions.Add(question12);
                poll1.questions.Add(question13);
                poll1.questions.Add(question14);
                poll1.questions.Add(question15);
                poll1.questions.Add(question16);
                poll1.questions.Add(question17);
                poll1.questions.Add(question18);
                poll1.questions.Add(question19);
                poll1.questions.Add(question20);
                poll2.questions.Add(question21);
                poll2.questions.Add(question22);
                poll2.questions.Add(question23);
                poll2.questions.Add(question24);
                poll2.questions.Add(question25);
                poll2.questions.Add(question26);
                poll2.questions.Add(question27);
                poll2.questions.Add(question28);
                poll2.questions.Add(question29);
                poll2.questions.Add(question30);
                poll3.questions.Add(question31);
                poll3.questions.Add(question32);
                poll3.questions.Add(question33);
                poll3.questions.Add(question34);
                poll3.questions.Add(question35);
                poll3.questions.Add(question36);
                poll3.questions.Add(question37);
                poll3.questions.Add(question38);
                poll3.questions.Add(question39);
                poll3.questions.Add(question40);
                poll4.questions.Add(question41);
                poll4.questions.Add(question42);
                poll4.questions.Add(question43);
                poll4.questions.Add(question44);
                poll4.questions.Add(question45);
                poll4.questions.Add(question46);
                poll4.questions.Add(question47);
                poll4.questions.Add(question48);
                foreach (var field in fieldsTemplate2.fields)
                {
                    poll1.participantFields.Add(new ParticipantField(field.name));
                }
                foreach (var field in poll1.participantFields)
                {
                    if (field.name == "Gender")
                    {
                        question14.linkedField = field;
                    }
                }
                foreach (var field in fieldsTemplate1.fields)
                {
                    poll2.participantFields.Add(new ParticipantField(field.name));
                }
                poll3.participantFields.Add(new ParticipantField("Student ID"));
                poll3.participantFields.Add(new ParticipantField("Gender"));
                poll3.participantFields.Add(new ParticipantField("Age"));
                poll3.participantFields.Add(new ParticipantField("Tutor"));
                foreach (var field in poll2.participantFields)
                {
                    if (field.name == "Gender")
                    {
                        question30.linkedField = field;
                    }
                }
                var user1 = userRepository.GetUserByUsername("Andrew");
                var user2 = userRepository.GetUserByUsername("Jared");
                var user3 = userRepository.GetUserByUsername("Katrina");
                var user4 = userRepository.GetUserByUsername("TienWei");
                var user5 = userRepository.GetUserByUsername("Jen");
                var user6 = userRepository.GetUserByUsername("Steve");
                var user7 = userRepository.GetUserByUsername("Bill");
                var user8 = userRepository.GetUserByUsername("Tim");
                var user9 = userRepository.GetUserByUsername("Billy");
                var user10 = userRepository.GetUserByUsername("Mary");
                var user11 = userRepository.GetUserByUsername("Patricia");
                var user12 = userRepository.GetUserByUsername("Elizabeth");
                var user13 = userRepository.GetUserByUsername("Maria");
                var user14 = userRepository.GetUserByUsername("Susan");
                var user15 = userRepository.GetUserByUsername("Margaret");
                var user16 = userRepository.GetUserByUsername("Lisa");
                var user17 = userRepository.GetUserByUsername("Karen");
                var user18 = userRepository.GetUserByUsername("Helen");
                var user19 = userRepository.GetUserByUsername("Sandra");
                var user20 = userRepository.GetUserByUsername("Sharon");
                var user21 = userRepository.GetUserByUsername("Michelle");
                var user22 = userRepository.GetUserByUsername("Laura");
                var user23 = userRepository.GetUserByUsername("Kimberly");
                var user24 = userRepository.GetUserByUsername("Deborah");
                var user25 = userRepository.GetUserByUsername("James");
                var user26 = userRepository.GetUserByUsername("Robert");
                var user27 = userRepository.GetUserByUsername("Michael");
                var user28 = userRepository.GetUserByUsername("David");
                var user29 = userRepository.GetUserByUsername("Charles");
                var user30 = userRepository.GetUserByUsername("Thomas");
                var user31 = userRepository.GetUserByUsername("Christopher");
                var user32 = userRepository.GetUserByUsername("Edward");
                var user33 = userRepository.GetUserByUsername("Tom");
                var user34 = userRepository.GetUserByUsername("Brad");
                var clientCode = new ClientCode(user1);
                var clientCode2 = new ClientCode(user2);
                user1.Populate("Andrew", "Jones", "UQ", "Student", "Brisbane", Gender.Male, clientCode);
                user1.AccountExpiryDate = DateTime.Now.AddYears(1);
                user2.Populate("Jared", "Morley", "UQ", "Student", "Brisbane", Gender.Male, clientCode2);
                user2.AccountExpiryDate = DateTime.Now.AddYears(1);
                user3.Populate("Katrina", "Ng", "UQ", "Student", "Brisbane", Gender.Female, clientCode);
                user4.Populate("Tien", "Wei", "UQ", "Student", "Brisbane", Gender.Male, clientCode);
                user5.Populate("Jen", "Radecki", "UQ", "Lecturer", "Brisbane", Gender.Female, clientCode);
                user6.Populate("Steve", "Jobs", "Apple", "CEO", "Brisbane", Gender.Male, clientCode);
                user7.Populate("Bill", "Gates", "Microsoft", "CEO", "Brisbane", Gender.Male, clientCode);
                user8.Populate("Tim", "Armstrong", "UQ", "Student", "Brisbane", Gender.Male, clientCode);
                user9.Populate("Billy", "Corgan", "The Smashing Pumpkins", "Lead Singer", "Brisbane", Gender.Male, clientCode);
                user10.Populate("Mary", "Willson", "UQ", "Student", "Brisbane", Gender.Female, clientCode);
                user11.Populate("Particia", "Chen", "UQ", "Scientist", "Brisbane", Gender.Female, clientCode);
                user12.Populate("Elizabeth", "Moore", "UQ", "Student", "Brisbane", Gender.Female, clientCode);
                user13.Populate("Maria", "Anderson", "UQ", "Lecturer", "Brisbane", Gender.Female, clientCode);
                user14.Populate("Susan", "Jackson", "UQ", "Student", "Brisbane", Gender.Female, clientCode);
                user15.Populate("Margaret", "White", "UQ", "Student", "Brisbane", Gender.Female, clientCode);
                user16.Populate("Lisa", "Martin", "UQ", "Student", "Brisbane", Gender.Female, clientCode);
                user17.Populate("Karen", "Clark", "Google", "Software Engineer", "Melbourne", Gender.Female, clientCode);
                user18.Populate("Helen", "Lee", "Google", "Software Engineer", "Melbourne", Gender.Female, clientCode);
                user19.Populate("Sandra", "Walker", "Google", "Software Engineer", "Melbourne", Gender.Female, clientCode);
                user20.Populate("Sharon", "Lopez", "Google", "Software Engineer", "Melbourne", Gender.Female, clientCode);
                user21.Populate("Michelle", "Lopez", "Google", "Designer", "Melbourne", Gender.Female, clientCode);
                user22.Populate("Laura", "Baker", "Google", "Designer", "Melbourne", Gender.Female, clientCode);
                user23.Populate("Kimberly", "Baker", "Google", "Designer", "Melbourne", Gender.Female, clientCode);
                user24.Populate("Deborah", "Parker", "Google", "Designer", "Melbourne", Gender.Female, clientCode);
                user25.Populate("James", "Parker", "Google", "Project Manager", "Melbourne", Gender.Male, clientCode);
                user26.Populate("Robert", "Richardson", "Google", "Project Manager", "Melbourne", Gender.Male, clientCode);
                user27.Populate("Michael", "Radecki", "Google", "Project Manager", "Melbourne", Gender.Male, clientCode);
                user28.Populate("David", "Radecki", "Google", "Project Manager", "Sydney", Gender.Male, clientCode);
                user29.Populate("Charles", "Radecki", "Google", "Software Engineer", "Sydney", Gender.Male, clientCode);
                user30.Populate("Thomas", "Radecki", "Google", "Software Engineer", "Sydney", Gender.Male, clientCode);
                user31.Populate("Christopher", "Radecki", "Google", "Software Engineer", "Sydney", Gender.Male, clientCode);
                user32.Populate("Edward", "Radecki", "Google", "Software Engineer", "Sydney", Gender.Male, clientCode);
                user33.Populate("Tom", "Radecki", "Google", "Software Engineer", "Sydney", Gender.Male, clientCode);
                user34.Populate("Brad", "Radecki", "Google", "Software Engineer", "Sydney", Gender.Male, clientCode);
                int[] deviceIDs = new int[30];
                for (int i = 0; i < 30; i++)
                {
                    deviceIDs[i] = i + 800000;
                }
                var entity1 = new Entity("ITEE Student");
                var entity2 = new Entity("Law Student");
                var entity3 = new Entity("Science Student");
                var entity4 = new Entity("Student");
                var entity5 = new Entity("Staff Member");
                var entity6 = new Entity("Lecturer");
                var entity7 = new Entity("Course Coordinator");
                var entity8 = new Entity("UQ Person");
                var entity9 = new Entity("Directions");
                var entity10 = new Entity("North");
                var entity11 = new Entity("South");
                var entity12 = new Entity("East");
                var entity13 = new Entity("West");
                entity1.parent = entity4;
                entity2.parent = entity4;
                entity3.parent = entity4;
                entity4.parent = entity8;
                entity5.parent = entity8;
                entity6.parent = entity5;
                entity7.parent = entity5;
                entity10.parent = entity9;
                entity11.parent = entity9;
                entity12.parent = entity9;
                entity13.parent = entity9;
                poll1.entities.Add(entity1);
                poll1.entities.Add(entity2);
                poll1.entities.Add(entity3);
                poll1.entities.Add(entity4);
                poll1.entities.Add(entity5);
                poll1.entities.Add(entity6);
                poll1.entities.Add(entity7);
                poll1.entities.Add(entity8);
                poll4.entities.Add(entity9);
                poll4.entities.Add(entity10);
                poll4.entities.Add(entity11);
                poll4.entities.Add(entity12);
                poll4.entities.Add(entity13);
                poll1.participants.Add(new Participant("0" + deviceIDs[0].ToString("X"), ParticipantType.Web, user1, "Andrew", "Jones"));
                poll1.participants.Add(new Participant("0" + deviceIDs[1].ToString("X"), ParticipantType.Web, user3, "Katrina", "Ng"));
                var group1 = new ParticipantGroup("IT Degree");
                var group2 = new ParticipantGroup("Other Degree");
                poll3.groups.Add(group1);
                poll3.groups.Add(group2);
                session.Save(group1);
                session.Save(group2);
                poll3.participants.Add(new Participant("0" + deviceIDs[0].ToString("X"), ParticipantType.Web, group1, user7, user7.FirstName, user7.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[1].ToString("X"), ParticipantType.Web, group2, user8, user8.FirstName, user8.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[2].ToString("X"), ParticipantType.Web, group1, user9, user9.FirstName, user9.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[3].ToString("X"), ParticipantType.Keypad, group1, "Sharon", "Richardson"));
                poll3.participants.Add(new Participant("0" + deviceIDs[4].ToString("X"), ParticipantType.Web, group1, user11, user11.FirstName, user11.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[5].ToString("X"), ParticipantType.Web, group2, user19, user19.FirstName, user19.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[6].ToString("X"), ParticipantType.Web, group2, user12, user12.FirstName, user12.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[7].ToString("X"), ParticipantType.Web, group2, user14, user14.FirstName, user14.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[8].ToString("X"), ParticipantType.Web, group2, user15, user15.FirstName, user15.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[9].ToString("X"), ParticipantType.Web, group1, user16, user16.FirstName, user16.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[10].ToString("X"), ParticipantType.Web, group1, user17, user17.FirstName, user17.LastName));
                poll3.participants.Add(new Participant("0" + deviceIDs[11].ToString("X"), ParticipantType.Keypad, group1, "Bill", "Ng"));
                poll3.participants.Add(new Participant("0" + deviceIDs[12].ToString("X"), ParticipantType.Keypad, group1, "Jared", "Gates"));
                poll3.participants.Add(new Participant("0" + deviceIDs[13].ToString("X"), ParticipantType.Keypad, group1, "Tom", "Lopez"));
                poll3.participants.Add(new Participant("0" + deviceIDs[14].ToString("X"), ParticipantType.Keypad, group1, "Brad", "Walker"));
                poll3.participants.Add(new Participant("0" + deviceIDs[15].ToString("X"), ParticipantType.Keypad, group1, "Mary", "Radecki"));
                poll3.participants.Add(new Participant("0" + deviceIDs[16].ToString("X"), ParticipantType.Keypad, group1, "Edward", "Lopez"));
                poll3.participants.Add(new Participant("0" + deviceIDs[17].ToString("X"), ParticipantType.Keypad, group1, "Christopher", "Lopez"));
                poll3.participants.Add(new Participant("0" + deviceIDs[18].ToString("X"), ParticipantType.Keypad, group1, "Helen", "Radecki"));
                poll3.participants.Add(new Participant("0" + deviceIDs[19].ToString("X"), ParticipantType.Keypad, group1, "James", "Clark"));
                poll3.participants.Add(new Participant("0" + deviceIDs[20].ToString("X"), ParticipantType.Keypad, group2, "Brad", "Lopez"));
                poll3.participants.Add(new Participant("0" + deviceIDs[21].ToString("X"), ParticipantType.Keypad, group2, "Sandra", "Clark"));
                poll3.participants.Add(new Participant("0" + deviceIDs[22].ToString("X"), ParticipantType.Keypad, group2, "Susan", "Clark"));
                poll3.participants.Add(new Participant("0" + deviceIDs[23].ToString("X"), ParticipantType.Keypad, group2, "Margaret", "Clark"));
                poll3.participants.Add(new Participant("0D2EE2", ParticipantType.Keypad, group2, "Laura", "Clark"));
                poll3.participants.Add(new Participant("0" + deviceIDs[25].ToString("X"), ParticipantType.Keypad, group2, "Bill", "Garcia"));
                poll3.participants.Add(new Participant("0" + deviceIDs[26].ToString("X"), ParticipantType.Keypad, group2, "Ricky", "Garcia"));
                poll3.participants.Add(new Participant("0E5A1A", ParticipantType.Keypad, group2, "Jen", "Radecki"));
                poll3.participants.Add(new Participant("0" + deviceIDs[28].ToString("X"), ParticipantType.Keypad, group1, "Jen", "Radecki"));
                poll3.participants.Add(new Participant("0D2EC1", ParticipantType.Keypad, group1, "Katherine", "Baker"));
                poll1.participants.Add(new Participant("0" + deviceIDs[12].ToString("X"), ParticipantType.Keypad, group1, "Jared", "Gates", entity1));
                poll1.participants.Add(new Participant("0" + deviceIDs[13].ToString("X"), ParticipantType.Keypad, group1, "Tom", "Lopez", entity1));
                poll1.participants.Add(new Participant("0" + deviceIDs[14].ToString("X"), ParticipantType.Keypad, group1, "Brad", "Walker", entity2));
                poll1.participants.Add(new Participant("0" + deviceIDs[15].ToString("X"), ParticipantType.Keypad, group1, "Mary", "Radecki", entity3));
                poll1.participants.Add(new Participant("0" + deviceIDs[16].ToString("X"), ParticipantType.Keypad, group1, "Edward", "Lopez", entity4));
                poll1.participants.Add(new Participant("0" + deviceIDs[17].ToString("X"), ParticipantType.Keypad, group1, "Christopher", "Lopez", entity5));
                poll1.participants.Add(new Participant("0" + deviceIDs[18].ToString("X"), ParticipantType.Keypad, group1, "Helen", "Radecki", entity6));
                poll1.participants.Add(new Participant("0" + deviceIDs[19].ToString("X"), ParticipantType.Keypad, group1, "James", "Clark", entity1));
                poll1.participants.Add(new Participant("0" + deviceIDs[20].ToString("X"), ParticipantType.Keypad, group2, "Brad", "Lopez", entity2));
                poll1.participants.Add(new Participant("0" + deviceIDs[21].ToString("X"), ParticipantType.Keypad, group2, "Sandra", "Clark", entity3));
                poll1.participants.Add(new Participant("0" + deviceIDs[22].ToString("X"), ParticipantType.Keypad, group2, "Susan", "Clark", entity2));
                poll1.participants.Add(new Participant("0" + deviceIDs[23].ToString("X"), ParticipantType.Keypad, group2, "Margaret", "Clark", entity1));
                poll1.participants.Add(new Participant("0D2EE2", ParticipantType.Keypad, group2, "Laura", "Clark", entity1));
                poll1.participants.Add(new Participant("0" + deviceIDs[25].ToString("X"), ParticipantType.Keypad, group2, "Bill", "Garcia", entity1));
                poll1.participants.Add(new Participant("0" + deviceIDs[26].ToString("X"), ParticipantType.Keypad, group2, "Ricky", "Garcia", entity3));
                poll1.participants.Add(new Participant("0E5A1A", ParticipantType.Keypad, group2, "Jen", "Radecki", entity3));
                poll1.participants.Add(new Participant("0" + deviceIDs[28].ToString("X"), ParticipantType.Keypad, group1, "Jen", "Radecki", entity4));
                poll1.participants.Add(new Participant("0D2EC1", ParticipantType.Keypad, group1, "Katherine", "Baker", entity4));
                poll4.participants.Add(new Participant("0D2EE2", ParticipantType.Web, user1, "Andrew", "Jones",entity13));
                poll4.participants.Add(new Participant("0D2E9E", ParticipantType.Keypad, "Table", "1",entity10));
                poll4.participants.Add(new Participant("0D2EB7", ParticipantType.Keypad, "Table", "2",entity11));
                poll4.participants.Add(new Participant("0D2EBD", ParticipantType.Keypad, "Table", "3",entity12));
                poll4.participants.Add(new Participant("0D2EC5", ParticipantType.Keypad, "Table", "4",entity13));
                poll4.participants.Add(new Participant("0D2ED8", ParticipantType.Keypad, "Table", "5",entity10));
                poll4.participants.Add(new Participant("0D2EDE", ParticipantType.Keypad, "Table", "6",entity11));
                poll4.participants.Add(new Participant("0D2EE4", ParticipantType.Keypad, "Table", "7",entity12));
                poll4.participants.Add(new Participant("0D2EED", ParticipantType.Keypad, "Table", "8",entity13));
                poll4.participants.Add(new Participant("0D2EF1", ParticipantType.Keypad, "Table", "9",entity10));
                poll4.participants.Add(new Participant("0D2EF7", ParticipantType.Keypad, "Table", "10",entity11));
                poll4.participants.Add(new Participant("0D2EAA", ParticipantType.Keypad, "Table", "11",entity12));
                String[] gender = { "Male", "Female" };
                String[] age = { "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" };
                String[] tutor = { "Yes", "No" };
                Random random = new Random();
                for (int i = 0; i < 30; i++)
                {
                    poll3.participantFields[0].fieldValues.Add(new ParticipantFieldValue(poll3.participants[i], (i + 1).ToString()));
                    poll3.participantFields[1].fieldValues.Add(new ParticipantFieldValue(poll3.participants[i], gender[random.Next(0, 2)]));
                    poll3.participantFields[2].fieldValues.Add(new ParticipantFieldValue(poll3.participants[i], age[random.Next(0, 13)]));
                    poll3.participantFields[3].fieldValues.Add(new ParticipantFieldValue(poll3.participants[i], tutor[random.Next(0, 2)]));
                }
                foreach (var participant in poll3.participants)
                {
                    session.Save(participant);
                }
                foreach (var participant in poll3.participants)
                {
                    if (random.Next(1, 10) == 3)
                    {
                        participant.attended = false;
                    }
                    else
                    {
                        participant.attended = true;
                    }
                }
                answerCustom(poll3.participants, poll3.questions[0] as MultipleChoiceQuestion, new int[] { 4, 10, 16 });
                answerCustom(poll3.participants, poll3.questions[1] as MultipleChoiceQuestion, new int[] { 4, 20, 3, 3 });
                answerCustom(poll3.participants, poll3.questions[2] as MultipleChoiceQuestion, new int[] { 1, 1, 1, 27 });
                answerCustom(poll3.participants, poll3.questions[3] as MultipleChoiceQuestion, new int[] { 6, 14, 6, 4});
                answerCustom(poll3.participants, poll3.questions[4] as MultipleChoiceQuestion, new int[] { 1, 3, 16, 10 });
                answerCustom(poll3.participants, poll3.questions[5] as MultipleChoiceQuestion, new int[] { 18, 7, 5, 0 });
                answerCustom(poll3.participants, poll3.questions[6] as MultipleChoiceQuestion, new int[] { 1, 1, 26, 0, 2 });
                answerRanking(poll3.participants, poll3.questions[7] as RankingQuestion);
                answerNumeric(poll3.participants, poll3.questions[8] as NumericQuestion, 25);
                answerAlphanumeric(poll3.participants, poll3.questions[9] as AlphanumericQuestion, 22);
                user2.ManagedPolls.Add(poll1);
                user2.ManagedPolls.Add(poll3);
                user2.ManagedPolls.Add(poll1);
                user1.ManagedPolls.Add(poll4);
                user22.ManagedPolls.Add(poll2);
                user1.CreatedPolls.Add(poll1);
                user2.CreatedPolls.Add(poll1);
                user2.CreatedPolls.Add(poll3);
                user23.CreatedPolls.Add(poll2);
                user20.CreatedPolls.Add(poll1);
                poll1.pollMasters.Add(user1);
                poll1.pollMasters.Add(user21);
                poll3.pollMasters.Add(user1);
                poll2.pollMasters.Add(user24);
                poll4.pollMasters.Add(user1);
                session.Save(user1);
                session.Save(user2);
                session.Save(user3);
                session.Save(user4);
                session.Save(user5);
                session.Save(user6);
                session.Save(user7);
                session.Save(user8);
                session.Save(user9);
                session.Save(user10);
                session.Save(user11);
                session.Save(user12);
                session.Save(user13);
                session.Save(user14);
                session.Save(user15);
                session.Save(user16);
                session.Save(user17);
                session.Save(user18);
                session.Save(user19);
                session.Save(user20);
                session.Save(user21);
                session.Save(user22);
                session.Save(user23);
                session.Save(user24);
                session.Save(user25);
                session.Save(user26);
                session.Save(user27);
                session.Save(user28);
                session.Save(user29);
                session.Save(user30);
                session.Save(user31);
                session.Save(user32);
                session.Save(user33);
                session.Save(user34);
                transaction.Commit();
            }
        }
 public void Update(ParticipantGroup p)
 {
     session.SaveOrUpdate(p);
 }
 public IList<Participant> GetParticipantsOfGroup(ParticipantGroup group, Poll poll)
 {
     List<Participant> participants = new List<Participant>();
     foreach (Participant participant in poll.participants)
     {
         if (participant.group == group) participants.Add(participant);
     }
     return participants;
 }
 public Dictionary<String, String> GetGroupDetailsByGroup(ParticipantGroup groups, int pollID)
 {
     var poll = new PollRepository(session).GetPollByID(pollID);
     Dictionary<String, String> groupd = new Dictionary<String, String>();
     groupd.Add("groupID", groups.groupID.ToString());
     groupd.Add("Name", groups.name);
     foreach (var field in poll.participantFields)
     {
         var q = (from p in field.fieldValues where (p.groupd != null && p.groupd.Equals(groups)) select p).ToList<ParticipantFieldValue>();
         if (q.Count() == 0) groupd.Add(field.name, "");
         else groupd.Add(field.name, q.ElementAt(0).value);
     }
     if (groups.entity != null) groupd.Add("Entity", groups.entity.name);
     else groupd.Add("Entity", "");
     return groupd;
 }