/// <summary> /// Get formatted catalogues breadcrumb /// Note: ACL and store mapping is ignored /// </summary> /// <param name="catalogues">Catalogues</param> /// <param name="cataloguesService">Catalogues service</param> /// <param name="separator">Separator</param> /// <param name="languageId">Language identifier for localization</param> /// <returns>Formatted breadcrumb</returns> public static string GetFormattedBreadCrumb(this Catalogues catalogues, ICataloguesService cataloguesService, string separator = ">>", int languageId = 0) { if (catalogues == null) { throw new ArgumentNullException("catalogues"); } string result = string.Empty; //used to prevent circular references var alreadyProcessedCatalogueIds = new List <int>(); while (catalogues != null && //not null !catalogues.Deleted && //not deleted !alreadyProcessedCatalogueIds.Contains(catalogues.Id)) //prevent circular references { var cataloguesName = catalogues.GetLocalized(x => x.Name, languageId); if (String.IsNullOrEmpty(result)) { result = cataloguesName; } else { result = string.Format("{0} {1} {2}", cataloguesName, separator, result); } alreadyProcessedCatalogueIds.Add(catalogues.Id); catalogues = cataloguesService.GetCatalogueById(catalogues.ParentCatalogueId); } return(result); }
/// <summary> /// Get formatted catalogues breadcrumb /// Note: ACL and store mapping is ignored /// </summary> /// <param name="catalogues">Catalogues</param> /// <param name="cataloguesService">Catalogues service</param> /// <param name="separator">Separator</param> /// <param name="languageId">Language identifier for localization</param> /// <returns>Formatted breadcrumb</returns> public static string GetFormattedBreadCrumb(this Catalogues catalogues, ICataloguesService cataloguesService, string separator = ">>", int languageId = 0) { if (catalogues == null) throw new ArgumentNullException("catalogues"); string result = string.Empty; //used to prevent circular references var alreadyProcessedCatalogueIds = new List<int>(); while (catalogues != null && //not null !catalogues.Deleted && //not deleted !alreadyProcessedCatalogueIds.Contains(catalogues.Id)) //prevent circular references { var cataloguesName = catalogues.GetLocalized(x => x.Name, languageId); if (String.IsNullOrEmpty(result)) { result = cataloguesName; } else { result = string.Format("{0} {1} {2}", cataloguesName, separator, result); } alreadyProcessedCatalogueIds.Add(catalogues.Id); catalogues = cataloguesService.GetCatalogueById(catalogues.ParentCatalogueId); } return result; }
/// <summary> /// Get catalogues breadcrumb /// </summary> /// <param name="catalogues">Catalogues</param> /// <param name="cataloguesService">Catalogues service</param> /// <param name="aclService">ACL service</param> /// <param name="storeMappingService">Store mapping service</param> /// <param name="showHidden">A value indicating whether to load hidden records</param> /// <returns>Catalogues breadcrumb </returns> public static IList <Catalogues> GetCataloguesBreadCrumb(this Catalogues catalogues, ICataloguesService cataloguesService, IAclService aclService, IStoreMappingService storeMappingService, bool showHidden = false) { if (catalogues == null) { throw new ArgumentNullException("catalogues"); } var result = new List <Catalogues>(); //used to prevent circular references var alreadyProcessedCatalogueIds = new List <int>(); while (catalogues != null && //not null !catalogues.Deleted && //not deleted (showHidden || catalogues.Published) && //published (showHidden || aclService.Authorize(catalogues)) && //ACL !alreadyProcessedCatalogueIds.Contains(catalogues.Id)) //prevent circular references { result.Add(catalogues); alreadyProcessedCatalogueIds.Add(catalogues.Id); catalogues = cataloguesService.GetCatalogueById(catalogues.ParentCatalogueId); } result.Reverse(); return(result); }
/// <summary> /// Get catalogues breadcrumb /// </summary> /// <param name="catalogues">Catalogues</param> /// <param name="cataloguesService">Catalogues service</param> /// <param name="aclService">ACL service</param> /// <param name="storeMappingService">Store mapping service</param> /// <param name="showHidden">A value indicating whether to load hidden records</param> /// <returns>Catalogues breadcrumb </returns> public static IList<Catalogues> GetCataloguesBreadCrumb(this Catalogues catalogues, ICataloguesService cataloguesService, IAclService aclService, IStoreMappingService storeMappingService, bool showHidden = false) { if (catalogues == null) throw new ArgumentNullException("catalogues"); var result = new List<Catalogues>(); //used to prevent circular references var alreadyProcessedCatalogueIds = new List<int>(); while (catalogues != null && //not null !catalogues.Deleted && //not deleted (showHidden || catalogues.Published) && //published (showHidden || aclService.Authorize(catalogues)) && //ACL !alreadyProcessedCatalogueIds.Contains(catalogues.Id)) //prevent circular references { result.Add(catalogues); alreadyProcessedCatalogueIds.Add(catalogues.Id); catalogues = cataloguesService.GetCatalogueById(catalogues.ParentCatalogueId); } result.Reverse(); return result; }
public NewsController(INewsService newsService, ILanguageService languageService, IDateTimeHelper dateTimeHelper, ILocalizationService localizationService, IPermissionService permissionService, IUrlRecordService urlRecordService, IStoreService storeService, IStoreMappingService storeMappingService, IPictureService pictureService, ICataloguesService cataloguesService,IWorkContext workContext ) { this._newsService = newsService; this._languageService = languageService; this._dateTimeHelper = dateTimeHelper; this._localizationService = localizationService; this._permissionService = permissionService; this._urlRecordService = urlRecordService; this._storeService = storeService; this._storeMappingService = storeMappingService; this._pictureService = pictureService; this._catalogueService = cataloguesService; this._workContext = workContext; }
public NewsController(INewsService newsService, ILanguageService languageService, IDateTimeHelper dateTimeHelper, ILocalizationService localizationService, IPermissionService permissionService, IUrlRecordService urlRecordService, IStoreService storeService, IStoreMappingService storeMappingService, IPictureService pictureService, ICataloguesService cataloguesService, IWorkContext workContext) { this._newsService = newsService; this._languageService = languageService; this._dateTimeHelper = dateTimeHelper; this._localizationService = localizationService; this._permissionService = permissionService; this._urlRecordService = urlRecordService; this._storeService = storeService; this._storeMappingService = storeMappingService; this._pictureService = pictureService; this._catalogueService = cataloguesService; this._workContext = workContext; }
public CataloguesController(ICataloguesService cataloguesService, INewsService newsService, ICustomerService customerService, IUrlRecordService urlRecordService, IPictureService pictureService, ILanguageService languageService, ILocalizationService localizationService, ILocalizedEntityService localizedEntityService, IDiscountService discountService, IPermissionService permissionService, IAclService aclService, IStoreService storeService, IStoreMappingService storeMappingService, IExportManager exportManager, IVendorService vendorService, ICustomerActivityService customerActivityService, CataloguesSettings cataloguesSettings) { this._cataloguesService = cataloguesService; this._newsService = newsService; this._customerService = customerService; this._urlRecordService = urlRecordService; this._pictureService = pictureService; this._languageService = languageService; this._localizationService = localizationService; this._localizedEntityService = localizedEntityService; this._discountService = discountService; this._permissionService = permissionService; this._vendorService = vendorService; this._aclService = aclService; this._storeService = storeService; this._storeMappingService = storeMappingService; this._exportManager = exportManager; this._customerActivityService = customerActivityService; this._cataloguesSettings = cataloguesSettings; }
public CataloguesController(ICataloguesService cataloguesService, INewsService newsService, ICustomerService customerService, IUrlRecordService urlRecordService, IPictureService pictureService, ILanguageService languageService, ILocalizationService localizationService, ILocalizedEntityService localizedEntityService, IDiscountService discountService, IPermissionService permissionService, IAclService aclService, IStoreService storeService, IStoreMappingService storeMappingService, IExportManager exportManager, IVendorService vendorService, ICustomerActivityService customerActivityService, CataloguesSettings cataloguesSettings) { this._cataloguesService = cataloguesService; this._newsService = newsService; this._customerService = customerService; this._urlRecordService = urlRecordService; this._pictureService = pictureService; this._languageService = languageService; this._localizationService = localizationService; this._localizedEntityService = localizedEntityService; this._discountService = discountService; this._permissionService = permissionService; this._vendorService = vendorService; this._aclService = aclService; this._storeService = storeService; this._storeMappingService = storeMappingService; this._exportManager = exportManager; this._customerActivityService = customerActivityService; this._cataloguesSettings = cataloguesSettings; }