Beispiel #1
0
        /// <summary>
        /// Gets a tax category
        /// </summary>
        /// <param name="TaxCategoryID">Tax category identifier</param>
        /// <returns>Tax category</returns>
        public static TaxCategory GetTaxCategoryByID(int TaxCategoryID)
        {
            if (TaxCategoryID == 0)
            {
                return(null);
            }

            string key  = string.Format(TAXCATEGORIES_BY_ID_KEY, TaxCategoryID);
            object obj2 = NopCache.Get(key);

            if (TaxCategoryManager.CacheEnabled && (obj2 != null))
            {
                return((TaxCategory)obj2);
            }

            DBTaxCategory dbItem = DBProviderManager <DBTaxCategoryProvider> .Provider.GetTaxCategoryByID(TaxCategoryID);

            TaxCategory taxCategory = DBMapping(dbItem);

            if (TaxCategoryManager.CacheEnabled)
            {
                NopCache.Max(key, taxCategory);
            }
            return(taxCategory);
        }
 private DBTaxCategory GetTaxCategoryFromReader(IDataReader dataReader)
 {
     DBTaxCategory taxCategory = new DBTaxCategory();
     taxCategory.TaxCategoryID = NopSqlDataHelper.GetInt(dataReader, "TaxCategoryID");
     taxCategory.Name = NopSqlDataHelper.GetString(dataReader, "Name");
     taxCategory.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
     taxCategory.CreatedOn = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
     taxCategory.UpdatedOn = NopSqlDataHelper.GetUtcDateTime(dataReader, "UpdatedOn");
     return taxCategory;
 }
        private static TaxCategory DBMapping(DBTaxCategory dbItem)
        {
            if (dbItem == null)
                return null;

            TaxCategory item = new TaxCategory();
            item.TaxCategoryID = dbItem.TaxCategoryID;
            item.Name = dbItem.Name;
            item.DisplayOrder = dbItem.DisplayOrder;
            item.CreatedOn = dbItem.CreatedOn;
            item.UpdatedOn = dbItem.UpdatedOn;

            return item;
        }
Beispiel #4
0
        private static TaxCategory DBMapping(DBTaxCategory dbItem)
        {
            if (dbItem == null)
            {
                return(null);
            }

            TaxCategory item = new TaxCategory();

            item.TaxCategoryID = dbItem.TaxCategoryID;
            item.Name          = dbItem.Name;
            item.DisplayOrder  = dbItem.DisplayOrder;
            item.CreatedOn     = dbItem.CreatedOn;
            item.UpdatedOn     = dbItem.UpdatedOn;

            return(item);
        }
Beispiel #5
0
        /// <summary>
        /// Updates the tax category
        /// </summary>
        /// <param name="TaxCategoryID">The tax category identifier</param>
        /// <param name="Name">The name</param>
        /// <param name="DisplayOrder">The display order</param>
        /// <param name="CreatedOn">The date and time of instance creation</param>
        /// <param name="UpdatedOn">The date and time of instance update</param>
        /// <returns>Tax category</returns>
        public static TaxCategory UpdateTaxCategory(int TaxCategoryID, string Name,
                                                    int DisplayOrder, DateTime CreatedOn, DateTime UpdatedOn)
        {
            CreatedOn = DateTimeHelper.ConvertToUtcTime(CreatedOn);
            UpdatedOn = DateTimeHelper.ConvertToUtcTime(UpdatedOn);

            DBTaxCategory dbItem = DBProviderManager <DBTaxCategoryProvider> .Provider.UpdateTaxCategory(TaxCategoryID, Name,
                                                                                                         DisplayOrder, CreatedOn, UpdatedOn);

            TaxCategory taxCategory = DBMapping(dbItem);

            if (TaxCategoryManager.CacheEnabled)
            {
                NopCache.RemoveByPattern(TAXCATEGORIES_PATTERN_KEY);
            }
            return(taxCategory);
        }