Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 10
0
 /// <summary>
 /// Deletes all unvalidated entries
 /// </summary>
 public void DeleteUnvalidatedVoters(int surveyId)
 {
     VoterFactory.Create().DeleteUnvalidatedVoters(surveyId);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Deletes the log of the invitation
 /// </summary>
 /// <param name="invitationLogId"></param>
 public void DeleteInvitationLog(int invitationLogId)
 {
     VoterFactory.Create().DeleteInvitationLog(invitationLogId);
 }
Exemplo n.º 12
0
 public void ImportVoter(int surveyId, NSurveyVoter importVoter)
 {
     VoterFactory.Create().ImportVoter(surveyId, importVoter);
 }
Exemplo n.º 13
0
 public void UpdateVoterADInfo(int surveyId, int voterId, VoterADInfo user)
 {
     VoterFactory.Create().UpdateVoterADInfo(surveyId, voterId, user);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Update the asp.net username of the voter
 /// </summary>
 public void UpdateVoterUserName(int voterId, string userName)
 {
     VoterFactory.Create().UpdateVoterUserName(voterId, userName);
 }
Exemplo n.º 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);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Set the give uid to the voter
 /// </summary>
 public void SetVoterUId(int voterId, string uId)
 {
     VoterFactory.Create().SetVoterUId(voterId, uId);
 }
Exemplo n.º 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));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Delete all answer a voter gave for the survey
 /// </summary>
 public void DeleteVoterAnswers(int voterId)
 {
     VoterFactory.Create().DeleteVoterAnswers(voterId);
 }
Exemplo n.º 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));
 }
Exemplo n.º 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);
 }
Exemplo n.º 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));
 }
Exemplo n.º 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);
 }
Exemplo n.º 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));
 }
Exemplo n.º 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);
 }
Exemplo n.º 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));
 }
Exemplo n.º 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);
 }
Exemplo n.º 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));
 }
Exemplo n.º 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);
 }
Exemplo n.º 29
0
 /// <summary>
 /// returns the number of unvalidated entries (saved progress)
 /// </summary>
 public int GetUnvalidatedVotersCount(int surveyId)
 {
     return(VoterFactory.Create().GetUnvalidatedVotersCount(surveyId));
 }
Exemplo n.º 30
0
 /// <summary>
 /// Deletes a voter resume session
 /// from the database
 /// </summary>
 public void DeleteVoterResumeSession(int surveyId, string resumeUId)
 {
     VoterFactory.Create().DeleteVoterResumeSession(surveyId, resumeUId);
 }