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>
        /// <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;
        }