Пример #1
0
        private DBPoll GetPollFromReader(IDataReader dataReader)
        {
            var item = new DBPoll();

            item.PollId        = NopSqlDataHelper.GetInt(dataReader, "PollID");
            item.LanguageId    = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            item.Name          = NopSqlDataHelper.GetString(dataReader, "Name");
            item.SystemKeyword = NopSqlDataHelper.GetString(dataReader, "SystemKeyword");
            item.Published     = NopSqlDataHelper.GetBoolean(dataReader, "Published");
            item.DisplayOrder  = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            return(item);
        }
Пример #2
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);
        }
Пример #3
0
        /// <summary>
        /// Gets a poll
        /// </summary>
        /// <param name="SystemKeyword">Poll system keyword</param>
        /// <returns>Poll</returns>
        public override DBPoll GetPollBySystemKeyword(string SystemKeyword)
        {
            DBPoll    poll      = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PollLoadBySystemKeyword");

            db.AddInParameter(dbCommand, "SystemKeyword", DbType.String, SystemKeyword);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    poll = GetPollFromReader(dataReader);
                }
            }
            return(poll);
        }
Пример #4
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 override DBPoll UpdatePoll(int PollID, int LanguageID, string Name,
                                          string SystemKeyword, bool Published, int DisplayOrder)
        {
            DBPoll    poll      = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PollUpdate");

            db.AddInParameter(dbCommand, "PollID", DbType.Int32, PollID);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            db.AddInParameter(dbCommand, "Name", DbType.String, Name);
            db.AddInParameter(dbCommand, "SystemKeyword", DbType.String, SystemKeyword);
            db.AddInParameter(dbCommand, "Published", DbType.Boolean, Published);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                poll = GetPollByID(PollID);
            }

            return(poll);
        }
Пример #5
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);
        }
Пример #6
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 override DBPoll UpdatePoll(int pollId, int languageId, string name,
                                          string systemKeyword, bool published, int displayOrder)
        {
            DBPoll    item      = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PollUpdate");

            db.AddInParameter(dbCommand, "PollID", DbType.Int32, pollId);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "SystemKeyword", DbType.String, systemKeyword);
            db.AddInParameter(dbCommand, "Published", DbType.Boolean, published);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, displayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetPollById(pollId);
            }

            return(item);
        }
Пример #7
0
        /// <summary>
        /// Gets a poll
        /// </summary>
        /// <param name="PollID">The poll identifier</param>
        /// <returns>Poll</returns>
        public override DBPoll GetPollByID(int PollID)
        {
            DBPoll poll = null;

            if (PollID == 0)
            {
                return(poll);
            }
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PollLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "PollID", DbType.Int32, PollID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    poll = GetPollFromReader(dataReader);
                }
            }
            return(poll);
        }