当前位置: 首页>>代码示例>>C#>>正文


C# ManufacturerModel类代码示例

本文整理汇总了C#中ManufacturerModel的典型用法代码示例。如果您正苦于以下问题:C# ManufacturerModel类的具体用法?C# ManufacturerModel怎么用?C# ManufacturerModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ManufacturerModel类属于命名空间,在下文中一共展示了ManufacturerModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_not_have_error_when_pageSizeOptions_is_null_or_empty

 public void Should_not_have_error_when_pageSizeOptions_is_null_or_empty()
 {
     var model = new ManufacturerModel();
     model.PageSizeOptions = null;
     _validator.ShouldNotHaveValidationErrorFor(x => x.PageSizeOptions, model);
     model.PageSizeOptions = "";
     _validator.ShouldNotHaveValidationErrorFor(x => x.PageSizeOptions, model);
 }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:8,代码来源:ManufacturerValidatorTests.cs

示例2: Create

        public ActionResult Create()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
                return AccessDeniedView();

            var model = new ManufacturerModel();
            //locales
            AddLocales(_languageService, model.Locales);
            //templates
            PrepareTemplatesModel(model);
            //default values
            model.PageSize = 4;
            model.Published = true;

            model.AllowCustomersToSelectPageSize = true;
            model.PageSizeOptions = _catalogSettings.DefaultManufacturerPageSizeOptions;

            return View(model);
        }
开发者ID:cole2295,项目名称:nopCommerce-Linux-Mysql,代码行数:19,代码来源:ManufacturerController.cs

示例3: PrepareTemplatesModel

        protected void PrepareTemplatesModel(ManufacturerModel model)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            var templates = _manufacturerTemplateService.GetAllManufacturerTemplates();
            foreach (var template in templates)
            {
                model.AvailableManufacturerTemplates.Add(new SelectListItem()
                {
                    Text = template.Name,
                    Value = template.Id.ToString()
                });
            }
        }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:15,代码来源:ManufacturerController.cs

示例4: PrepareAclModel

        protected virtual void PrepareAclModel(ManufacturerModel model, Manufacturer manufacturer, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            model.AvailableCustomerRoles = _customerService
                .GetAllCustomerRoles(true)
                .Select(cr => cr.ToModel())
                .ToList();
            if (!excludeProperties)
            {
                if (manufacturer != null)
                {
                    model.SelectedCustomerRoleIds = manufacturer.CustomerRoles.ToArray();
                }
            }
        }
开发者ID:grandnode,项目名称:grandnode,代码行数:17,代码来源:ManufacturerController.cs

示例5: PrepareDiscountModel

        protected virtual void PrepareDiscountModel(ManufacturerModel model, Manufacturer manufacturer, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            model.AvailableDiscounts = _discountService
                .GetAllDiscounts(DiscountType.AssignedToManufacturers, showHidden: true)
                .Select(d => d.ToModel())
                .ToList();

            if (!excludeProperties && manufacturer != null)
            {
                model.SelectedDiscountIds = manufacturer.AppliedDiscounts.Select(d => d.Id).ToArray();
            }
        }
开发者ID:aumankit,项目名称:nop,代码行数:15,代码来源:ManufacturerController.cs

示例6: UpdateLocales

        protected virtual List<LocalizedProperty> UpdateLocales(Manufacturer manufacturer, ManufacturerModel model)
        {
            List<LocalizedProperty> localized = new List<LocalizedProperty>();

            foreach (var local in model.Locales)
            {
                if (!(String.IsNullOrEmpty(local.Description)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "Description",
                        LocaleValue = local.Description,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                if (!(String.IsNullOrEmpty(local.MetaDescription)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "MetaDescription",
                        LocaleValue = local.MetaDescription,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                if (!(String.IsNullOrEmpty(local.MetaKeywords)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "MetaKeywords",
                        LocaleValue = local.MetaKeywords,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                if (!(String.IsNullOrEmpty(local.MetaTitle)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "MetaTitle",
                        LocaleValue = local.MetaTitle,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                if (!(String.IsNullOrEmpty(local.Name)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "Name",
                        LocaleValue = local.Name,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                //search engine name
                var seName = manufacturer.ValidateSeName(local.SeName, local.Name, false);
                _urlRecordService.SaveSlug(manufacturer, seName, local.LanguageId);

                if (!(String.IsNullOrEmpty(seName)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "SeName",
                        LocaleValue = seName,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });
            }
            return localized;
        }
开发者ID:grandnode,项目名称:grandnode,代码行数:72,代码来源:ManufacturerController.cs

示例7: Should_not_have_error_when_pageSizeOptions_has_not_duplicate_items

 public void Should_not_have_error_when_pageSizeOptions_has_not_duplicate_items()
 {
     var model = new ManufacturerModel();
     model.PageSizeOptions = "1, 2, 3, 5, 9";
     _validator.ShouldNotHaveValidationErrorFor(x => x.PageSizeOptions, model);
 }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:6,代码来源:ManufacturerValidatorTests.cs

示例8: PrepareStoresMappingModel

        private void PrepareStoresMappingModel(ManufacturerModel model, Manufacturer manufacturer, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            model.AvailableStores = _storeService
                .GetAllStores()
                .Select(s => s.ToModel())
                .ToList();
            if (!excludeProperties)
            {
                if (manufacturer != null)
                {
                    model.SelectedStoreIds = _storeMappingService.GetStoresIdsWithAccess(manufacturer);
                }
                else
                {
                    model.SelectedStoreIds = new int[0];
                }
            }
        }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:21,代码来源:ManufacturerController.cs

示例9: Create

        public ActionResult Create(ManufacturerModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageManufacturers))
                return AccessDeniedView();

            if (ModelState.IsValid)
            {
                var manufacturer = model.ToEntity();
                manufacturer.CreatedOnUtc = DateTime.UtcNow;
                manufacturer.UpdatedOnUtc = DateTime.UtcNow;
                _manufacturerService.InsertManufacturer(manufacturer);
                //search engine name
                model.SeName = manufacturer.ValidateSeName(model.SeName, manufacturer.Name, true);
                _urlRecordService.SaveSlug(manufacturer, model.SeName, 0);
                //locales
                UpdateLocales(manufacturer, model);
                //update picture seo file name
                UpdatePictureSeoNames(manufacturer);
                //ACL (customer roles)
                SaveManufacturerAcl(manufacturer, model);
                //Stores
                SaveStoreMappings(manufacturer, model);

                //activity log
                _customerActivityService.InsertActivity("AddNewManufacturer", _localizationService.GetResource("ActivityLog.AddNewManufacturer"), manufacturer.Name);

                SuccessNotification(_localizationService.GetResource("Admin.Catalog.Manufacturers.Added"));
                return continueEditing ? RedirectToAction("Edit", new { id = manufacturer.Id }) : RedirectToAction("List");
            }

            //If we got this far, something failed, redisplay form
            //templates
            PrepareTemplatesModel(model);
            //ACL
            PrepareAclModel(model, null, true);
            //Stores
            PrepareStoresMappingModel(model, null, true);

            return View(model);
        }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:40,代码来源:ManufacturerController.cs

示例10: Edit

        public ActionResult Edit(ManufacturerModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
                return AccessDeniedView();

            var manufacturer = _manufacturerService.GetManufacturerById(model.Id);
            if (manufacturer == null || manufacturer.Deleted)
                //No manufacturer found with the specified id
                return RedirectToAction("List");

            if (ModelState.IsValid)
            {
                manufacturer = model.ToEntity(manufacturer);
                manufacturer.UpdatedOnUtc = DateTime.UtcNow;
                _manufacturerService.UpdateManufacturer(manufacturer);
                //locales
                UpdateLocales(manufacturer, model);
                //update picture seo file name
                UpdatePictureSeoNames(manufacturer);

                //activity log
                _customerActivityService.InsertActivity("EditManufacturer", _localizationService.GetResource("ActivityLog.EditManufacturer"), manufacturer.Name);

                SuccessNotification(_localizationService.GetResource("Admin.Catalog.Manufacturers.Updated"));
                return continueEditing ? RedirectToAction("Edit", manufacturer.Id) : RedirectToAction("List");
            }

            //If we got this far, something failed, redisplay form
            //templates
            PrepareTemplatesModel(model);

            return View(model);
        }
开发者ID:pquic,项目名称:qCommerce,代码行数:33,代码来源:ManufacturerController.cs

示例11: ProductAddPopupList

        public ActionResult ProductAddPopupList(GridCommand command, ManufacturerModel.AddManufacturerProductModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
                return AccessDeniedView();

            var gridModel = new GridModel();
            IList<int> filterableSpecificationAttributeOptionIds = null;
            var products = _productService.SearchProducts(model.SearchCategoryId,
                model.SearchManufacturerId, null, null, null, 0, model.SearchProductName, false, false,
                _workContext.WorkingLanguage.Id, new List<int>(),
                ProductSortingEnum.Position, command.Page - 1, command.PageSize,
                false, out filterableSpecificationAttributeOptionIds, true);
            gridModel.Data = products.Select(x => x.ToModel());
            gridModel.Total = products.TotalCount;
            return new JsonResult
            {
                Data = gridModel
            };
        }
开发者ID:cole2295,项目名称:nopCommerce-Linux-Mysql,代码行数:19,代码来源:ManufacturerController.cs

示例12: PrepareAclModel

        protected virtual void PrepareAclModel(ManufacturerModel model, Manufacturer manufacturer, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            if (!excludeProperties && manufacturer != null)
                model.SelectedCustomerRoleIds = _aclService.GetCustomerRoleIdsWithAccess(manufacturer).ToList();

            var allRoles = _customerService.GetAllCustomerRoles(true);
            foreach (var role in allRoles)
            {
                model.AvailableCustomerRoles.Add(new SelectListItem
                {
                    Text = role.Name,
                    Value = role.Id.ToString(),
                    Selected = model.SelectedCustomerRoleIds.Contains(role.Id)
                });
            }
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:19,代码来源:ManufacturerController.cs

示例13: PrepareStoresMappingModel

        protected virtual void PrepareStoresMappingModel(ManufacturerModel model, Manufacturer manufacturer, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            if (!excludeProperties && manufacturer != null)
                model.SelectedStoreIds = _storeMappingService.GetStoresIdsWithAccess(manufacturer).ToList();

            var allStores = _storeService.GetAllStores();
            foreach (var store in allStores)
            {
                model.AvailableStores.Add(new SelectListItem
                {
                    Text = store.Name,
                    Value = store.Id.ToString(),
                    Selected = model.SelectedStoreIds.Contains(store.Id)
                });
            }
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:19,代码来源:ManufacturerController.cs

示例14: PrepareDiscountModel

        protected virtual void PrepareDiscountModel(ManufacturerModel model, Manufacturer manufacturer, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            if (!excludeProperties && manufacturer != null)
                model.SelectedDiscountIds = manufacturer.AppliedDiscounts.Select(d => d.Id).ToList();

            foreach (var discount in _discountService.GetAllDiscounts(DiscountType.AssignedToManufacturers, showHidden: true))
            {
                model.AvailableDiscounts.Add(new SelectListItem
                {
                    Text = discount.Name,
                    Value = discount.Id.ToString(),
                    Selected = model.SelectedDiscountIds.Contains(discount.Id)
                });
            }
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:18,代码来源:ManufacturerController.cs

示例15: Edit

        public ActionResult Edit(ManufacturerModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
                return AccessDeniedView();

            var manufacturer = _manufacturerService.GetManufacturerById(model.Id);
            if (manufacturer == null || manufacturer.Deleted)
                return RedirectToAction("List");

            if (ModelState.IsValid)
            {
                manufacturer = model.ToEntity(manufacturer);
                MediaHelper.UpdatePictureTransientStateFor(manufacturer, m => m.PictureId);
                manufacturer.UpdatedOnUtc = DateTime.UtcNow;
                _manufacturerService.UpdateManufacturer(manufacturer);

                //search engine name
                model.SeName = manufacturer.ValidateSeName(model.SeName, manufacturer.Name, true);
                _urlRecordService.SaveSlug(manufacturer, model.SeName, 0);

                //locales
                UpdateLocales(manufacturer, model);

                //update picture seo file name
                UpdatePictureSeoNames(manufacturer);

                //Stores
                _storeMappingService.SaveStoreMappings<Manufacturer>(manufacturer, model.SelectedStoreIds);

                //activity log
                _customerActivityService.InsertActivity("EditManufacturer", _localizationService.GetResource("ActivityLog.EditManufacturer"), manufacturer.Name);

                NotifySuccess(_localizationService.GetResource("Admin.Catalog.Manufacturers.Updated"));
                return continueEditing ? RedirectToAction("Edit", manufacturer.Id) : RedirectToAction("List");
            }

            //If we got this far, something failed, redisplay form
            //templates
            PrepareTemplatesModel(model);
            PrepareManufacturerModel(model, manufacturer, true);

            return View(model);
        }
开发者ID:mandocaesar,项目名称:Mesinku,代码行数:43,代码来源:ManufacturerController.cs


注:本文中的ManufacturerModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。