private DBLocaleStringResource GetLocaleStringResourceFromReader(IDataReader dataReader)
 {
     DBLocaleStringResource localeStringResource = new DBLocaleStringResource();
     localeStringResource.LocaleStringResourceID = NopSqlDataHelper.GetInt(dataReader, "LocaleStringResourceID");
     localeStringResource.LanguageID = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
     localeStringResource.ResourceName = NopSqlDataHelper.GetString(dataReader, "ResourceName");
     localeStringResource.ResourceValue = NopSqlDataHelper.GetString(dataReader, "ResourceValue");
     return localeStringResource;
 }
Beispiel #2
0
        private DBLocaleStringResource GetLocaleStringResourceFromReader(IDataReader dataReader)
        {
            DBLocaleStringResource localeStringResource = new DBLocaleStringResource();

            localeStringResource.LocaleStringResourceID = NopSqlDataHelper.GetInt(dataReader, "LocaleStringResourceID");
            localeStringResource.LanguageID             = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            localeStringResource.ResourceName           = NopSqlDataHelper.GetString(dataReader, "ResourceName");
            localeStringResource.ResourceValue          = NopSqlDataHelper.GetString(dataReader, "ResourceValue");
            return(localeStringResource);
        }
        private DBLocaleStringResource GetLocaleStringResourceFromReader(IDataReader dataReader)
        {
            var item = new DBLocaleStringResource();

            item.LocaleStringResourceId = NopSqlDataHelper.GetInt(dataReader, "LocaleStringResourceID");
            item.LanguageId             = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            item.ResourceName           = NopSqlDataHelper.GetString(dataReader, "ResourceName");
            item.ResourceValue          = NopSqlDataHelper.GetString(dataReader, "ResourceValue");
            return(item);
        }
Beispiel #4
0
        /// <summary>
        /// Gets a locale string resource
        /// </summary>
        /// <param name="LocaleStringResourceID">Locale string resource identifier</param>
        /// <returns>Locale string resource</returns>
        public override DBLocaleStringResource GetLocaleStringResourceByID(int LocaleStringResourceID)
        {
            DBLocaleStringResource localeStringResource = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_LocaleStringResourceLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "LocaleStringResourceID", DbType.Int32, LocaleStringResourceID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    localeStringResource = GetLocaleStringResourceFromReader(dataReader);
                }
            }
            return(localeStringResource);
        }
Beispiel #5
0
        /// <summary>
        /// Updates the locale string resource
        /// </summary>
        /// <param name="LocaleStringResourceID">The locale string resource identifier</param>
        /// <param name="LanguageID">The language identifier</param>
        /// <param name="ResourceName">The resource name</param>
        /// <param name="ResourceValue">The resource value</param>
        /// <returns>Locale string resource</returns>
        public override DBLocaleStringResource UpdateLocaleStringResource(int LocaleStringResourceID, int LanguageID, string ResourceName, string ResourceValue)
        {
            DBLocaleStringResource localeStringResource = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_LocaleStringResourceUpdate");

            db.AddInParameter(dbCommand, "LocaleStringResourceID", DbType.Int32, LocaleStringResourceID);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            db.AddInParameter(dbCommand, "ResourceName", DbType.String, ResourceName);
            db.AddInParameter(dbCommand, "ResourceValue", DbType.String, ResourceValue);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                localeStringResource = GetLocaleStringResourceByID(LocaleStringResourceID);
            }

            return(localeStringResource);
        }
Beispiel #6
0
        /// <summary>
        /// Gets all locale string resources by language identifier
        /// </summary>
        /// <param name="LanguageID">Language identifier</param>
        /// <returns>Locale string resource collection</returns>
        public override DBLocaleStringResourceCollection GetAllResourcesByLanguageID(int LanguageID)
        {
            DBLocaleStringResourceCollection localeStringResourceCollection = new DBLocaleStringResourceCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_LocaleStringResourceLoadAllByLanguageID");

            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBLocaleStringResource localeStringResource = GetLocaleStringResourceFromReader(dataReader);
                    localeStringResourceCollection.Add(localeStringResource);
                }
            }

            return(localeStringResourceCollection);
        }
        /// <summary>
        /// Inserts a locale string resource
        /// </summary>
        /// <param name="languageId">The language identifier</param>
        /// <param name="resourceName">The resource name</param>
        /// <param name="resourceValue">The resource value</param>
        /// <returns>Locale string resource</returns>
        public override DBLocaleStringResource InsertLocaleStringResource(int languageId,
                                                                          string resourceName, string resourceValue)
        {
            DBLocaleStringResource item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_LocaleStringResourceInsert");

            db.AddOutParameter(dbCommand, "LocaleStringResourceID", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            db.AddInParameter(dbCommand, "ResourceName", DbType.String, resourceName);
            db.AddInParameter(dbCommand, "ResourceValue", DbType.String, resourceValue);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                int localeStringResourceId = Convert.ToInt32(db.GetParameterValue(dbCommand, "@LocaleStringResourceID"));
                item = GetLocaleStringResourceById(localeStringResourceId);
            }
            return(item);
        }