Example #1
0
        /// <summary>
        /// Updates the localized topic
        /// </summary>
        /// <param name="topicLocalizedId">The localized topic identifier</param>
        /// <param name="topicId">The topic identifier</param>
        /// <param name="languageId">The language identifier</param>
        /// <param name="title">The title</param>
        /// <param name="body">The body</param>
        /// <param name="createdOn">The date and time of instance creation</param>
        /// <param name="updatedOn">The date and time of instance update</param>
        /// <param name="metaKeywords">The meta keywords</param>
        /// <param name="metaDescription">The meta description</param>
        /// <param name="metaTitle">The meta title</param>
        /// <returns>Localized topic</returns>
        public override DBLocalizedTopic UpdateLocalizedTopic(int topicLocalizedId,
                                                              int topicId, int languageId, string title, string body,
                                                              DateTime createdOn, DateTime updatedOn,
                                                              string metaKeywords, string metaDescription, string metaTitle)
        {
            DBLocalizedTopic item      = null;
            Database         db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand        dbCommand = db.GetStoredProcCommand("Nop_TopicLocalizedUpdate");

            db.AddInParameter(dbCommand, "TopicLocalizedID", DbType.Int32, topicLocalizedId);
            db.AddInParameter(dbCommand, "TopicID", DbType.Int32, topicId);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            db.AddInParameter(dbCommand, "Title", DbType.String, title);
            db.AddInParameter(dbCommand, "Body", DbType.String, body);
            db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, createdOn);
            db.AddInParameter(dbCommand, "UpdatedOn", DbType.DateTime, updatedOn);
            db.AddInParameter(dbCommand, "MetaKeywords", DbType.String, metaKeywords);
            db.AddInParameter(dbCommand, "MetaDescription", DbType.String, metaDescription);
            db.AddInParameter(dbCommand, "MetaTitle", DbType.String, metaTitle);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetLocalizedTopicById(topicLocalizedId);
            }

            return(item);
        }
        private DBLocalizedTopic GetLocalizedTopicFromReader(IDataReader dataReader)
        {
            DBLocalizedTopic localizedTopic = new DBLocalizedTopic();

            localizedTopic.TopicLocalizedID = NopSqlDataHelper.GetInt(dataReader, "TopicLocalizedID");
            localizedTopic.TopicID          = NopSqlDataHelper.GetInt(dataReader, "TopicID");
            localizedTopic.LanguageID       = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            localizedTopic.Title            = NopSqlDataHelper.GetString(dataReader, "Title");
            localizedTopic.Body             = NopSqlDataHelper.GetString(dataReader, "Body");
            localizedTopic.CreatedOn        = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
            localizedTopic.UpdatedOn        = NopSqlDataHelper.GetUtcDateTime(dataReader, "UpdatedOn");
            localizedTopic.ShowOnHomePage   = NopSqlDataHelper.GetInt(dataReader, "ShowOnHomePage");
            return(localizedTopic);
        }
Example #3
0
        private DBLocalizedTopic GetLocalizedTopicFromReader(IDataReader dataReader)
        {
            var item = new DBLocalizedTopic();

            item.TopicLocalizedId = NopSqlDataHelper.GetInt(dataReader, "TopicLocalizedID");
            item.TopicId          = NopSqlDataHelper.GetInt(dataReader, "TopicID");
            item.LanguageId       = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            item.Title            = NopSqlDataHelper.GetString(dataReader, "Title");
            item.Body             = NopSqlDataHelper.GetString(dataReader, "Body");
            item.CreatedOn        = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
            item.UpdatedOn        = NopSqlDataHelper.GetUtcDateTime(dataReader, "UpdatedOn");
            item.MetaDescription  = NopSqlDataHelper.GetString(dataReader, "MetaDescription");
            item.MetaKeywords     = NopSqlDataHelper.GetString(dataReader, "MetaKeywords");
            item.MetaTitle        = NopSqlDataHelper.GetString(dataReader, "MetaTitle");
            return(item);
        }
        /// <summary>
        /// Gets all topics shows on the home page
        /// </summary>
        /// <returns>Localized topic collection</returns>
        public override DBLocalizedTopicCollection TopicLocalizedLoadAllOnHomePage()
        {
            DBLocalizedTopicCollection localizedTopics = new DBLocalizedTopicCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_TopicLocalizedLoadAllOnHomePage");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBLocalizedTopic localizedTopic = GetLocalizedTopicFromReader(dataReader);
                    localizedTopics.Add(localizedTopic);
                }
            }
            return(localizedTopics);
        }
Example #5
0
        /// <summary>
        /// Gets a localized topic by name and language identifier
        /// </summary>
        /// <param name="name">Topic name</param>
        /// <param name="languageId">Language identifier</param>
        /// <returns>Localized topic</returns>
        public override DBLocalizedTopic GetLocalizedTopic(string name, int languageId)
        {
            DBLocalizedTopic item      = null;
            Database         db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand        dbCommand = db.GetStoredProcCommand("Nop_TopicLocalizedLoadByNameAndLanguageID");

            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetLocalizedTopicFromReader(dataReader);
                }
            }
            return(item);
        }
        /// <summary>
        /// Gets all localized topics
        /// </summary>
        /// <param name="TopicName">Topic name</param>
        /// <returns>Localized topic collection</returns>
        public override DBLocalizedTopicCollection GetAllLocalizedTopics(string TopicName)
        {
            DBLocalizedTopicCollection localizedTopics = new DBLocalizedTopicCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_TopicLocalizedLoadAllByName");

            db.AddInParameter(dbCommand, "Name", DbType.String, TopicName);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBLocalizedTopic localizedTopic = GetLocalizedTopicFromReader(dataReader);
                    localizedTopics.Add(localizedTopic);
                }
            }
            return(localizedTopics);
        }
        /// <summary>
        /// Gets a localized topic by parent TopicID and language identifier
        /// </summary>
        /// <param name="TopicID">The topic identifier</param>
        /// <param name="LanguageID">Language identifier</param>
        /// <returns>Localized topic</returns>
        public override DBLocalizedTopic GetLocalizedTopic(int TopicID, int LanguageID)
        {
            DBLocalizedTopic localizedTopic = null;
            Database         db             = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand        dbCommand      = db.GetStoredProcCommand("Nop_TopicLocalizedLoadByTopicIDAndLanguageID");

            db.AddInParameter(dbCommand, "TopicID", DbType.Int32, TopicID);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    localizedTopic = GetLocalizedTopicFromReader(dataReader);
                }
            }
            return(localizedTopic);
        }
Example #8
0
        /// <summary>
        /// Gets a localized topic by identifier
        /// </summary>
        /// <param name="localizedTopicId">Localized topic identifier</param>
        /// <returns>Localized topic</returns>
        public override DBLocalizedTopic GetLocalizedTopicById(int localizedTopicId)
        {
            DBLocalizedTopic item = null;

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

            db.AddInParameter(dbCommand, "TopicLocalizedID", DbType.Int32, localizedTopicId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetLocalizedTopicFromReader(dataReader);
                }
            }
            return(item);
        }
        /// <summary>
        /// Updates the localized topic
        /// </summary>
        /// <param name="TopicLocalizedID">The localized topic identifier</param>
        /// <param name="TopicID">The topic identifier</param>
        /// <param name="LanguageID">The language identifier</param>
        /// <param name="Title">The title</param>
        /// <param name="Body">The body</param>
        /// <param name="CreatedOn">The date and time of instance creation</param>
        /// <param name="UpdatedOn">The date and time of instance update</param>
        /// <param name="ShowOnHomePage">The state of showing topic on the main page</param>
        /// <returns>Localized topic</returns>
        public override DBLocalizedTopic UpdateLocalizedTopic(int TopicLocalizedID,
                                                              int TopicID, int LanguageID,
                                                              string Title, string Body,
                                                              DateTime CreatedOn, DateTime UpdatedOn, int ShowOnHomePage)
        {
            DBLocalizedTopic localizedTopic = null;
            Database         db             = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand        dbCommand      = db.GetStoredProcCommand("Nop_TopicLocalizedUpdate");

            db.AddInParameter(dbCommand, "TopicLocalizedID", DbType.Int32, TopicLocalizedID);
            db.AddInParameter(dbCommand, "TopicID", DbType.Int32, TopicID);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            db.AddInParameter(dbCommand, "Title", DbType.String, Title);
            db.AddInParameter(dbCommand, "Body", DbType.String, Body);
            db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, CreatedOn);
            db.AddInParameter(dbCommand, "UpdatedOn", DbType.DateTime, UpdatedOn);
            db.AddInParameter(dbCommand, "ShowOnHomePage", DbType.Int32, ShowOnHomePage);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                localizedTopic = GetLocalizedTopicByID(TopicLocalizedID);
            }

            return(localizedTopic);
        }