private DBMessageTemplate GetMessageTemplateFromReader(IDataReader dataReader)
        {
            var item = new DBMessageTemplate();

            item.MessageTemplateId = NopSqlDataHelper.GetInt(dataReader, "MessageTemplateID");
            item.Name = NopSqlDataHelper.GetString(dataReader, "Name");
            return(item);
        }
Esempio n. 2
0
        private DBMessageTemplate GetMessageTemplateFromReader(IDataReader dataReader)
        {
            DBMessageTemplate messageTemplate = new DBMessageTemplate();

            messageTemplate.MessageTemplateID = NopSqlDataHelper.GetInt(dataReader, "MessageTemplateID");
            messageTemplate.Name = NopSqlDataHelper.GetString(dataReader, "Name");
            return(messageTemplate);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets all message templates
        /// </summary>
        /// <returns>Message template collection</returns>
        public override DBMessageTemplateCollection GetAllMessageTemplates()
        {
            DBMessageTemplateCollection messageTemplateCollection = new DBMessageTemplateCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_MessageTemplateLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBMessageTemplate messageTemplate = GetMessageTemplateFromReader(dataReader);
                    messageTemplateCollection.Add(messageTemplate);
                }
            }
            return(messageTemplateCollection);
        }
        /// <summary>
        /// Gets a message template by template identifier
        /// </summary>
        /// <param name="messageTemplateId">Message template identifier</param>
        /// <returns>Message template</returns>
        public override DBMessageTemplate GetMessageTemplateById(int messageTemplateId)
        {
            DBMessageTemplate item = null;

            if (messageTemplateId == 0)
            {
                return(item);
            }
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_MessageTemplateLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "MessageTemplateID", DbType.Int32, messageTemplateId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetMessageTemplateFromReader(dataReader);
                }
            }
            return(item);
        }