コード例 #1
0
        private DBSpecificationAttributeOptionLocalized GetSpecificationAttributeOptionLocalizedFromReader(IDataReader dataReader)
        {
            var item = new DBSpecificationAttributeOptionLocalized();

            item.SpecificationAttributeOptionLocalizedId = NopSqlDataHelper.GetInt(dataReader, "SpecificationAttributeOptionLocalizedID");
            item.SpecificationAttributeOptionId          = NopSqlDataHelper.GetInt(dataReader, "SpecificationAttributeOptionID");
            item.LanguageId = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            item.Name       = NopSqlDataHelper.GetString(dataReader, "Name");
            return(item);
        }
コード例 #2
0
        /// <summary>
        /// Gets localized specification attribute option by specification attribute option id and language id
        /// </summary>
        /// <param name="specificationAttributeOptionId">Specification attribute option identifier</param>
        /// <param name="languageId">Language identifier</param>
        /// <returns>Localized specification attribute option</returns>
        public override DBSpecificationAttributeOptionLocalized GetSpecificationAttributeOptionLocalizedBySpecificationAttributeOptionIdAndLanguageId(int specificationAttributeOptionId, int languageId)
        {
            DBSpecificationAttributeOptionLocalized item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_SpecificationAttributeOptionLocalizedLoadBySpecificationAttributeOptionIDAndLanguageID");

            db.AddInParameter(dbCommand, "SpecificationAttributeOptionID", DbType.Int32, specificationAttributeOptionId);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetSpecificationAttributeOptionLocalizedFromReader(dataReader);
                }
            }
            return(item);
        }
コード例 #3
0
        /// <summary>
        /// Update a localized specification attribute option
        /// </summary>
        /// <param name="specificationAttributeOptionLocalizedId">Localized specification attribute option identifier</param>
        /// <param name="specificationAttributeOptionId">Specification attribute option identifier</param>
        /// <param name="languageId">Language identifier</param>
        /// <param name="name">Name text</param>
        /// <returns>Localized specification attribute option</returns>
        public override DBSpecificationAttributeOptionLocalized UpdateSpecificationAttributeOptionLocalized(int specificationAttributeOptionLocalizedId,
                                                                                                            int specificationAttributeOptionId, int languageId, string name)
        {
            DBSpecificationAttributeOptionLocalized item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_SpecificationAttributeOptionLocalizedUpdate");

            db.AddInParameter(dbCommand, "SpecificationAttributeOptionLocalizedID", DbType.Int32, specificationAttributeOptionLocalizedId);
            db.AddInParameter(dbCommand, "SpecificationAttributeOptionID", DbType.Int32, specificationAttributeOptionId);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetSpecificationAttributeOptionLocalizedById(specificationAttributeOptionLocalizedId);
            }

            return(item);
        }