コード例 #1
0
        /// <summary>
        /// Returns a Poll object with the specified ID
        /// </summary>
        public static Poll GetPollByID(int pollID)
        {
            Poll   poll = null;
            string key  = "Polls_Poll_" + pollID.ToString();

            if (BasePoll.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                poll = (Poll)BizObject.Cache[key];
            }
            else
            {
                poll = GetPollFromPollDetails(SiteProvider.Polls.GetPollByID(pollID));
                BasePoll.CacheData(key, poll);
            }
            return(poll);
        }
コード例 #2
0
        /// <summary>
        /// Returns a Option object with the specified ID
        /// </summary>
        public static Option GetOptionByID(int optionID)
        {
            Option option = null;
            string key    = "Polls_Option_" + optionID.ToString();

            if (BasePoll.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                option = (Option)BizObject.Cache[key];
            }
            else
            {
                option = GetOptionFromPollOptionDetails(SiteProvider.Polls.GetOptionByID(optionID));
                BasePoll.CacheData(key, option);
            }
            return(option);
        }
コード例 #3
0
        /***********************************
         * Static methods
         ************************************/

        /// <summary>
        /// Returns a collection with all options for the specified poll
        /// </summary>
        public static List <Option> GetOptions(int pollID)
        {
            List <Option> options = null;
            string        key     = "Polls_Options_" + pollID;

            if (BasePoll.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                options = (List <Option>)BizObject.Cache[key];
            }
            else
            {
                List <PollOptionDetails> recordset = SiteProvider.Polls.GetOptions(pollID);
                options = GetOptionListFromPollOptionDetailsList(recordset);
                BasePoll.CacheData(key, options);
            }
            return(options);
        }
コード例 #4
0
        public static List <Poll> GetPolls(bool includeActive, bool includeArchived)
        {
            List <Poll> polls = null;
            string      key   = "Polls_Polls_" + includeActive.ToString() + "_" + includeArchived.ToString();

            if (BasePoll.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                polls = (List <Poll>)BizObject.Cache[key];
            }
            else
            {
                List <PollDetails> recordset = SiteProvider.Polls.GetPolls(includeActive, includeArchived);
                polls = GetPollListFromPollDetailsList(recordset);
                BasePoll.CacheData(key, polls);
            }
            return(polls);
        }