Пример #1
0
        /// <summary>
        /// Saves the current voter progress and his answers to the database
        /// </summary>
        public void SaveVoterProgress(VoterAnswersData voterAnswers)
        {
            IVoter           voter = VoterFactory.Create();
            VoterAnswersData data  = new VoterAnswersData();

            data.Merge(voterAnswers, false);
            voter.AddVoter(data);
        }
Пример #2
0
        /// <summary>
        /// Returns all the answers of the voters
        /// </summary>
        public NSurveyVoter GetForExport(int surveyId, DateTime startDate, DateTime endDate)
        {
            NSurveyVoter voter2 = VoterFactory.Create().GetForExport(surveyId, startDate, endDate);

            foreach (NSurveyVoter.QuestionRow row in voter2.Question)
            {
                row.QuestionText = Regex.Replace(row.QuestionText, "<[^>]*>", " ");
            }
            return(voter2);
        }
Пример #3
0
        /// <summary>
        /// Get voter's answers and voter details
        /// </summary>
        /// <param name="voterId"></param>
        /// <returns>voterAnswers</returns>
        public VoterAnswersData GetVoterAnswers(int voterId)
        {
            VoterAnswersData voterAnswers = VoterFactory.Create().GetVoterAnswers(voterId);

            if (voterAnswers.Voters.Rows.Count == 0)
            {
                throw new VoterNotFoundException();
            }
            return(voterAnswers);
        }
Пример #4
0
        /// <summary>
        /// Get the voter's data and answers to resume a session
        /// </summary>
        public VoterAnswersData ResumeVoterAnswers(int surveyId, string resumeUid)
        {
            VoterAnswersData data = VoterFactory.Create().ResumeVoterAnswers(surveyId, resumeUid);

            if (data.Voters.Rows.Count == 0)
            {
                return(null);
            }
            return(data);
        }
Пример #5
0
        /// <summary>
        /// Queue an invitation request for a future voter and
        /// returns the generate UID
        /// </summary>
        public string GenerateVoterInvitationUId(int surveyId, string email, bool anonymousEntry)
        {
            string emailUId = new Voters().GetEmailUId(surveyId, email);

            if (emailUId == null)
            {
                emailUId = this.GenerateUId();
                VoterFactory.Create().AddVoterInvitation(surveyId, email, anonymousEntry, emailUId);
            }
            return(emailUId);
        }
Пример #6
0
 /// <summary>
 /// Get voter's statistics for the given month and year
 /// </summary>
 public VoterStatisticsData GetMonthlyStats(int surveyId, int month, int year)
 {
     return(VoterFactory.Create().GetMonthlyStats(surveyId, month, year));
 }
Пример #7
0
 /// <summary>
 /// Get number of voters for the given date
 /// </summary>
 public int GetDayStats(int surveyId, DateTime statDay)
 {
     return(VoterFactory.Create().GetDayStats(surveyId, statDay));
 }
Пример #8
0
 /// <summary>
 /// Checks if the given UID has already been registered
 /// </summary>
 /// <returns></returns>
 public bool CheckIfVoterUIdExists(int surveyId, string uId)
 {
     return(VoterFactory.Create().CheckIfVoterUIdExists(surveyId, uId));
 }
Пример #9
0
 /// <summary>
 /// Returns all the text entries of the voters
 /// </summary>
 /// <param name="surveyId"></param>
 /// <param name="pageNumber"></param>
 /// <param name="pageSize"></param>
 /// <param name="startDate"></param>
 /// <param name="endDate"></param>
 /// <returns></returns>
 public DataSet GetVotersTextEntries(int surveyId, int pageNumber, int pageSize, DateTime startDate, DateTime endDate)
 {
     return(VoterFactory.Create().GetVotersTextEntries(surveyId, pageNumber, pageSize, startDate, endDate));
 }
Пример #10
0
 /// <summary>
 /// Deletes all unvalidated entries
 /// </summary>
 public void DeleteUnvalidatedVoters(int surveyId)
 {
     VoterFactory.Create().DeleteUnvalidatedVoters(surveyId);
 }
Пример #11
0
 /// <summary>
 /// Deletes the log of the invitation
 /// </summary>
 /// <param name="invitationLogId"></param>
 public void DeleteInvitationLog(int invitationLogId)
 {
     VoterFactory.Create().DeleteInvitationLog(invitationLogId);
 }
Пример #12
0
 public void ImportVoter(int surveyId, NSurveyVoter importVoter)
 {
     VoterFactory.Create().ImportVoter(surveyId, importVoter);
 }
Пример #13
0
 public void UpdateVoterADInfo(int surveyId, int voterId, VoterADInfo user)
 {
     VoterFactory.Create().UpdateVoterADInfo(surveyId, voterId, user);
 }
Пример #14
0
 /// <summary>
 /// Update the asp.net username of the voter
 /// </summary>
 public void UpdateVoterUserName(int voterId, string userName)
 {
     VoterFactory.Create().UpdateVoterUserName(voterId, userName);
 }
Пример #15
0
 /// <summary>
 /// Updates voter's answer
 /// </summary>
 /// <param name="voterAnswers">Voter and all his answers information</param>
 public void UpdateVoter(VoterAnswersData updatedVoterAnswers)
 {
     VoterFactory.Create().UpdateVoter(updatedVoterAnswers);
 }
Пример #16
0
 /// <summary>
 /// Set the give uid to the voter
 /// </summary>
 public void SetVoterUId(int voterId, string uId)
 {
     VoterFactory.Create().SetVoterUId(voterId, uId);
 }
Пример #17
0
 /// <summary>
 /// Returns all voters who have answered an invitation
 /// </summary>
 public VoterData GetVotersInvitationAnswered(int surveyId, int pageNumber, int pageSize, out int totalRecords)
 {
     return(VoterFactory.Create().GetVotersInvitationAnswered(surveyId, pageNumber, pageSize, out totalRecords));
 }
Пример #18
0
 /// <summary>
 /// Delete all answer a voter gave for the survey
 /// </summary>
 public void DeleteVoterAnswers(int voterId)
 {
     VoterFactory.Create().DeleteVoterAnswers(voterId);
 }
Пример #19
0
 /// <summary>
 /// Check if the username has already taken the survey
 /// </summary>
 public bool HasUserNameVoted(int surveyId, string userName)
 {
     return(VoterFactory.Create().HasUserNameVoted(surveyId, userName));
 }
Пример #20
0
 /// <summary>
 /// Delete a voter and all its answers
 /// </summary>
 /// <param name="voterId"></param>
 /// <returns></returns>
 public void DeleteVoterById(int voterId)
 {
     VoterFactory.Create().DeleteVoterById(voterId);
 }
Пример #21
0
 /// <summary>
 /// Checks if the given IP has already been registered
 /// in the expiration time lapse
 /// </summary>
 /// <param name="surveyId"></param>
 /// <param name="voterIP"></param>
 /// <param name="IPExpires"></param>
 /// <returns></returns>
 public bool CheckIfVoterIPExists(int surveyId, string voterIP)
 {
     return(VoterFactory.Create().CheckIfVoterIPExists(surveyId, voterIP));
 }
Пример #22
0
 /// <summary>
 /// Deletes the email from the survey invitation queue
 /// </summary>
 /// <param name="surveyId"></param>
 /// <param name="emailId"></param>
 public void DeleteVoterInvitation(int surveyId, int emailId)
 {
     VoterFactory.Create().DeleteVoterInvitation(surveyId, emailId);
 }
Пример #23
0
 /// <summary>
 /// Returns a CSV formatted string with all voters answers
 /// </summary>
 public CSVExportData GetCSVExport(int surveyId, DateTime startDate, DateTime endDate)
 {
     return(VoterFactory.Create().GetForCSVExport(surveyId, startDate, endDate));
 }
Пример #24
0
 /// <summary>
 /// Deletes the email from the survey invitation queue
 /// </summary>
 /// <param name="surveyId"></param>
 /// <param name="emailId"></param>
 public void DeleteVoterInvitation(int surveyId, string email)
 {
     VoterFactory.Create().DeleteVoterInvitation(surveyId, email);
 }
Пример #25
0
 /// <summary>
 /// returns the guid from the queue for the given email and survey id
 /// </summary>
 public string GetEmailUId(int surveyId, string email)
 {
     return(VoterFactory.Create().GetEmailUId(surveyId, email));
 }
Пример #26
0
 /// <summary>
 /// Delete all answer a voter gave for the page
 /// </summary>
 public void DeleteVoterPageAnswers(int surveyId, int voterId, int pageNumber)
 {
     VoterFactory.Create().DeleteVoterPageAnswers(surveyId, voterId, pageNumber);
 }
Пример #27
0
 /// <summary>
 /// Returns all the logged message during a mailing
 /// </summary>
 public InvitationLogData GetInvitationLogs(int surveyId, int pageNumber, int pageSize, out int totalRecords)
 {
     return(VoterFactory.Create().GetInvitationLogs(surveyId, pageNumber, pageSize, out totalRecords));
 }
Пример #28
0
 /// <summary>
 /// Delete all answer a voter gave for the question
 /// </summary>
 public void DeleteVoterQuestionAnswers(int voterId, int questionId)
 {
     VoterFactory.Create().DeleteVoterQuestionAnswers(voterId, questionId);
 }
Пример #29
0
 /// <summary>
 /// returns the number of unvalidated entries (saved progress)
 /// </summary>
 public int GetUnvalidatedVotersCount(int surveyId)
 {
     return(VoterFactory.Create().GetUnvalidatedVotersCount(surveyId));
 }
Пример #30
0
 /// <summary>
 /// Deletes a voter resume session
 /// from the database
 /// </summary>
 public void DeleteVoterResumeSession(int surveyId, string resumeUId)
 {
     VoterFactory.Create().DeleteVoterResumeSession(surveyId, resumeUId);
 }