예제 #1
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
 private void GetPoll(int moduleID)
 {
     using (IDataReader reader = DBPoll.GetPollByModuleID(moduleID))
     {
         GetPoll(reader);
     }
 }
예제 #2
0
        /// <summary>
        /// Gets a poll
        /// </summary>
        /// <param name="PollID">The poll identifier</param>
        /// <returns>Poll</returns>
        public static Poll GetPollByID(int PollID)
        {
            if (PollID == 0)
            {
                return(null);
            }

            string key  = string.Format(POLLS_BY_ID_KEY, PollID);
            object obj2 = NopCache.Get(key);

            if (PollManager.CacheEnabled && (obj2 != null))
            {
                return((Poll)obj2);
            }

            DBPoll dbItem = DBProviderManager <DBPollProvider> .Provider.GetPollByID(PollID);

            Poll poll = DBMapping(dbItem);

            if (PollManager.CacheEnabled)
            {
                NopCache.Max(key, poll);
            }
            return(poll);
        }
예제 #3
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
 private void GetPoll(Guid pollGuid)
 {
     using (IDataReader reader = DBPoll.GetPoll(pollGuid))
     {
         GetPoll(reader);
     }
 }
예제 #4
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
        public bool UserHasVoted(SiteUser user)
        {
            if (user == null) return false;
            //if (anonymousVoting) return false;

            return DBPoll.UserHasVoted(pollGuid, user.UserGuid);
        }
예제 #5
0
 public static IDataReader GetPollsByUser(Guid userGuid)
 {
     if (userGuid == Guid.Empty)
     {
         return(null);
     }
     return(DBPoll.GetPollsByUserGuid(userGuid));
 }
예제 #6
0
        /// <summary>
        /// Gets a poll
        /// </summary>
        /// <param name="SystemKeyword">The poll system keyword</param>
        /// <returns>Poll</returns>
        public static Poll GetPollBySystemKeyword(string SystemKeyword)
        {
            DBPoll dbItem = DBProviderManager <DBPollProvider> .Provider.GetPollBySystemKeyword(SystemKeyword);

            Poll poll = DBMapping(dbItem);

            return(poll);
        }
예제 #7
0
 public bool ClearVotes()
 {
     if (totalVotes <= 0)
     {
         return(true);                 // always correct?
     }
     return(DBPoll.ClearVotes(pollGuid));
 }
예제 #8
0
        public bool Delete()
        {
            if (pollGuid == Guid.Empty)
            {
                return(false);
            }

            return(DBPoll.Delete(pollGuid));
        }
예제 #9
0
 private DBPoll GetPollFromReader(IDataReader dataReader)
 {
     DBPoll poll = new DBPoll();
     poll.PollID = NopSqlDataHelper.GetInt(dataReader, "PollID");
     poll.LanguageID = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
     poll.Name = NopSqlDataHelper.GetString(dataReader, "Name");
     poll.SystemKeyword = NopSqlDataHelper.GetString(dataReader, "SystemKeyword");
     poll.Published = NopSqlDataHelper.GetBoolean(dataReader, "Published");
     poll.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
     return poll;
 }
예제 #10
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
 private bool Update()
 {
     return DBPoll.Update(
         this.pollGuid,
         this.question,
         this.anonymousVoting,
         this.allowViewingResultsBeforeVoting,
         this.showOrderNumbers,
         this.showResultsWhenDeactivated,
         this.activated,
         this.activeFrom,
         this.activeTo);
 }
예제 #11
0
        private static Poll DBMapping(DBPoll dbItem)
        {
            if (dbItem == null)
                return null;

            Poll item = new Poll();
            item.PollID = dbItem.PollID;
            item.LanguageID = dbItem.LanguageID;
            item.Name = dbItem.Name;
            item.SystemKeyword = dbItem.SystemKeyword;
            item.Published = dbItem.Published;
            item.DisplayOrder = dbItem.DisplayOrder;

            return item;
        }
예제 #12
0
        /// <summary>
        /// Updates the poll
        /// </summary>
        /// <param name="PollID">The poll identifier</param>
        /// <param name="LanguageID">The language identifier</param>
        /// <param name="Name">The name</param>
        /// <param name="SystemKeyword">The system keyword</param>
        /// <param name="Published">A value indicating whether the entity is published</param>
        /// <param name="DisplayOrder">The display order</param>
        /// <returns>Poll</returns>
        public static Poll UpdatePoll(int PollID, int LanguageID, string Name, string SystemKeyword,
                                      bool Published, int DisplayOrder)
        {
            DBPoll dbItem = DBProviderManager <DBPollProvider> .Provider.UpdatePoll(PollID, LanguageID, Name,
                                                                                    SystemKeyword, Published, DisplayOrder);

            Poll poll = DBMapping(dbItem);

            if (PollManager.CacheEnabled)
            {
                NopCache.RemoveByPattern(POLLS_PATTERN_KEY);
                NopCache.RemoveByPattern(POLLANSWERS_PATTERN_KEY);
            }

            return(poll);
        }
예제 #13
0
        private static Poll DBMapping(DBPoll dbItem)
        {
            if (dbItem == null)
            {
                return(null);
            }

            Poll item = new Poll();

            item.PollID        = dbItem.PollID;
            item.LanguageID    = dbItem.LanguageID;
            item.Name          = dbItem.Name;
            item.SystemKeyword = dbItem.SystemKeyword;
            item.Published     = dbItem.Published;
            item.DisplayOrder  = dbItem.DisplayOrder;

            return(item);
        }
예제 #14
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
        private bool Create()
        {
            pollGuid = newPollGuid;

            int rowsAffected = DBPoll.Add(
                this.pollGuid,
                this.siteGuid,
                this.question,
                this.anonymousVoting,
                this.allowViewingResultsBeforeVoting,
                this.showOrderNumbers,
                this.showResultsWhenDeactivated,
                this.activated,
                this.activeFrom,
                this.activeTo);

            return (rowsAffected > 0);
        }
예제 #15
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
 public bool AddToModule(int moduleID)
 {
     return DBPoll.AddToModule(pollGuid, moduleID);
 }
예제 #16
0
 public static IDataReader GetPolls(Guid siteGuid)
 {
     return(DBPoll.GetPolls(siteGuid));
 }
예제 #17
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
 public static bool DeleteBySite(int siteId)
 {
     return DBPoll.DeleteBySite(siteId);
 }
예제 #18
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
 public static bool RemoveFromModule(int moduleID)
 {
     return DBPoll.RemoveFromModule(moduleID);
 }
예제 #19
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
 public static IDataReader GetPollsByUser(Guid userGuid)
 {
     if (userGuid == Guid.Empty) return null;
     return DBPoll.GetPollsByUserGuid(userGuid);
 }
예제 #20
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
 public static IDataReader GetActivePolls(Guid siteGuid)
 {
     return DBPoll.GetActivePolls(siteGuid);
 }
예제 #21
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
        public bool ClearVotes()
        {
            if (totalVotes <= 0) return true; // always correct?

            return DBPoll.ClearVotes(pollGuid);
        }
예제 #22
0
파일: Poll.cs 프로젝트: zahedbri/mojoportal
        public bool Delete()
        {
            if (pollGuid == Guid.Empty) return false;

            return DBPoll.Delete(pollGuid);
        }