コード例 #1
0
        /// <summary>
        /// Gets the name of the category.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns>
        /// The get category name.
        /// </returns>
        protected string GetCategoryName(int id)
        {
            const string Type       = "Category";
            const string PrimaryKey = "CategoryID";
            const string NameField  = "Name";

            DataRow row = this.GetDataRowFromCache(Type, id);

            if (row == null)
            {
                // get the section desired...
                DataTable list = LegacyDb.category_simplelist(this.LowRange(id), this.CacheSize);

                // set it up in the cache
                row = this.SetupDataToCache(ref list, Type, id, PrimaryKey);

                if (row == null)
                {
                    return(string.Empty);
                }
            }

            return(CleanStringForURL(row[NameField].ToString()));
        }