Exemple #1
0
        /// <summary>
        /// Gets poll collection
        /// </summary>
        /// <param name="LanguageID">Language identifier. 0 if you want to get all news</param>
        /// <param name="PollCount">Poll count to load. 0 if you want to get all polls</param>
        /// <returns>Poll collection</returns>
        public static PollCollection GetPolls(int LanguageID, int PollCount)
        {
            bool             showHidden   = NopContext.Current.IsAdmin;
            DBPollCollection dbCollection = DBProviderManager <DBPollProvider> .Provider.GetPolls(LanguageID, PollCount, showHidden);

            PollCollection collection = DBMapping(dbCollection);

            return(collection);
        }
        private static PollCollection DBMapping(DBPollCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            PollCollection collection = new PollCollection();
            foreach (DBPoll dbItem in dbCollection)
            {
                Poll item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
Exemple #3
0
        private static PollCollection DBMapping(DBPollCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            PollCollection collection = new PollCollection();

            foreach (DBPoll dbItem in dbCollection)
            {
                Poll item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
Exemple #4
0
        /// <summary>
        /// Gets poll collection
        /// </summary>
        /// <param name="LanguageID">Language identifier. 0 if you want to get all news</param>
        /// <param name="PollCount">Poll count to load. 0 if you want to get all polls</param>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Poll collection</returns>
        public override DBPollCollection GetPolls(int LanguageID, int PollCount, bool showHidden)
        {
            DBPollCollection pollCollection = new DBPollCollection();
            Database         db             = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand        dbCommand      = db.GetStoredProcCommand("Nop_PollLoadAll");

            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            db.AddInParameter(dbCommand, "PollCount", DbType.Int32, PollCount);
            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBPoll poll = GetPollFromReader(dataReader);
                    pollCollection.Add(poll);
                }
            }

            return(pollCollection);
        }
        /// <summary>
        /// Gets poll collection
        /// </summary>
        /// <param name="LanguageID">Language identifier. 0 if you want to get all news</param>
        /// <param name="PollCount">Poll count to load. 0 if you want to get all polls</param>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Poll collection</returns>
        public override DBPollCollection GetPolls(int LanguageID, int PollCount, bool showHidden)
        {
            DBPollCollection pollCollection = new DBPollCollection();
            Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PollLoadAll");
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            db.AddInParameter(dbCommand, "PollCount", DbType.Int32, PollCount);
            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBPoll poll = GetPollFromReader(dataReader);
                    pollCollection.Add(poll);
                }
            }

            return pollCollection;
        }