Exemple #1
0
        public bool CopyToNewPoll(out Poll newPoll)
        {
            newPoll = new Poll();
            newPoll.AllowViewingResultsBeforeVoting = allowViewingResultsBeforeVoting;
            newPoll.AnonymousVoting = anonymousVoting;
            newPoll.Question = question;
            newPoll.ShowOrderNumbers = showOrderNumbers;
            newPoll.ShowResultsWhenDeactivated = showResultsWhenDeactivated;
            newPoll.SiteGuid = siteGuid;

            bool result = newPoll.Save();

            if (result)
            {
                PollOption option;
                List<PollOption> pollOptions = PollOption.GetOptionsByPollGuid(pollGuid);
                foreach (PollOption optionToCopy in pollOptions)
                {
                    option = new PollOption();
                    option.Answer = optionToCopy.Answer;
                    option.Order = optionToCopy.Order;
                    option.PollGuid = newPoll.PollGuid;
                    option.Save();
                }
            }

            return result;
        }