Beispiel #1
0
        public Task <ConfigurationModel> PrepareLicenseConfigurationModel(ConfigurationModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            searchModel.SetGridPageSize();

            return(Task.FromResult(searchModel));
        }
Beispiel #2
0
        public IActionResult Configure()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
            {
                return(AccessDeniedView());
            }

            var model = new ConfigurationModel
            {
                LimitMethodsToCreated          = _fixedByWeightByTotalSettings.LimitMethodsToCreated,
                ShippingByWeightByTotalEnabled = _fixedByWeightByTotalSettings.ShippingByWeightByTotalEnabled
            };

            //stores
            model.AvailableStores.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            foreach (var store in _storeService.GetAllStores())
            {
                model.AvailableStores.Add(new SelectListItem {
                    Text = store.Name, Value = store.Id.ToString()
                });
            }
            //warehouses
            model.AvailableWarehouses.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            foreach (var warehouses in _shippingService.GetAllWarehouses())
            {
                model.AvailableWarehouses.Add(new SelectListItem {
                    Text = warehouses.Name, Value = warehouses.Id.ToString()
                });
            }
            //shipping methods
            foreach (var sm in _shippingService.GetAllShippingMethods())
            {
                model.AvailableShippingMethods.Add(new SelectListItem {
                    Text = sm.Name, Value = sm.Id.ToString()
                });
            }
            //countries
            model.AvailableCountries.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            var countries = _countryService.GetAllCountries();

            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"
            });

            model.SetGridPageSize();

            return(View("~/Plugins/Shipping.FixedByWeightByTotal/Views/Configure.cshtml", model));
        }
        /// <returns>A task that represents the asynchronous operation</returns>
        public async Task <IActionResult> Configure(bool showtour = false)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageShippingSettings))
            {
                return(AccessDeniedView());
            }

            var model = new ConfigurationModel
            {
                LimitMethodsToCreated          = _fixedByWeightByTotalSettings.LimitMethodsToCreated,
                ShippingByWeightByTotalEnabled = _fixedByWeightByTotalSettings.ShippingByWeightByTotalEnabled
            };

            //stores
            model.AvailableStores.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            foreach (var store in await _storeService.GetAllStoresAsync())
            {
                model.AvailableStores.Add(new SelectListItem {
                    Text = store.Name, Value = store.Id.ToString()
                });
            }
            //warehouses
            model.AvailableWarehouses.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            foreach (var warehouses in await _shippingService.GetAllWarehousesAsync())
            {
                model.AvailableWarehouses.Add(new SelectListItem {
                    Text = warehouses.Name, Value = warehouses.Id.ToString()
                });
            }
            //shipping methods
            foreach (var sm in await _shippingService.GetAllShippingMethodsAsync())
            {
                model.AvailableShippingMethods.Add(new SelectListItem {
                    Text = sm.Name, Value = sm.Id.ToString()
                });
            }
            //countries
            model.AvailableCountries.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            var countries = await _countryService.GetAllCountriesAsync();

            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"
            });

            model.SetGridPageSize();

            //show configuration tour
            if (showtour)
            {
                var hideCard = await _genericAttributeService.GetAttributeAsync <bool>(await _workContext.GetCurrentCustomerAsync(), NopCustomerDefaults.HideConfigurationStepsAttribute);

                var closeCard = await _genericAttributeService.GetAttributeAsync <bool>(await _workContext.GetCurrentCustomerAsync(), NopCustomerDefaults.CloseConfigurationStepsAttribute);

                if (!hideCard && !closeCard)
                {
                    ViewBag.ShowTour = true;
                }
            }

            return(View("~/Plugins/Shipping.FixedByWeightByTotal/Views/Configure.cshtml", model));
        }
Beispiel #4
0
        public IActionResult Configure()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
            {
                return(AccessDeniedView());
            }

            var shippingMethods = _shippingService.GetAllShippingMethods();

            if (shippingMethods.Count == 0)
            {
                return(Content("No shipping methods can be loaded"));
            }

            var model = new ConfigurationModel();

            // stores
            model.AvailableStores.Add(new SelectListItem()
            {
                Text = "*", Value = "0"
            });
            foreach (var store in _storeService.GetAllStores())
            {
                model.AvailableStores.Add(new SelectListItem()
                {
                    Text = store.Name, Value = store.Id.ToString()
                });
            }

            // warehouses
            model.AvailableWarehouses.Add(new SelectListItem()
            {
                Text = "*", Value = "0"
            });
            foreach (var warehouse in _shippingService.GetAllWarehouses())
            {
                model.AvailableWarehouses.Add(new SelectListItem()
                {
                    Text = warehouse.Name, Value = warehouse.Id.ToString()
                });
            }

            // shipping methods
            foreach (var sm in shippingMethods)
            {
                model.AvailableShippingMethods.Add(new SelectListItem()
                {
                    Text = sm.Name, Value = sm.Id.ToString()
                });
            }

            // countries
            model.AvailableCountries.Add(new SelectListItem()
            {
                Text = "*", Value = "0"
            });
            var countries = _countryService.GetAllCountries(showHidden: 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"
            });
            model.LimitMethodsToCreated    = _shippingByTotalSettings.LimitMethodsToCreated;
            model.PrimaryStoreCurrencyCode = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode;

            model.SetGridPageSize();

            return(View("~/Plugins/Shipping.ByTotal/Views/Configure.cshtml", model));
        }