Beispiel #1
0
        private DBLocalizedMessageTemplate GetLocalizedMessageTemplateFromReader(IDataReader dataReader)
        {
            DBLocalizedMessageTemplate localizedMessageTemplate = new DBLocalizedMessageTemplate();

            localizedMessageTemplate.MessageTemplateLocalizedID = NopSqlDataHelper.GetInt(dataReader, "MessageTemplateLocalizedID");
            localizedMessageTemplate.MessageTemplateID          = NopSqlDataHelper.GetInt(dataReader, "MessageTemplateID");
            localizedMessageTemplate.LanguageID = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            localizedMessageTemplate.Subject    = NopSqlDataHelper.GetString(dataReader, "Subject");
            localizedMessageTemplate.Body       = NopSqlDataHelper.GetString(dataReader, "Body");
            return(localizedMessageTemplate);
        }
        private DBLocalizedMessageTemplate GetLocalizedMessageTemplateFromReader(IDataReader dataReader)
        {
            var item = new DBLocalizedMessageTemplate();

            item.MessageTemplateLocalizedId = NopSqlDataHelper.GetInt(dataReader, "MessageTemplateLocalizedID");
            item.MessageTemplateId          = NopSqlDataHelper.GetInt(dataReader, "MessageTemplateID");
            item.LanguageId        = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            item.BccEmailAddresses = NopSqlDataHelper.GetString(dataReader, "BCCEmailAddresses");
            item.Subject           = NopSqlDataHelper.GetString(dataReader, "Subject");
            item.Body     = NopSqlDataHelper.GetString(dataReader, "Body");
            item.IsActive = NopSqlDataHelper.GetBoolean(dataReader, "IsActive");
            return(item);
        }
Beispiel #3
0
        /// <summary>
        /// Gets all localized message templates
        /// </summary>
        /// <param name="MessageTemplatesName">Message template name</param>
        /// <returns>Localized message template collection</returns>
        public override DBLocalizedMessageTemplateCollection GetAllLocalizedMessageTemplates(string MessageTemplatesName)
        {
            DBLocalizedMessageTemplateCollection localizedMessageTemplates = new DBLocalizedMessageTemplateCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_MessageTemplateLocalizedLoadAllByName");

            db.AddInParameter(dbCommand, "Name", DbType.String, MessageTemplatesName);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBLocalizedMessageTemplate localizedMessageTemplate = GetLocalizedMessageTemplateFromReader(dataReader);
                    localizedMessageTemplates.Add(localizedMessageTemplate);
                }
            }
            return(localizedMessageTemplates);
        }
Beispiel #4
0
        /// <summary>
        /// Gets a localized message template by name and language identifier
        /// </summary>
        /// <param name="Name">Message template name</param>
        /// <param name="LanguageID">Language identifier</param>
        /// <returns>Localized message template</returns>
        public override DBLocalizedMessageTemplate GetLocalizedMessageTemplate(string Name, int LanguageID)
        {
            DBLocalizedMessageTemplate localizedMessageTemplate = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_MessageTemplateLocalizedLoadByNameAndLanguageID");

            db.AddInParameter(dbCommand, "Name", DbType.String, Name);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    localizedMessageTemplate = GetLocalizedMessageTemplateFromReader(dataReader);
                }
            }
            return(localizedMessageTemplate);
        }
Beispiel #5
0
        /// <summary>
        /// Inserts a localized message template
        /// </summary>
        /// <param name="MessageTemplateID">The message template identifier</param>
        /// <param name="LanguageID">The language identifier</param>
        /// <param name="Subject">The subject</param>
        /// <param name="Body">The body</param>
        /// <returns>Localized message template</returns>
        public override DBLocalizedMessageTemplate InsertLocalizedMessageTemplate(int MessageTemplateID,
                                                                                  int LanguageID, string Subject, string Body)
        {
            DBLocalizedMessageTemplate localizedMessageTemplate = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_MessageTemplateLocalizedInsert");

            db.AddOutParameter(dbCommand, "MessageTemplateLocalizedID", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "MessageTemplateID", DbType.Int32, MessageTemplateID);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            db.AddInParameter(dbCommand, "Subject", DbType.String, Subject);
            db.AddInParameter(dbCommand, "Body", DbType.String, Body);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                int MessageTemplateLocalizedID = Convert.ToInt32(db.GetParameterValue(dbCommand, "@MessageTemplateLocalizedID"));
                localizedMessageTemplate = GetLocalizedMessageTemplateByID(MessageTemplateLocalizedID);
            }
            return(localizedMessageTemplate);
        }
        /// <summary>
        /// Inserts a localized message template
        /// </summary>
        /// <param name="messageTemplateId">The message template identifier</param>
        /// <param name="languageId">The language identifier</param>
        /// <param name="bccEmailAddresses">The BCC Email addresses</param>
        /// <param name="subject">The subject</param>
        /// <param name="body">The body</param>
        /// <param name="isActive">A value indicating whether the message template is active</param>
        /// <returns>Localized message template</returns>
        public override DBLocalizedMessageTemplate InsertLocalizedMessageTemplate(int messageTemplateId,
                                                                                  int languageId, string bccEmailAddresses, string subject, string body, bool isActive)
        {
            DBLocalizedMessageTemplate item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_MessageTemplateLocalizedInsert");

            db.AddOutParameter(dbCommand, "MessageTemplateLocalizedID", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "MessageTemplateID", DbType.Int32, messageTemplateId);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            db.AddInParameter(dbCommand, "BCCEmailAddresses", DbType.String, bccEmailAddresses);
            db.AddInParameter(dbCommand, "Subject", DbType.String, subject);
            db.AddInParameter(dbCommand, "Body", DbType.String, body);
            db.AddInParameter(dbCommand, "IsActive", DbType.Boolean, isActive);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                int messageTemplateLocalizedId = Convert.ToInt32(db.GetParameterValue(dbCommand, "@MessageTemplateLocalizedID"));
                item = GetLocalizedMessageTemplateById(messageTemplateLocalizedId);
            }
            return(item);
        }
        /// <summary>
        /// Gets a localized message template by identifier
        /// </summary>
        /// <param name="localizedMessageTemplateId">Localized message template identifier</param>
        /// <returns>Localized message template</returns>
        public override DBLocalizedMessageTemplate GetLocalizedMessageTemplateById(int localizedMessageTemplateId)
        {
            DBLocalizedMessageTemplate item = null;

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

            db.AddInParameter(dbCommand, "MessageTemplateLocalizedID", DbType.Int32, localizedMessageTemplateId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetLocalizedMessageTemplateFromReader(dataReader);
                }
            }
            return(item);
        }