private static PollAnswerCollection DBMapping(DBPollAnswerCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            PollAnswerCollection collection = new PollAnswerCollection();
            foreach (DBPollAnswer dbItem in dbCollection)
            {
                PollAnswer item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
Beispiel #2
0
        private static PollAnswerCollection DBMapping(DBPollAnswerCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            PollAnswerCollection collection = new PollAnswerCollection();

            foreach (DBPollAnswer dbItem in dbCollection)
            {
                PollAnswer item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
Beispiel #3
0
        /// <summary>
        /// Gets a poll answers by poll identifier
        /// </summary>
        /// <param name="PollID">Poll identifier</param>
        /// <returns>Poll answer collection</returns>
        public override DBPollAnswerCollection GetPollAnswersByPollID(int PollID)
        {
            DBPollAnswerCollection pollAnswerCollection = new DBPollAnswerCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PollAnswerLoadByPollID");

            db.AddInParameter(dbCommand, "PollID", DbType.Int32, PollID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBPollAnswer pollAnswer = GetPollAnswerFromReader(dataReader);
                    pollAnswerCollection.Add(pollAnswer);
                }
            }

            return(pollAnswerCollection);
        }
Beispiel #4
0
        /// <summary>
        /// Gets a poll answers by poll identifier
        /// </summary>
        /// <param name="pollId">Poll identifier</param>
        /// <returns>Poll answer collection</returns>
        public override DBPollAnswerCollection GetPollAnswersByPollId(int pollId)
        {
            var       result    = new DBPollAnswerCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PollAnswerLoadByPollID");

            db.AddInParameter(dbCommand, "PollID", DbType.Int32, pollId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    var item = GetPollAnswerFromReader(dataReader);
                    result.Add(item);
                }
            }

            return(result);
        }
Beispiel #5
0
        /// <summary>
        /// Gets a poll answers by poll identifier
        /// </summary>
        /// <param name="PollID">Poll identifier</param>
        /// <returns>Poll answer collection</returns>
        public static PollAnswerCollection GetPollAnswersByPollID(int PollID)
        {
            string key  = string.Format(POLLANSWERS_BY_POLLID_KEY, PollID);
            object obj2 = NopCache.Get(key);

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

            DBPollAnswerCollection dbCollection = DBProviderManager <DBPollProvider> .Provider.GetPollAnswersByPollID(PollID);

            PollAnswerCollection pollAnswerCollection = DBMapping(dbCollection);

            if (PollManager.CacheEnabled)
            {
                NopCache.Max(key, pollAnswerCollection);
            }
            return(pollAnswerCollection);
        }
        /// <summary>
        /// Gets a poll answers by poll identifier
        /// </summary>
        /// <param name="PollID">Poll identifier</param>
        /// <returns>Poll answer collection</returns>
        public override DBPollAnswerCollection GetPollAnswersByPollID(int PollID)
        {
            DBPollAnswerCollection pollAnswerCollection = new DBPollAnswerCollection();
            Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PollAnswerLoadByPollID");
            db.AddInParameter(dbCommand, "PollID", DbType.Int32, PollID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBPollAnswer pollAnswer = GetPollAnswerFromReader(dataReader);
                    pollAnswerCollection.Add(pollAnswer);
                }
            }

            return pollAnswerCollection;
        }