public OptionResponse(Participant participant) { this.responseID = -1; this.participant = participant; this.rank = -1; this.responseTime = DateTime.Now; }
public OptionResponse(int responseID, Participant participant, int rank) { this.responseID = responseID; this.participant = participant; this.rank = rank; this.responseTime = DateTime.Now; }
public ParticipantFieldValue(int fieldValueID, Participant participant, String value) { this.fieldValueID = fieldValueID; this.participant = participant; this.value = value; this.groupd = null; }
public IList<Poll> GetPollContainingParticipant(Participant participant) { var poll = (from item in session.Query<Poll>() where item.participants.Contains(participant) select item).ToList(); return poll; }
public ParticipantFieldValue(Participant participant) { this.fieldValueID = -1; this.participant = participant; this.value = String.Empty; this.groupd = null; }
public String points(Participant participant) { var questionRepository = new QuestionRepository(NHibernateHelper.GetCurrentSession()); double points=0; double total = 0; IList<Question> multip = poll.questions.Where(m => m.type != QuestionType.Alphanumeric && m.type != QuestionType.Numeric).ToList(); IList<MultipleChoiceQuestion> multi = new List<MultipleChoiceQuestion>(); foreach (Question multipl in multip) multi.Add(questionRepository.GetQuestionByID<MultipleChoiceQuestion>(multipl.questionID)); foreach (MultipleChoiceQuestion ques in multi) { foreach (QuestionOption option in ques.options) { total += option.pointsCurrent; foreach (OptionResponse res in option.responses) if (res.participant == participant) points += option.pointsCurrent; } } return points + "/" + total; }
public int participating(Participant participant) { var questionRepository = new QuestionRepository(NHibernateHelper.GetCurrentSession()); IList<Question> shortre = poll.questions.Where(m => m.type == QuestionType.Alphanumeric || m.type == QuestionType.Numeric).ToList(); IList<Question> multip = poll.questions.Where(m => m.type != QuestionType.Alphanumeric && m.type != QuestionType.Numeric).ToList(); IList<ShortResponseQuestion> shortr = new List<ShortResponseQuestion>(); IList<MultipleChoiceQuestion> multi = new List<MultipleChoiceQuestion>(); foreach (Question shorty in shortre) shortr.Add(questionRepository.GetQuestionByID<ShortResponseQuestion>(shorty.questionID)); foreach (Question multipl in multip) multi.Add(questionRepository.GetQuestionByID<MultipleChoiceQuestion>(multipl.questionID)); int total = shortr.Count() + multi.Count(); int answered = 0; foreach (ShortResponseQuestion ques in shortr) foreach (ShortResponse res in ques.responses) if (res.participant == participant) answered++; foreach (MultipleChoiceQuestion ques in multi) { bool breaking = false; foreach (QuestionOption option in ques.options) { foreach (OptionResponse res in option.responses) if (res.participant == participant) { answered++; breaking = true; break; } if (breaking) break; } } return answered; }
public string participated(Participant participant) { return Math.Round((participating(participant) * 100.00 / poll.questions.Count()),2)+"%"; }
public ShortResponse(int responseID, Participant participant, String response) { this.responseID = responseID; this.participant = participant; this.response = response; }
public ShortResponse(Participant participant, String response) { this.responseID = -1; this.participant = participant; this.response = response; }
public ShortResponse(Participant participant) { this.responseID = -1; this.participant = participant; this.response = String.Empty; }
public void Update(Participant p) { session.SaveOrUpdate(p); }
public Feedback(int feedbackID, String comment, Participant providedBy) { this.feedbackID = feedbackID; this.comment = comment; this.providedBy = providedBy; }
public Boolean AddKeypadUser(String deviceID, int pollID) { var poll = pollRepository.GetPollByID(pollID); if (deviceID == null || deviceID == String.Empty) { return false; } if (poll.participants.Where(m => m.deviceID == deviceID).Count() > 0) { return false; } var participant = new Participant(deviceID, ParticipantType.Keypad, String.Empty, String.Empty); poll.participants.Add(participant); pollRepository.UpdatePoll(poll); return true; }
public Boolean AddTestParticipant(String deviceID, int pollID) { var poll = pollRepository.GetPollByID(pollID); var user = userRepository.GetUserByUsername(User.Identity.Name); var participant = new Participant(deviceID, ParticipantType.Keypad, user, user.FirstName, user.LastName); participant.isTestParticipant = true; if (poll.participants.Where(m => m.deviceID == deviceID).Count<Participant>() > 0) { return false; } if (poll.participants.Any(p => p.linkedUser != null && p.linkedUser.Equals(user))) return false; poll.participants.Add(participant); pollRepository.UpdatePoll(poll); return true; }