Beispiel #1
0
        private DBLanguage GetLanguageFromReader(IDataReader dataReader)
        {
            DBLanguage language = new DBLanguage();

            language.LanguageID      = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            language.Name            = NopSqlDataHelper.GetString(dataReader, "Name");
            language.LanguageCulture = NopSqlDataHelper.GetString(dataReader, "LanguageCulture");
            language.Published       = NopSqlDataHelper.GetBoolean(dataReader, "Published");
            language.DisplayOrder    = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            return(language);
        }
        private DBLanguage GetLanguageFromReader(IDataReader dataReader)
        {
            var item = new DBLanguage();

            item.LanguageId        = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            item.Name              = NopSqlDataHelper.GetString(dataReader, "Name");
            item.LanguageCulture   = NopSqlDataHelper.GetString(dataReader, "LanguageCulture");
            item.FlagImageFileName = NopSqlDataHelper.GetString(dataReader, "FlagImageFileName");
            item.Published         = NopSqlDataHelper.GetBoolean(dataReader, "Published");
            item.DisplayOrder      = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            return(item);
        }
        private static Language DBMapping(DBLanguage dbItem)
        {
            if (dbItem == null)
                return null;

            Language item = new Language();
            item.LanguageID = dbItem.LanguageID;
            item.Name = dbItem.Name;
            item.LanguageCulture = dbItem.LanguageCulture;
            item.Published = dbItem.Published;
            item.DisplayOrder = dbItem.DisplayOrder;

            return item;
        }
Beispiel #4
0
        /// <summary>
        /// Gets all languages
        /// </summary>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Language collection</returns>
        public override DBLanguageCollection GetAllLanguages(bool showHidden)
        {
            DBLanguageCollection languageCollection = new DBLanguageCollection();
            Database             db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand            dbCommand = db.GetStoredProcCommand("Nop_LanguageLoadAll");

            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBLanguage language = GetLanguageFromReader(dataReader);
                    languageCollection.Add(language);
                }
            }
            return(languageCollection);
        }
Beispiel #5
0
        /// <summary>
        /// Updates a language
        /// </summary>
        /// <param name="LanguageID">Language identifier</param>
        /// <param name="Name">The name</param>
        /// <param name="LanguageCulture">The language culture</param>
        /// <param name="Published">A value indicating whether the language is published</param>
        /// <param name="DisplayOrder">The display order</param>
        /// <returns>Language</returns>
        public override DBLanguage UpdateLanguage(int LanguageID, string Name, string LanguageCulture, bool Published, int DisplayOrder)
        {
            DBLanguage language  = null;
            Database   db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand  dbCommand = db.GetStoredProcCommand("Nop_LanguageUpdate");

            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            db.AddInParameter(dbCommand, "Name", DbType.String, Name);
            db.AddInParameter(dbCommand, "LanguageCulture", DbType.String, LanguageCulture);
            db.AddInParameter(dbCommand, "Published", DbType.Boolean, Published);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                language = GetLanguageByID(LanguageID);
            }

            return(language);
        }
        /// <summary>
        /// Updates a language
        /// </summary>
        /// <param name="languageId">Language identifier</param>
        /// <param name="name">The name</param>
        /// <param name="languageCulture">The language culture</param>
        /// <param name="flagImageFileName">The flag image file name</param>
        /// <param name="published">A value indicating whether the language is published</param>
        /// <param name="displayOrder">The display order</param>
        /// <returns>Language</returns>
        public override DBLanguage UpdateLanguage(int languageId,
                                                  string name, string languageCulture,
                                                  string flagImageFileName, bool published, int displayOrder)
        {
            DBLanguage item      = null;
            Database   db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand  dbCommand = db.GetStoredProcCommand("Nop_LanguageUpdate");

            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "LanguageCulture", DbType.String, languageCulture);
            db.AddInParameter(dbCommand, "FlagImageFileName", DbType.String, flagImageFileName);
            db.AddInParameter(dbCommand, "Published", DbType.Boolean, published);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, displayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetLanguageById(languageId);
            }

            return(item);
        }
Beispiel #7
0
        /// <summary>
        /// Gets a language
        /// </summary>
        /// <param name="LanguageID">Language identifier</param>
        /// <returns>Language</returns>
        public override DBLanguage GetLanguageByID(int LanguageID)
        {
            DBLanguage language = null;

            if (LanguageID == 0)
            {
                return(language);
            }
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_LanguageLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    language = GetLanguageFromReader(dataReader);
                }
            }

            return(language);
        }