コード例 #1
0
        public ActionResult Configure()
        {
            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            if (!taxCategories.Any())
            {
                return(Content("No tax categories can be loaded"));
            }

            var model = new ConfigurationModel {
                CountryStateZipEnabled = _countryStateZipSettings.CountryStateZipEnabled
            };

            //stores
            model.AvailableStores.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            var stores = _storeService.GetAllStores();

            foreach (var s in stores)
            {
                model.AvailableStores.Add(new SelectListItem {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }
            //tax categories
            foreach (var tc in taxCategories)
            {
                model.AvailableTaxCategories.Add(new SelectListItem {
                    Text = tc.Name, Value = tc.Id.ToString()
                });
            }
            //countries
            var countries = _countryService.GetAllCountries(showHidden: true);

            foreach (var c in countries)
            {
                model.AvailableCountries.Add(new SelectListItem {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            //states
            model.AvailableStates.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            var defaultCountry = countries.FirstOrDefault();

            if (defaultCountry != null)
            {
                var states = _stateProvinceService.GetStateProvincesByCountryId(defaultCountry.Id);
                foreach (var s in states)
                {
                    model.AvailableStates.Add(new SelectListItem {
                        Text = s.Name, Value = s.Id.ToString()
                    });
                }
            }

            return(View("~/Plugins/Tax.FixedOrByCountryStateZip/Views/Configure.cshtml", model));
        }
コード例 #2
0
        public ActionResult Configure()
        {
            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            if (taxCategories.Count == 0)
            {
                return(Content("No tax categories can be loaded"));
            }

            var tmp = new List <FixedTaxRateModel>();

            foreach (var taxCategory in taxCategories)
            {
                tmp.Add(new FixedTaxRateModel()
                {
                    TaxCategoryId   = taxCategory.Id,
                    TaxCategoryName = taxCategory.Name,
                    Rate            = GetTaxRate(taxCategory.Id)
                });
            }

            var gridModel = new GridModel <FixedTaxRateModel>
            {
                Data  = tmp,
                Total = tmp.Count
            };

            return(View("Nas.Plugin.Tax.FixedRate.Views.TaxFixedRate.Configure", gridModel));
        }
コード例 #3
0
        public ActionResult Categories()
        {
            var categoriesModel = _taxCategoryService.GetAllTaxCategories()
                                  .Select(x => x.ToModel())
                                  .ToList();

            var model = new GridModel <TaxCategoryModel>
            {
                Data  = categoriesModel,
                Total = categoriesModel.Count
            };

            return(View(model));
        }
コード例 #4
0
        /// <summary>
        /// Uninstall plugin
        /// </summary>
        public override void Uninstall()
        {
            //settings
            _settingService.DeleteSetting <FixedOrByCountryStateZipTaxSettings>();

            //fixed rates
            var fixedRates = _taxCategoryService.GetAllTaxCategories()
                             .Select(taxCategory => _settingService.GetSetting(string.Format(FixedOrByCountryStateZipDefaults.FixedRateSettingsKey, taxCategory.Id)))
                             .Where(setting => setting != null).ToList();

            _settingService.DeleteSettings(fixedRates);

            //locales
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fixed");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.TaxByCountryStateZip");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.TaxCategoryName");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.Rate");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.Store");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.Store.Hint");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.Country");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.Country.Hint");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.StateProvince");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.StateProvince.Hint");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.Zip");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.Zip.Hint");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.TaxCategory");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.TaxCategory.Hint");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.Percentage");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.Fields.Percentage.Hint");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.AddRecord");
            _localizationService.DeletePluginLocaleResource("Plugins.Tax.FixedOrByCountryStateZip.AddRecordTitle");

            base.Uninstall();
        }
コード例 #5
0
        public void SetupProductImportModel(ProductImportModel model, int id)
        {
            model.Id                     = id;
            model.GridPageSize           = _adminAreaSettings.GridPageSize;
            model.AvailableTaxCategories = new List <SelectListItem>();

            model.AvailableTaxCategories = _taxCategoryService.GetAllTaxCategories()
                                           .Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            })
                                           .ToList();

            if (model.ImportFile.HasValue())
            {
                var    files    = new ShopConnectorFileSystem("Product");
                var    path     = files.GetFullFilePath(model.ImportFile);
                var    fileSize = ShopConnectorFileSystem.GetFileSize(path);
                double mb       = fileSize / 1024f / 1024f;

                if (mb > _shopConnectorSettings.MaxFileSizeForPreview)
                {
                    model.FileTooLargeForPreviewWarning = T("Plugins.SmartStore.ShopConnector.FileTooLargeForPreview", Math.Round(mb, 1).ToString("N0"));
                }
            }
        }
コード例 #6
0
        public ActionResult Configure(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(Content("Access denied"));
            }

            var taxRateModels = new List <FixedTaxRateModel>();

            foreach (var taxCategory in _taxCategoryService.GetAllTaxCategories())
            {
                taxRateModels.Add(new FixedTaxRateModel()
                {
                    TaxCategoryId   = taxCategory.Id,
                    TaxCategoryName = taxCategory.Name,
                    Rate            = GetTaxRate(taxCategory.Id)
                });
            }

            var gridModel = new DataSourceResult
            {
                Data  = taxRateModels,
                Total = taxRateModels.Count
            };

            return(Json(gridModel));
        }
コード例 #7
0
        public ActionResult Configure(GridCommand command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(Content("Access denied"));
            }

            var tmp = new List <FixedTaxRateModel>();

            foreach (var taxCategory in _taxCategoryService.GetAllTaxCategories())
            {
                tmp.Add(new FixedTaxRateModel()
                {
                    TaxCategoryId   = taxCategory.Id,
                    TaxCategoryName = taxCategory.Name,
                    Rate            = GetTaxRate(taxCategory.Id)
                });
            }

            var tmp2      = tmp.ForCommand(command);
            var gridModel = new GridModel <FixedTaxRateModel>
            {
                Data  = tmp2,
                Total = tmp2.Count()
            };

            return(new JsonResult
            {
                Data = gridModel
            });
        }
コード例 #8
0
        private void PrepareCheckoutAttributeModel(CheckoutAttributeModel model, CheckoutAttribute checkoutAttribute, bool excludeProperties)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            foreach (var tc in taxCategories)
            {
                model.AvailableTaxCategories.Add(new SelectListItem
                {
                    Text     = tc.Name,
                    Value    = tc.Id.ToString(),
                    Selected = (checkoutAttribute != null && !excludeProperties && tc.Id == checkoutAttribute.TaxCategoryId)
                });
            }

            if (!excludeProperties)
            {
                model.SelectedStoreIds = _storeMappingService.GetStoresIdsWithAccess(checkoutAttribute);
            }

            model.AvailableStores = _services.StoreService.GetAllStores().ToSelectListItems(model.SelectedStoreIds);
        }
コード例 #9
0
        public ActionResult Configure()
        {
            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            if (taxCategories.Count == 0)
            {
                return(Content("No tax categories can be loaded"));
            }

            var model = new TaxRateListModel();

            //stores
            model.AvailableStores.Add(new SelectListItem()
            {
                Text = "*", Value = "0"
            });
            var stores = _storeService.GetAllStores();

            foreach (var s in stores)
            {
                model.AvailableStores.Add(new SelectListItem()
                {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }
            //tax categories
            foreach (var tc in taxCategories)
            {
                model.AvailableTaxCategories.Add(new SelectListItem()
                {
                    Text = tc.Name, Value = tc.Id.ToString()
                });
            }
            //countries
            var countries = _countryService.GetAllCountries(true);

            foreach (var c in countries)
            {
                model.AvailableCountries.Add(new SelectListItem()
                {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            //states
            model.AvailableStates.Add(new SelectListItem()
            {
                Text = "*", Value = "0"
            });
            var states = _stateProvinceService.GetStateProvincesByCountryId(countries.FirstOrDefault().Id);

            foreach (var s in states)
            {
                model.AvailableStates.Add(new SelectListItem()
                {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }

            return(View("Nop.Plugin.Tax.CountryStateZip.Views.TaxCountryStateZip.Configure", model));
        }
コード例 #10
0
        public async Task <IActionResult> Configure()
        {
            var taxCategories = await _taxCategoryService.GetAllTaxCategories();

            if (taxCategories.Count == 0)
            {
                return(Content("No tax categories can be loaded"));
            }

            var model = new TaxRateListModel();

            //stores
            model.AvailableStores.Add(new SelectListItem {
                Text = "*", Value = ""
            });
            var stores = await _storeService.GetAllStores();

            foreach (var s in stores)
            {
                model.AvailableStores.Add(new SelectListItem {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }
            //tax categories
            foreach (var tc in taxCategories)
            {
                model.AvailableTaxCategories.Add(new SelectListItem {
                    Text = tc.Name, Value = tc.Id.ToString()
                });
            }
            //countries
            var countries = await _countryService.GetAllCountries(showHidden : true);

            foreach (var c in countries)
            {
                model.AvailableCountries.Add(new SelectListItem {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            //states
            model.AvailableStates.Add(new SelectListItem {
                Text = "*", Value = ""
            });
            var defaultCountry = countries.FirstOrDefault();

            if (defaultCountry != null)
            {
                var states = await _stateProvinceService.GetStateProvincesByCountryId(defaultCountry.Id);

                foreach (var s in states)
                {
                    model.AvailableStates.Add(new SelectListItem {
                        Text = s.Name, Value = s.Id.ToString()
                    });
                }
            }

            return(View("~/Plugins/Tax.CountryStateZip/Views/TaxCountryStateZip/Configure.cshtml", model));
        }
コード例 #11
0
        private void PrepareModel(ByRegionTaxRateListModel model)
        {
            var taxCategories  = _taxCategoryService.GetAllTaxCategories().ToDictionary(x => x.Id);
            var taxRates       = _taxRateService.GetAllTaxRates();
            var countries      = _countryService.GetAllCountries(true).ToDictionary(x => x.Id);
            var stateProvinces = _stateProvinceService.GetAllStateProvinces(true).ToDictionary(x => x.Id);
            var stateProvincesOfFirstCountry = stateProvinces.Values.Where(x => x.CountryId == countries.Values.FirstOrDefault().Id).ToList();
            var unavailable = T("Common.Unavailable").Text;

            model.AvailableTaxCategories = taxCategories.Values.Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            })
                                           .ToList();

            model.AvailableCountries = countries.Values.Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            })
                                       .ToList();

            model.AvailableStates = stateProvincesOfFirstCountry.Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            })
                                    .ToList();
            model.AvailableStates.Insert(0, new SelectListItem {
                Text = "*", Value = "0"
            });

            model.TaxRates = taxRates.Select(x =>
            {
                var m = new ByRegionTaxRateModel
                {
                    Id              = x.Id,
                    TaxCategoryId   = x.TaxCategoryId,
                    CountryId       = x.CountryId,
                    StateProvinceId = x.StateProvinceId,
                    Zip             = x.Zip.HasValue() ? x.Zip : "*",
                    Percentage      = x.Percentage
                };

                taxCategories.TryGetValue(x.TaxCategoryId, out TaxCategory tc);
                m.TaxCategoryName = tc?.Name.EmptyNull();

                countries.TryGetValue(x.CountryId, out Country c);
                m.CountryName = c?.Name ?? unavailable;

                stateProvinces.TryGetValue(x.StateProvinceId, out StateProvince s);
                m.StateProvinceName = s?.Name ?? "*";

                return(m);
            })
                             .ToList();
        }
コード例 #12
0
        public ActionResult Categories()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(AccessDeniedView());
            }

            var categoriesModel = _taxCategoryService.GetAllTaxCategories()
                                  .Select(x => x.ToModel())
                                  .ToList();
            var model = new GridModel <TaxCategoryModel>
            {
                Data  = categoriesModel,
                Total = categoriesModel.Count
            };

            return(View(model));
        }
コード例 #13
0
        /// <summary>
        /// Prepare paged tax category list model
        /// </summary>
        /// <param name="searchModel">Tax category search model</param>
        /// <returns>Tax category list model</returns>
        public override TaxCategoryListModel PrepareTaxCategoryListModel(TaxCategorySearchModel searchModel)
        {
            //ensure that Avalara tax provider is active
            if (!_taxPluginManager.IsPluginActive(AvalaraTaxDefaults.SystemName))
            {
                return(base.PrepareTaxCategoryListModel(searchModel));
            }

            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get tax categories
            var taxCategories = _taxCategoryService.GetAllTaxCategories().ToPagedList(searchModel);

            //get tax types and define the default value
            var taxTypes = _cacheManager.Get(AvalaraTaxDefaults.TaxCodeTypesCacheKey, () => _avalaraTaxManager.GetTaxCodeTypes())
                           ?.Select(taxType => new { Id = taxType.Key, Name = taxType.Value });
            var defaultType = taxTypes
                              ?.FirstOrDefault(taxType => taxType.Name.Equals("Unknown", StringComparison.InvariantCultureIgnoreCase))
                              ?? taxTypes?.FirstOrDefault();

            //prepare grid model
            var model = new Models.Tax.TaxCategoryListModel().PrepareToGrid(searchModel, taxCategories, () =>
            {
                //fill in model values from the entity
                return(taxCategories.Select(taxCategory =>
                {
                    //fill in model values from the entity
                    var taxCategoryModel = new Models.Tax.TaxCategoryModel
                    {
                        Id = taxCategory.Id,
                        Name = taxCategory.Name,
                        DisplayOrder = taxCategory.DisplayOrder
                    };

                    //try to get previously saved tax code type and description
                    var taxCodeType = taxTypes?.FirstOrDefault(type =>
                                                               type.Id.Equals(_genericAttributeService.GetAttribute <string>(taxCategory, AvalaraTaxDefaults.TaxCodeTypeAttribute) ?? string.Empty))
                                      ?? defaultType;
                    taxCategoryModel.Type = taxCodeType?.Name ?? string.Empty;
                    taxCategoryModel.TypeId = taxCodeType?.Id ?? Guid.Empty.ToString();
                    taxCategoryModel.Description = _genericAttributeService
                                                   .GetAttribute <string>(taxCategory, AvalaraTaxDefaults.TaxCodeDescriptionAttribute) ?? string.Empty;

                    return taxCategoryModel;
                }));
            });

            return(new TaxCategoryListModel {
                Data = model.Data, Draw = model.Draw, RecordsTotal = model.RecordsTotal, RecordsFiltered = model.RecordsFiltered
            });
        }
コード例 #14
0
        public override IActionResult Categories(TaxCategorySearchModel searchModel)
        {
            //ensure that Avalara tax provider is active
            if (!_taxPluginManager.IsPluginActive(AvalaraTaxDefaults.SystemName))
            {
                return(base.Categories(searchModel));
            }

            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(AccessDeniedDataTablesJson());
            }

            //get tax categories
            var taxCategories = _taxCategoryService.GetAllTaxCategories().ToPagedList(searchModel);

            //get tax types and define the default value
            var cacheKey = _cacheKeyService.PrepareKeyForDefaultCache(AvalaraTaxDefaults.TaxCodeTypesCacheKey);
            var taxTypes = _cacheManager.Get(cacheKey, () => _avalaraTaxManager.GetTaxCodeTypes())
                           ?.Select(taxType => new { Id = taxType.Key, Name = taxType.Value });
            var defaultType = taxTypes
                              ?.FirstOrDefault(taxType => taxType.Name.Equals("Unknown", StringComparison.InvariantCultureIgnoreCase))
                              ?? taxTypes?.FirstOrDefault();

            //prepare grid model
            var model = new Models.Tax.TaxCategoryListModel().PrepareToGrid(searchModel, taxCategories, () =>
            {
                //fill in model values from the entity
                return(taxCategories.Select(taxCategory =>
                {
                    //fill in model values from the entity
                    var taxCategoryModel = new Models.Tax.TaxCategoryModel
                    {
                        Id = taxCategory.Id,
                        Name = taxCategory.Name,
                        DisplayOrder = taxCategory.DisplayOrder
                    };

                    //try to get previously saved tax code type and description
                    var taxCodeType = taxTypes?.FirstOrDefault(type =>
                                                               type.Id.Equals(_genericAttributeService.GetAttribute <string>(taxCategory, AvalaraTaxDefaults.TaxCodeTypeAttribute) ?? string.Empty))
                                      ?? defaultType;
                    taxCategoryModel.Type = taxCodeType?.Name ?? string.Empty;
                    taxCategoryModel.TypeId = taxCodeType?.Id ?? Guid.Empty.ToString();
                    taxCategoryModel.Description = _genericAttributeService
                                                   .GetAttribute <string>(taxCategory, AvalaraTaxDefaults.TaxCodeDescriptionAttribute) ?? string.Empty;

                    return taxCategoryModel;
                }));
            });

            return(Json(model));
        }
コード例 #15
0
        /// <summary>
        /// Prepare paged tax category list model
        /// </summary>
        /// <param name="searchModel">Tax category search model</param>
        /// <returns>Tax category list model</returns>
        public override TaxCategoryListModel PrepareTaxCategoryListModel(TaxCategorySearchModel searchModel)
        {
            //ensure that Avalara tax provider is active
            if (!(_taxService.LoadActiveTaxProvider(_workContext.CurrentCustomer) is AvalaraTaxProvider))
            {
                return(base.PrepareTaxCategoryListModel(searchModel));
            }

            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get tax categories
            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            //get tax types and define the default value
            var taxTypes = _cacheManager.Get(AvalaraTaxDefaults.TaxCodeTypesCacheKey, () => _avalaraTaxManager.GetTaxCodeTypes())
                           ?.Select(taxType => new { Id = taxType.Key, Name = taxType.Value });
            var defaultType = taxTypes
                              ?.FirstOrDefault(taxType => taxType.Name.Equals("Unknown", StringComparison.InvariantCultureIgnoreCase))
                              ?? taxTypes?.FirstOrDefault();

            //prepare grid model
            var model = new TaxCategoryListModel
            {
                Data = taxCategories.PaginationByRequestModel(searchModel).Select(taxCategory =>
                {
                    //fill in model values from the entity
                    var taxCategoryModel = new Models.Tax.TaxCategoryModel
                    {
                        Id           = taxCategory.Id,
                        Name         = taxCategory.Name,
                        DisplayOrder = taxCategory.DisplayOrder
                    };

                    //try to get previously saved tax code type and description
                    var taxCodeType = taxTypes?.FirstOrDefault(type =>
                                                               type.Id.Equals(_genericAttributeService.GetAttribute <string>(taxCategory, AvalaraTaxDefaults.TaxCodeTypeAttribute) ?? string.Empty))
                                      ?? defaultType;
                    taxCategoryModel.Type        = taxCodeType?.Name ?? string.Empty;
                    taxCategoryModel.TypeId      = taxCodeType?.Id ?? Guid.Empty.ToString();
                    taxCategoryModel.Description = _genericAttributeService
                                                   .GetAttribute <string>(taxCategory, AvalaraTaxDefaults.TaxCodeDescriptionAttribute) ?? string.Empty;

                    return(taxCategoryModel);
                }),
                Total = taxCategories.Count
            };

            return(model);
        }
コード例 #16
0
        public async Task <IActionResult> Categories(DataSourceRequest command)
        {
            var categoriesModel = (await _taxCategoryService.GetAllTaxCategories())
                                  .Select(x => x.ToModel())
                                  .ToList();
            var gridModel = new DataSourceResult
            {
                Data  = categoriesModel,
                Total = categoriesModel.Count
            };

            return(Json(gridModel));
        }
コード例 #17
0
        public IActionResult GetTaxCategories(TaxCategoriesParametersModel parameters)
        {
            var allTaxCategories = _taxCategoryService.GetAllTaxCategories();

            IList <TaxCategoryDto> taxCategoriesAsDtos = allTaxCategories.Select(taxCategory => _dtoHelper.PrepareTaxCategoryDTO(taxCategory)).ToList();

            var taxCategoriesRootObject = new TaxCategoryRootObjectDto()
            {
                TaxCategories = taxCategoriesAsDtos
            };

            var json = JsonFieldsSerializer.Serialize(taxCategoriesRootObject, null);

            return(new RawJsonActionResult(json));
        }
コード例 #18
0
        /// <summary>
        /// Uninstall plugin
        /// </summary>
        public override void Uninstall()
        {
            //settings
            _settingService.DeleteSetting <FixedOrByCountryStateZipTaxSettings>();

            //fixed rates
            var fixedRates = _taxCategoryService.GetAllTaxCategories()
                             .Select(taxCategory => _settingService.GetSetting(string.Format(FixedOrByCountryStateZipDefaults.FixedRateSettingsKey, taxCategory.Id)))
                             .Where(setting => setting != null).ToList();

            _settingService.DeleteSettings(fixedRates);

            //locales
            _localizationService.DeleteLocaleResources("Plugins.Tax.FixedOrByCountryStateZip");

            base.Uninstall();
        }
コード例 #19
0
        public virtual ActionResult Categories(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
            {
                return(AccessDeniedKendoGridJson());
            }

            var categoriesModel = _taxCategoryService.GetAllTaxCategories()
                                  .Select(x => x.ToModel())
                                  .ToList();
            var gridModel = new DataSourceResult
            {
                Data  = categoriesModel,
                Total = categoriesModel.Count
            };

            return(Json(gridModel));
        }
コード例 #20
0
        private void PrepareCheckoutAttributeModel(CheckoutAttributeModel model, CheckoutAttribute checkoutAttribute, bool excludeProperties)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            //tax categories
            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            foreach (var tc in taxCategories)
            {
                model.AvailableTaxCategories.Add(new SelectListItem()
                {
                    Text = tc.Name, Value = tc.Id.ToString(), Selected = checkoutAttribute != null && !excludeProperties && tc.Id == checkoutAttribute.TaxCategoryId
                });
            }
        }
コード例 #21
0
        /// <summary>
        /// Prepare paged tax category list model
        /// </summary>
        /// <param name="searchModel">Tax category search model</param>
        /// <returns>Tax category list model</returns>
        public virtual TaxCategoryListModel PrepareTaxCategoryListModel(TaxCategorySearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get tax categories
            var taxCategories = _taxCategoryService.GetAllTaxCategories().ToPagedList(searchModel);

            //prepare grid model
            var model = new TaxCategoryListModel().PrepareToGrid(searchModel, taxCategories, () =>
            {
                //fill in model values from the entity
                return(taxCategories.Select(taxCategory => taxCategory.ToModel <TaxCategoryModel>()));
            });

            return(model);
        }
コード例 #22
0
ファイル: TaxModelFactory.cs プロジェクト: joenilan/nop
        /// <summary>
        /// Prepare paged tax category list model
        /// </summary>
        /// <param name="searchModel">Tax category search model</param>
        /// <returns>Tax category list model</returns>
        public virtual TaxCategoryListModel PrepareTaxCategoryListModel(TaxCategorySearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get tax categories
            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            //prepare grid model
            var model = new TaxCategoryListModel
            {
                //fill in model values from the entity
                Data  = taxCategories.PaginationByRequestModel(searchModel).Select(taxCategory => taxCategory.ToModel <TaxCategoryModel>()),
                Total = taxCategories.Count
            };

            return(model);
        }
コード例 #23
0
        protected virtual void PrepareTaxCategories(CheckoutAttributeModel model, CheckoutAttribute checkoutAttribute, bool excludeProperties)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            //tax categories
            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            model.AvailableTaxCategories.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Configuration.Settings.Tax.TaxCategories.None"), Value = ""
            });
            foreach (var tc in taxCategories)
            {
                model.AvailableTaxCategories.Add(new SelectListItem {
                    Text = tc.Name, Value = tc.Id.ToString(), Selected = checkoutAttribute != null && !excludeProperties && tc.Id == checkoutAttribute.TaxCategoryId
                });
            }
        }
コード例 #24
0
        public async Task <IActionResult> Configure(DataSourceRequest command)
        {
            var taxRateModels = new List <FixedTaxRateModel>();

            foreach (var taxCategory in await _taxCategoryService.GetAllTaxCategories())
            {
                taxRateModels.Add(new FixedTaxRateModel {
                    TaxCategoryId   = taxCategory.Id,
                    TaxCategoryName = taxCategory.Name,
                    Rate            = GetTaxRate(taxCategory.Id)
                });
            }

            var gridModel = new DataSourceResult {
                Data  = taxRateModels,
                Total = taxRateModels.Count
            };

            return(Json(gridModel));
        }
コード例 #25
0
        private void PrepareCheckoutAttributeModel(CheckoutAttributeModel model, CheckoutAttribute checkoutAttribute, bool excludeProperties)
        {
            Guard.NotNull(model, nameof(model));

            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            foreach (var tc in taxCategories)
            {
                model.AvailableTaxCategories.Add(new SelectListItem
                {
                    Text     = tc.Name,
                    Value    = tc.Id.ToString(),
                    Selected = checkoutAttribute != null && !excludeProperties && tc.Id == checkoutAttribute.TaxCategoryId
                });
            }

            if (!excludeProperties)
            {
                model.SelectedStoreIds = _storeMappingService.GetStoresIdsWithAccess(checkoutAttribute);
            }
        }
コード例 #26
0
        /// <summary>
        /// Prepare available tax categories
        /// </summary>
        /// <param name="items">Tax category items</param>
        /// <param name="withSpecialDefaultItem">Whether to insert the first special item for the default value</param>
        /// <param name="defaultItemText">Default item text; pass null to use default value of the default item text</param>
        public virtual void PrepareTaxCategories(IList <SelectListItem> items, bool withSpecialDefaultItem = true, string defaultItemText = null)
        {
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            //prepare available tax categories
            var availableTaxCategories = _taxCategoryService.GetAllTaxCategories();

            foreach (var taxCategory in availableTaxCategories)
            {
                items.Add(new SelectListItem {
                    Value = taxCategory.Id.ToString(), Text = taxCategory.Name
                });
            }

            //insert special item for the default value
            PrepareDefaultItem(items, withSpecialDefaultItem,
                               defaultItemText ?? _localizationService.GetResource("Admin.Configuration.Settings.Tax.TaxCategories.None"));
        }
コード例 #27
0
        public ActionResult Configure()
        {
            var taxCategories = _taxCategoryService.GetAllTaxCategories();

            if (taxCategories.Count == 0)
            {
                return(Content("No tax categories can be loaded"));
            }

            var model = new TaxRateListModel();

            foreach (var tc in taxCategories)
            {
                model.AvailableTaxCategories.Add(new SelectListItem()
                {
                    Text = tc.Name, Value = tc.Id.ToString()
                });
            }
            var countries = _countryService.GetAllCountries(true);

            foreach (var c in countries)
            {
                model.AvailableCountries.Add(new SelectListItem()
                {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            model.AvailableStates.Add(new SelectListItem()
            {
                Text = "*", Value = "0"
            });
            var states = _stateProvinceService.GetStateProvincesByCountryId(countries.FirstOrDefault().Id);

            if (states.Count > 0)
            {
                foreach (var s in states)
                {
                    model.AvailableStates.Add(new SelectListItem()
                    {
                        Text = s.Name, Value = s.Id.ToString()
                    });
                }
            }

            model.TaxRates = _taxRateService.GetAllTaxRates()
                             .Select(x =>
            {
                var m = new TaxRateModel()
                {
                    Id              = x.Id,
                    TaxCategoryId   = x.TaxCategoryId,
                    CountryId       = x.CountryId,
                    StateProvinceId = x.StateProvinceId,
                    Zip             = x.Zip,
                    Percentage      = x.Percentage,
                };
                var tc              = _taxCategoryService.GetTaxCategoryById(x.TaxCategoryId);
                m.TaxCategoryName   = (tc != null) ? tc.Name : "";
                var c               = _countryService.GetCountryById(x.CountryId);
                m.CountryName       = (c != null) ? c.Name : "Unavailable";
                var s               = _stateProvinceService.GetStateProvinceById(x.StateProvinceId);
                m.StateProvinceName = (s != null) ? s.Name : "*";
                m.Zip               = (!String.IsNullOrEmpty(x.Zip)) ? x.Zip : "*";
                return(m);
            })
                             .ToList();

            return(View("SmartStore.Plugin.Tax.CountryStateZip.Views.TaxCountryStateZip.Configure", model));
        }
コード例 #28
0
        public void CanExportProductsToXlsx()
        {
            var replacePairs = new Dictionary <string, string>
            {
                { "ProductId", "Id" },
                { "ProductType", "ProductTypeId" },
                { "GiftCardType", "GiftCardTypeId" },
                { "Vendor", "VendorId" },
                { "ProductTemplate", "ProductTemplateId" },
                { "DeliveryDate", "DeliveryDateId" },
                { "TaxCategory", "TaxCategoryId" },
                { "ManageInventoryMethod", "ManageInventoryMethodId" },
                { "ProductAvailabilityRange", "ProductAvailabilityRangeId" },
                { "LowStockActivity", "LowStockActivityId" },
                { "BackorderMode", "BackorderModeId" },
                { "BasepriceUnit", "BasepriceUnitId" },
                { "BasepriceBaseUnit", "BasepriceBaseUnitId" },
                { "SKU", "Sku" },
                { "DownloadActivationType", "DownloadActivationTypeId" },
                { "RecurringCyclePeriod", "RecurringCyclePeriodId" },
                { "RentalPricePeriod", "RentalPricePeriodId" }
            };

            var ignore = new List <string> {
                "Categories", "Manufacturers", "AdminComment",
                "ProductType", "BackorderMode", "DownloadActivationType", "GiftCardType", "LowStockActivity",
                "ManageInventoryMethod", "RecurringCyclePeriod", "RentalPricePeriod", "ProductCategories",
                "ProductManufacturers", "ProductPictures", "ProductReviews", "ProductSpecificationAttributes",
                "ProductTags", "ProductAttributeMappings", "ProductAttributeCombinations", "TierPrices",
                "AppliedDiscounts", "ProductWarehouseInventory", "ApprovedRatingSum", "NotApprovedRatingSum",
                "ApprovedTotalReviews", "NotApprovedTotalReviews", "SubjectToAcl", "LimitedToStores", "Deleted",
                "DownloadExpirationDays", "HasTierPrices", "HasDiscountsApplied", "AvailableStartDateTimeUtc",
                "AvailableEndDateTimeUtc", "DisplayOrder", "CreatedOnUtc", "UpdatedOnUtc", "ProductProductTagMappings",
                "DiscountProductMappings", "EntityCacheKey"
            };

            ignore.AddRange(replacePairs.Values);

            var products = _productRepository.Table.ToList();

            var excelData = _exportManager.ExportProductsToXlsx(products);
            var worksheet = GetWorksheets(excelData);
            var manager   = GetPropertyManager <Product>(worksheet);

            manager.SetSelectList("ProductType", ProductType.SimpleProduct.ToSelectList(useLocalization: false));
            manager.SetSelectList("GiftCardType", GiftCardType.Virtual.ToSelectList(useLocalization: false));
            manager.SetSelectList("DownloadActivationType", DownloadActivationType.Manually.ToSelectList(useLocalization: false));
            manager.SetSelectList("ManageInventoryMethod", ManageInventoryMethod.DontManageStock.ToSelectList(useLocalization: false));
            manager.SetSelectList("LowStockActivity", LowStockActivity.Nothing.ToSelectList(useLocalization: false));
            manager.SetSelectList("BackorderMode", BackorderMode.NoBackorders.ToSelectList(useLocalization: false));
            manager.SetSelectList("RecurringCyclePeriod", RecurringProductCyclePeriod.Days.ToSelectList(useLocalization: false));
            manager.SetSelectList("RentalPricePeriod", RentalPricePeriod.Days.ToSelectList(useLocalization: false));

            manager.SetSelectList("Vendor", _vendorService.GetAllVendors(showHidden: true).Select(v => v as BaseEntity).ToSelectList(p => (p as Vendor)?.Name ?? string.Empty));
            manager.SetSelectList("ProductTemplate", _productTemplateService.GetAllProductTemplates().Select(pt => pt as BaseEntity).ToSelectList(p => (p as ProductTemplate)?.Name ?? string.Empty));
            manager.SetSelectList("DeliveryDate", _dateRangeService.GetAllDeliveryDates().Select(dd => dd as BaseEntity).ToSelectList(p => (p as DeliveryDate)?.Name ?? string.Empty));
            manager.SetSelectList("ProductAvailabilityRange", _dateRangeService.GetAllProductAvailabilityRanges().Select(range => range as BaseEntity).ToSelectList(p => (p as ProductAvailabilityRange)?.Name ?? string.Empty));
            manager.SetSelectList("TaxCategory", _taxCategoryService.GetAllTaxCategories().Select(tc => tc as BaseEntity).ToSelectList(p => (p as TaxCategory)?.Name ?? string.Empty));
            manager.SetSelectList("BasepriceUnit", _measureService.GetAllMeasureWeights().Select(mw => mw as BaseEntity).ToSelectList(p => (p as MeasureWeight)?.Name ?? string.Empty));
            manager.SetSelectList("BasepriceBaseUnit", _measureService.GetAllMeasureWeights().Select(mw => mw as BaseEntity).ToSelectList(p => (p as MeasureWeight)?.Name ?? string.Empty));

            manager.Remove("ProductTags");

            manager.ReadFromXlsx(worksheet, 2);
            var product = products.First();

            AreAllObjectPropertiesPresent(product, manager, ignore.ToArray());
            PropertiesShouldEqual(product, manager, replacePairs);
        }
コード例 #29
0
        public async Task <IActionResult> Settings()
        {
            //load settings for a chosen store scope
            var storeScope = await GetActiveStore(_storeService, _workContext);

            var taxSettings = _settingService.LoadSetting <TaxSettings>(storeScope);
            var model       = taxSettings.ToModel();

            model.ActiveStore          = storeScope;
            model.TaxBasedOnValues     = taxSettings.TaxBasedOn.ToSelectList(HttpContext);
            model.TaxDisplayTypeValues = taxSettings.TaxDisplayType.ToSelectList(HttpContext);

            //tax categories
            var taxCategories = await _taxCategoryService.GetAllTaxCategories();

            model.TaxCategories.Add(new SelectListItem {
                Text = _translationService.GetResource("Admin.Configuration.Tax.Settings.TaxCategories.None"), Value = ""
            });
            foreach (var tc in taxCategories)
            {
                model.TaxCategories.Add(new SelectListItem {
                    Text = tc.Name, Value = tc.Id.ToString()
                });
            }

            //EU VAT countries
            model.EuVatShopCountries.Add(new SelectListItem {
                Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = ""
            });
            foreach (var c in await _countryService.GetAllCountries(showHidden: true))
            {
                model.EuVatShopCountries.Add(new SelectListItem {
                    Text = c.Name, Value = c.Id.ToString(), Selected = c.Id == taxSettings.EuVatShopCountryId
                });
            }

            //default tax address
            var defaultAddress = taxSettings.DefaultTaxAddress;

            if (defaultAddress != null)
            {
                model.DefaultTaxAddress = await defaultAddress.ToModel(_countryService);
            }
            else
            {
                model.DefaultTaxAddress = new AddressModel();
            }

            model.DefaultTaxAddress.AvailableCountries.Add(new SelectListItem {
                Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = ""
            });
            foreach (var c in await _countryService.GetAllCountries(showHidden: true))
            {
                model.DefaultTaxAddress.AvailableCountries.Add(new SelectListItem {
                    Text = c.Name, Value = c.Id.ToString(), Selected = (defaultAddress != null && c.Id == defaultAddress.CountryId)
                });
            }

            var states = defaultAddress != null && !String.IsNullOrEmpty(defaultAddress.CountryId) ? (await _countryService.GetCountryById(defaultAddress.CountryId))?.StateProvinces : new List <StateProvince>();

            if (states.Count > 0)
            {
                foreach (var s in states)
                {
                    model.DefaultTaxAddress.AvailableStates.Add(new SelectListItem {
                        Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == defaultAddress.StateProvinceId)
                    });
                }
            }

            model.DefaultTaxAddress.CountryEnabled        = true;
            model.DefaultTaxAddress.StateProvinceEnabled  = true;
            model.DefaultTaxAddress.ZipPostalCodeEnabled  = true;
            model.DefaultTaxAddress.ZipPostalCodeRequired = true;

            return(View(model));
        }
コード例 #30
0
        public void can_export_products_to_xlsx()
        {
            var replacePairse = new Dictionary <string, string>
            {
                { "ProductId", "Id" },
                { "ProductType", "ProductTypeId" },
                { "GiftCardType", "GiftCardTypeId" },
                { "Vendor", "VendorId" },
                { "ProductTemplate", "ProductTemplateId" },
                { "DeliveryDate", "DeliveryDateId" },
                { "TaxCategory", "TaxCategoryId" },
                { "ManageInventoryMethod", "ManageInventoryMethodId" },
                { "ProductAvailabilityRange", "ProductAvailabilityRangeId" },
                { "LowStockActivity", "LowStockActivityId" },
                { "BackorderMode", "BackorderModeId" },
                { "BasepriceUnit", "BasepriceUnitId" },
                { "BasepriceBaseUnit", "BasepriceBaseUnitId" },
                { "SKU", "Sku" },
                { "DownloadActivationType", "DownloadActivationTypeId" },
                { "RecurringCyclePeriod", "RecurringCyclePeriodId" },
                { "RentalPricePeriod", "RentalPricePeriodId" }
            };

            var products = new List <Product>
            {
                new Product
                {
                    Id                               = 1,
                    ProductTypeId                    = (int)ProductType.SimpleProduct,
                    ParentGroupedProductId           = 0,
                    VisibleIndividually              = true,
                    Name                             = "TestProduct",
                    ShortDescription                 = "TestShortDescription",
                    FullDescription                  = "TestFullDescription",
                    VendorId                         = 1,
                    ProductTemplateId                = 1,
                    ShowOnHomePage                   = true,
                    MetaKeywords                     = "TestMetaKeywords",
                    MetaDescription                  = "TestMetaDescription",
                    MetaTitle                        = "TestMetaTitle",
                    AllowCustomerReviews             = true,
                    Published                        = true,
                    Sku                              = "TestSku",
                    ManufacturerPartNumber           = "TestManufacturerPartNumber",
                    Gtin                             = "TestGtin",
                    IsGiftCard                       = false,
                    GiftCardTypeId                   = (int)GiftCardType.Virtual,
                    OverriddenGiftCardAmount         = 0,
                    RequireOtherProducts             = false,
                    RequiredProductIds               = "0",
                    AutomaticallyAddRequiredProducts = true,
                    IsDownload                       = false,
                    DownloadId                       = 0,
                    UnlimitedDownloads               = true,
                    MaxNumberOfDownloads             = 100,
                    DownloadActivationTypeId         = (int)DownloadActivationType.WhenOrderIsPaid,
                    HasSampleDownload                = false,
                    SampleDownloadId                 = 0,
                    HasUserAgreement                 = false,
                    UserAgreementText                = string.Empty,
                    IsRecurring                      = false,
                    RecurringCycleLength             = 1,
                    RecurringCyclePeriodId           = (int)RecurringProductCyclePeriod.Years,
                    RecurringTotalCycles             = 10,
                    IsRental                         = false,
                    RentalPriceLength                = 1,
                    RentalPricePeriodId              = (int)RentalPricePeriod.Years,
                    IsShipEnabled                    = true,
                    IsFreeShipping                   = true,
                    ShipSeparately                   = false,
                    AdditionalShippingCharge         = 0,
                    DeliveryDateId                   = 1,
                    IsTaxExempt                      = false,
                    TaxCategoryId                    = 0,
                    IsTelecommunicationsOrBroadcastingOrElectronicServices = false,
                    ManageInventoryMethodId    = (int)ManageInventoryMethod.DontManageStock,
                    ProductAvailabilityRangeId = 1,
                    UseMultipleWarehouses      = false,
                    WarehouseId                          = 0,
                    StockQuantity                        = 100,
                    DisplayStockAvailability             = true,
                    DisplayStockQuantity                 = true,
                    MinStockQuantity                     = 1,
                    LowStockActivityId                   = (int)LowStockActivity.Nothing,
                    NotifyAdminForQuantityBelow          = 5,
                    BackorderModeId                      = (int)BackorderMode.NoBackorders,
                    AllowBackInStockSubscriptions        = true,
                    OrderMinimumQuantity                 = 1,
                    OrderMaximumQuantity                 = 10,
                    AllowedQuantities                    = "1;5;10",
                    NotReturnable                        = true,
                    DisableBuyButton                     = true,
                    DisableWishlistButton                = true,
                    AvailableForPreOrder                 = true,
                    PreOrderAvailabilityStartDateTimeUtc = new DateTime(2010, 01, 04),
                    CallForPrice                         = true,
                    Price                       = 40,
                    OldPrice                    = 50,
                    ProductCost                 = 40,
                    CustomerEntersPrice         = true,
                    MinimumCustomerEnteredPrice = 40,
                    MaximumCustomerEnteredPrice = 60,
                    BasepriceEnabled            = true,
                    BasepriceAmount             = 40,
                    BasepriceBaseUnitId         = 0,
                    BasepriceBaseAmount         = 40,
                    BasepriceUnitId             = 0,
                    MarkAsNew                   = true,
                    MarkAsNewStartDateTimeUtc   = new DateTime(2010, 01, 04),
                    MarkAsNewEndDateTimeUtc     = new DateTime(2020, 01, 04),
                    Weight                      = 10,
                    Length                      = 10,
                    Width                       = 10,
                    Height                      = 10
                }
            };

            var ignore = new List <string> {
                "Categories", "Manufacturers", "AdminComment",
                "ProductType", "BackorderMode", "DownloadActivationType", "GiftCardType", "LowStockActivity",
                "ManageInventoryMethod", "RecurringCyclePeriod", "RentalPricePeriod", "ProductCategories",
                "ProductManufacturers", "ProductPictures", "ProductReviews", "ProductSpecificationAttributes",
                "ProductTags", "ProductAttributeMappings", "ProductAttributeCombinations", "TierPrices",
                "AppliedDiscounts", "ProductWarehouseInventory", "ApprovedRatingSum", "NotApprovedRatingSum",
                "ApprovedTotalReviews", "NotApprovedTotalReviews", "SubjectToAcl", "LimitedToStores", "Deleted",
                "DownloadExpirationDays", "HasTierPrices", "HasDiscountsApplied", "AvailableStartDateTimeUtc",
                "AvailableEndDateTimeUtc", "DisplayOrder", "CreatedOnUtc", "UpdatedOnUtc"
            };

            ignore.AddRange(replacePairse.Values);

            var excelData = _exportManager.ExportProductsToXlsx(products);
            var worksheet = GetWorksheets(excelData);
            var manager   = GetPropertyManager <Product>(worksheet);

            manager.SetSelectList("ProductType", ProductType.SimpleProduct.ToSelectList(useLocalization: false));
            manager.SetSelectList("GiftCardType", GiftCardType.Virtual.ToSelectList(useLocalization: false));
            manager.SetSelectList("DownloadActivationType", DownloadActivationType.Manually.ToSelectList(useLocalization: false));
            manager.SetSelectList("ManageInventoryMethod", ManageInventoryMethod.DontManageStock.ToSelectList(useLocalization: false));
            manager.SetSelectList("LowStockActivity", LowStockActivity.Nothing.ToSelectList(useLocalization: false));
            manager.SetSelectList("BackorderMode", BackorderMode.NoBackorders.ToSelectList(useLocalization: false));
            manager.SetSelectList("RecurringCyclePeriod", RecurringProductCyclePeriod.Days.ToSelectList(useLocalization: false));
            manager.SetSelectList("RentalPricePeriod", RentalPricePeriod.Days.ToSelectList(useLocalization: false));

            manager.SetSelectList("Vendor", _vendorService.GetAllVendors(showHidden: true).Select(v => v as BaseEntity).ToSelectList(p => (p as Vendor)?.Name ?? string.Empty));
            manager.SetSelectList("ProductTemplate", _productTemplateService.GetAllProductTemplates().Select(pt => pt as BaseEntity).ToSelectList(p => (p as ProductTemplate)?.Name ?? string.Empty));
            manager.SetSelectList("DeliveryDate", _dateRangeService.GetAllDeliveryDates().Select(dd => dd as BaseEntity).ToSelectList(p => (p as DeliveryDate)?.Name ?? string.Empty));
            manager.SetSelectList("ProductAvailabilityRange", _dateRangeService.GetAllProductAvailabilityRanges().Select(range => range as BaseEntity).ToSelectList(p => (p as ProductAvailabilityRange)?.Name ?? string.Empty));
            manager.SetSelectList("TaxCategory", _taxCategoryService.GetAllTaxCategories().Select(tc => tc as BaseEntity).ToSelectList(p => (p as TaxCategory)?.Name ?? string.Empty));
            manager.SetSelectList("BasepriceUnit", _measureService.GetAllMeasureWeights().Select(mw => mw as BaseEntity).ToSelectList(p => (p as MeasureWeight)?.Name ?? string.Empty));
            manager.SetSelectList("BasepriceBaseUnit", _measureService.GetAllMeasureWeights().Select(mw => mw as BaseEntity).ToSelectList(p => (p as MeasureWeight)?.Name ?? string.Empty));

            manager.Remove("ProductTags");

            manager.ReadFromXlsx(worksheet, 2);
            var product = products.First();

            AreAllObjectPropertiesPresent(product, manager, ignore.ToArray());
            PropertiesShouldEqual(product, manager, replacePairse);
        }