Exemple #1
0
 public MaterialController(IMaterialService materialService,
                           IMaterialGroupService materialGroupService,
                           ISupplierService supplierService,
                           IWorkContext workContext,
                           ILocalizationService localizationService,
                           IPictureService pictureService,
                           //ICopyMaterialService copyMaterialService,
                           IPdfService pdfService,
                           IExportManager exportManager,
                           IImportManager importManager,
                           ICustomerActivityService customerActivityService,
                           IPermissionService permissionService,
                           IShippingService shippingService,
                           IStaticCacheManager cacheManager,
                           IDateTimeHelper dateTimeHelper)
 {
     this._materialService      = materialService;
     this._materialGroupService = materialGroupService;
     this._supplierService      = supplierService;
     this._workContext          = workContext;
     this._localizationService  = localizationService;
     this._pictureService       = pictureService;
     //this._copyMaterialService = copyMaterialService;
     this._pdfService              = pdfService;
     this._exportManager           = exportManager;
     this._importManager           = importManager;
     this._customerActivityService = customerActivityService;
     this._permissionService       = permissionService;
     this._shippingService         = shippingService;
     this._cacheManager            = cacheManager;
     this._dateTimeHelper          = dateTimeHelper;
 }
        public ProductExtensionController(IMaterialGroupService materialGroupService,
                                          IMaterialService materialService,
                                          IProductService productService,
                                          IManufacturerService manufacturerService,
                                          IPictureService pictureService,
                                          ILocalizationService localizationService,
                                          IPermissionService permissionService,
                                          IExportManager exportManager,
                                          ICustomerActivityService customerActivityService,
                                          IWorkContext workContext,
                                          IShippingService shippingService,
                                          IImportManager importManager,
                                          IStaticCacheManager cacheManager)
        {
            this._materialGroupService = materialGroupService;
            this._materialService      = materialService;

            this._productService          = productService;
            this._manufacturerService     = manufacturerService;
            this._pictureService          = pictureService;
            this._localizationService     = localizationService;
            this._permissionService       = permissionService;
            this._exportManager           = exportManager;
            this._customerActivityService = customerActivityService;
            this._workContext             = workContext;
            this._importManager           = importManager;
            this._cacheManager            = cacheManager;
            this._shippingService         = shippingService;
        }
Exemple #3
0
        /// <summary>
        /// Get group breadcrumb
        /// </summary>
        /// <param name="group">MaterialGroup</param>
        /// <param name="materialGroupService">MaterialGroup 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>MaterialGroup breadcrumb </returns>
        public static IList <MaterialGroup> GetMaterialGroupBreadCrumb(this MaterialGroup group,
                                                                       IMaterialGroupService materialGroupService,
                                                                       IAclService aclService,
                                                                       IStoreMappingService storeMappingService,
                                                                       bool showHidden = false)
        {
            if (group == null)
            {
                throw new ArgumentNullException(nameof(group));
            }

            var result = new List <MaterialGroup>();

            //used to prevent circular references
            var alreadyProcessedMaterialGroupIds = new List <int>();

            while (group != null &&  //not null
                   !group.Deleted && //not deleted
                   //(showHidden || aclService.Authorize(group)) && //ACL
                   //(showHidden || storeMappingService.Authorize(group)) && //Store mapping
                   !alreadyProcessedMaterialGroupIds.Contains(group.Id)) //prevent circular references
            {
                result.Add(group);

                alreadyProcessedMaterialGroupIds.Add(group.Id);

                group = materialGroupService.GetMaterialGroupById(group.ParentGroupId);
            }
            result.Reverse();
            return(result);
        }
Exemple #4
0
        //private readonly IWorkContext _workContext;
        //private readonly IWebHelper _webHelper;

        public XrmsMaterialAdminPlugin(MaterialManagerObjectContext objectContext,
                                       ISettingService settingService,
                                       ILocalizationService localizationService,
                                       IPermissionService permissionService,
                                       IMaterialGroupService materialGroupService)
        {
            _objectContext        = objectContext;
            _settingService       = settingService;
            _localizationService  = localizationService;
            _permissionService    = permissionService;
            _materialGroupService = materialGroupService;
        }
Exemple #5
0
        /// <summary>
        /// Get formatted group breadcrumb
        /// Note: ACL and store mapping is ignored
        /// </summary>
        /// <param name="group">MaterialGroup</param>
        /// <param name="materialGroupService">MaterialGroup service</param>
        /// <param name="separator">Separator</param>
        /// <param name="languageId">Language identifier for localization</param>
        /// <returns>Formatted breadcrumb</returns>
        public static string GetFormattedBreadCrumb(this MaterialGroup group,
                                                    IMaterialGroupService materialGroupService,
                                                    string separator = ">>", int languageId = 0)
        {
            var result = string.Empty;

            var breadcrumb = GetMaterialGroupBreadCrumb(group, materialGroupService, null, null, true);

            for (var i = 0; i <= breadcrumb.Count - 1; i++)
            {
                var groupName = breadcrumb[i].GetLocalized(x => x.Name, languageId);
                result = string.IsNullOrEmpty(result)
                    ? groupName
                    : $"{result} {separator} {groupName}";
            }

            return(result);
        }
Exemple #6
0
 public MaterialGroupController(IMaterialGroupService service) : base(service)
 {
 }