/// <summary>
        /// Gets a manufacturer template
        /// </summary>
        /// <param name="ManufacturerTemplateID">Manufacturer template identifier</param>
        /// <returns>Manufacturer template</returns>
        public static ManufacturerTemplate GetManufacturerTemplateByID(int ManufacturerTemplateID)
        {
            if (ManufacturerTemplateID == 0)
            {
                return(null);
            }

            string key  = string.Format(MANUFACTURERTEMPLATES_BY_ID_KEY, ManufacturerTemplateID);
            object obj2 = NopCache.Get(key);

            if (TemplateManager.CacheEnabled && (obj2 != null))
            {
                return((ManufacturerTemplate)obj2);
            }

            DBManufacturerTemplate dbItem = DBProviderManager <DBTemplateProvider> .Provider.GetManufacturerTemplateByID(ManufacturerTemplateID);

            ManufacturerTemplate manufacturerTemplate = DBMapping(dbItem);

            if (TemplateManager.CacheEnabled)
            {
                NopCache.Max(key, manufacturerTemplate);
            }
            return(manufacturerTemplate);
        }
 private DBManufacturerTemplate GetManufacturerTemplateFromReader(IDataReader dataReader)
 {
     DBManufacturerTemplate manufacturerTemplate = new DBManufacturerTemplate();
     manufacturerTemplate.ManufacturerTemplateID = NopSqlDataHelper.GetInt(dataReader, "ManufacturerTemplateID");
     manufacturerTemplate.Name = NopSqlDataHelper.GetString(dataReader, "Name");
     manufacturerTemplate.TemplatePath = NopSqlDataHelper.GetString(dataReader, "TemplatePath");
     manufacturerTemplate.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
     manufacturerTemplate.CreatedOn = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
     manufacturerTemplate.UpdatedOn = NopSqlDataHelper.GetUtcDateTime(dataReader, "UpdatedOn");
     return manufacturerTemplate;
 }
        /// <summary>
        /// Updates the manufacturer template
        /// </summary>
        /// <param name="ManufacturerTemplateID">Manufacturer template identifer</param>
        /// <param name="Name">The manufacturer template identifier</param>
        /// <param name="TemplatePath">The template path</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>Manufacturer template</returns>
        public static ManufacturerTemplate UpdateManufacturerTemplate(int ManufacturerTemplateID, string Name, string TemplatePath,
                                                                      int DisplayOrder, DateTime CreatedOn, DateTime UpdatedOn)
        {
            CreatedOn = DateTimeHelper.ConvertToUtcTime(CreatedOn);
            UpdatedOn = DateTimeHelper.ConvertToUtcTime(UpdatedOn);

            DBManufacturerTemplate dbItem = DBProviderManager <DBTemplateProvider> .Provider.UpdateManufacturerTemplate(ManufacturerTemplateID,
                                                                                                                        Name, TemplatePath, DisplayOrder, CreatedOn, UpdatedOn);

            ManufacturerTemplate manufacturerTemplate = DBMapping(dbItem);

            if (TemplateManager.CacheEnabled)
            {
                NopCache.RemoveByPattern(MANUFACTURERTEMPLATES_PATTERN_KEY);
            }
            return(manufacturerTemplate);
        }
Example #4
0
        private static ManufacturerTemplate DBMapping(DBManufacturerTemplate dbItem)
        {
            if (dbItem == null)
            {
                return(null);
            }

            var item = new ManufacturerTemplate();

            item.ManufacturerTemplateId = dbItem.ManufacturerTemplateId;
            item.Name         = dbItem.Name;
            item.TemplatePath = dbItem.TemplatePath;
            item.DisplayOrder = dbItem.DisplayOrder;
            item.CreatedOn    = dbItem.CreatedOn;
            item.UpdatedOn    = dbItem.UpdatedOn;

            return(item);
        }