public IActionResult Index(DataSourceRequest command)
        {
            if (!(bool)SharedData.isEquipmentMenuAccessible)
            {
                return(AccessDeniedView());
            }
            ViewBag.FormName = "Equipment";
            var model = new EquipmentListModel();

            ViewBag.PageSizeDropdown = SelectListHelper.GetPageSizeDropdown(command.PageSize.ToString());

            var PagedList = _reportService.GetAllEquipments(
                keywords: "",
                page_num: command.Page,
                page_size: command.PageSize,
                GetAll: command.PageSize == 0 ? true : false
                );

            model.List = PagedList.List.GetPaged(command.Page, command.PageSize, PagedList.TotalRecords);

            return(View(model));
        }
Пример #2
0
        public ActionResult CustomMatchup(Guid playerId, Guid matchupId)
        {
            ViewBag.PlayerId = playerId;
            var dal          = new DAL();
            var champPoolDal = new DALChampionPool();
            var playerDal    = new DAL();

            ViewBag.MyChampList   = champPoolDal.getChampionPool(playerId);
            ViewBag.ListChampions = SelectListHelper.getAllChampions();
            var player = playerDal.getPlayerById(playerId);

            ViewBag.Role     = player?.Role;
            ViewBag.Nickname = player?.Nickname;
            if (matchupId != Guid.Empty)
            {
                var matchupDal = new DALMatchup();
                var matchup    = matchupDal.getMatchupByMatchupId(matchupId);
                ViewBag.MatchupId = matchupId;
                return(View("Matchup", matchup));
            }
            return(RedirectToAction("Matchup", new { matchupId = matchupId }));
        }
Пример #3
0
        protected virtual void PrepareProductCategoriesModel(ProductCategoryViewModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            if (model.ParentList == null)
            {
                model.ParentList = new List <SelectListItem>();
            }
            model.ParentList.Add(new SelectListItem
            {
                Text  = "Chưa chọn danh mục",
                Value = ""
            });
            var categories = SelectListHelper.GetCategoryList(_productCategoryService);

            foreach (var c in categories)
            {
                model.ParentList.Add(c);
            }
        }
Пример #4
0
        public ActionResult DecodeProcessingTruckManual()
        {
            if (Session["Dealership"] != null)
            {
                var viewModel = new AppraisalViewFormModel
                {
                    VinDecodeSuccess = false,
                    AppraisalDate    = DateTime.Now.ToShortDateString(),
                    TruckTypeList    = SelectListHelper.InitalTruckTypeList()
                };

                viewModel.TruckCategoryList = SelectListHelper.InitalTruckCategoryList(SQLHelper.GetListOfTruckCategoryByTruckType(viewModel.TruckTypeList.First().Value));

                viewModel.TruckClassList = SelectListHelper.InitalTruckClassList();

                viewModel.IsTruck = true;

                return(View("ManualAppraisalForTruck", viewModel));
            }

            return(RedirectToAction("LogOff", "Account"));
        }
Пример #5
0
        public ActionResult DecodeProcessingByYear(string year)
        {
            if (Session["Dealership"] != null)
            {
                if (!SessionHandler.Single)
                {
                    return(RedirectToAction("ViewInventoryForAllStores", "Inventory"));
                }

                var autoService = new ChromeAutoService();

                int modelYear = Convert.ToInt16(year);

                var divisionList = autoService.GetDivisions(modelYear);

                var viewModel = new AppraisalViewFormModel
                {
                    VinDecodeSuccess  = false,
                    MakeList          = SelectListHelper.InitialMakeList(divisionList),
                    ModelList         = new List <SelectListItem>().AsEnumerable(),
                    TrimList          = new List <SelectListItem>().AsEnumerable(),
                    ExteriorColorList = new List <SelectListItem>().AsEnumerable(),
                    InteriorColorList = new List <SelectListItem>().AsEnumerable(),
                    FuelList          = new List <SelectListItem>().AsEnumerable(),
                    CylinderList      = new List <SelectListItem>().AsEnumerable(),
                    LitersList        = new List <SelectListItem>().AsEnumerable(),
                    BodyTypeList      = new List <SelectListItem>().AsEnumerable(),
                    DriveTrainList    = new List <SelectListItem>().AsEnumerable(),
                    ModelYear         = modelYear,
                    AppraisalDate     = DateTime.Now.ToShortDateString()
                };

                return(View("NewAppraisalByYear", viewModel));
            }
            else
            {
                return(RedirectToAction("LogOff", "Account"));
            }
        }
Пример #6
0
        public IActionResult EmailTemplateEditor(int emailTemplateId)
        {
            var emailTemplate = emailTemplateId > 0 ? _emailTemplateService.Get(emailTemplateId) : new EmailTemplate();

            if (emailTemplate == null)
            {
                return(NotFound());
            }
            var model = _modelMapper.Map <EmailTemplateModel>(emailTemplate);

            if (emailTemplate.ParentEmailTemplate != null)
            {
                model.ParentEmailTemplate = _modelMapper.Map <EmailTemplateModel>(emailTemplate.ParentEmailTemplate);
            }

            model.EmailAccount = _modelMapper.Map <EmailAccountModel>(emailTemplate.EmailAccount);
            //available email accounts
            var emailAccounts          = _emailAccountService.Get(x => true).OrderBy(x => x.Email).ToList();
            var availableEmailAccounts = SelectListHelper.GetSelectItemList(emailAccounts, x => x.Id, x => x.Email);

            //available master templates
            var masterTemplates          = _emailTemplateService.Get(x => x.IsMaster).OrderBy(x => x.TemplateName).ToList();
            var availableMasterTemplates =
                SelectListHelper.GetSelectItemList(masterTemplates, x => x.Id, x => x.TemplateName);

            var isAdminEmailRequired = emailTemplate.TemplateSystemName != null &&
                                       ((emailTemplate.TemplateSystemName.EndsWith(EmailTemplateNames.AdminSuffix) && emailTemplate.IsSystem) ||
                                        (emailTemplate.TemplateSystemName.EndsWith(EmailTemplateNames.AdminSuffix)));
            //available tokens
            var tokens = _emailTemplateService.GetTemplateTokens(emailTemplate.TemplateSystemName).OrderBy(x => x);

            return(R.Success.With("emailTemplate", model)
                   .With("availableEmailAccounts", availableEmailAccounts)
                   .With("availableMasterTemplates", availableMasterTemplates)
                   .With("availableTokens", tokens)
                   .With("adminEmailRequired", isAdminEmailRequired)
                   .Result);
        }
Пример #7
0
        public IActionResult CatalogEditor(int catalogId)
        {
            var catalog = catalogId > 0 ? _catalogService.Get(catalogId) : new Catalog();

            if (catalog == null)
            {
                return(NotFound());
            }
            var catalogModel    = _catalogModelFactory.Create(catalog);
            var stores          = _storeService.Get(x => true).ToList();
            var catalogStoreIds = catalog.Stores?.Select(x => x.Id).ToList() ?? new List <int>();
            var availableStores = SelectListHelper.GetSelectItemList(stores, x => x.Id, x => x.Name)
                                  .Select(x =>
            {
                if (catalogStoreIds.Any(y => y.ToString() == x.Value))
                {
                    x.Selected = true;
                }
                return(x);
            }).ToList();

            return(R.Success.With("catalog", catalogModel).With("availableStores", availableStores).Result);
        }
Пример #8
0
        public IActionResult ContentPageEditor(int contentPageId)
        {
            var contentPage = contentPageId > 0 ? _contentPageService.Get(contentPageId) : new ContentPage();

            if (contentPage == null)
            {
                return(NotFound());
            }
            var model = PrepareModel(contentPage);
            //get all pages to make a tree
            var availablePages    = _contentPageService.Get(x => x.Id != contentPageId).ToList().GetWithParentTree();
            var contentPageModels =
                SelectListHelper.GetSelectItemListWithAction(availablePages, x => x.Id, x => x.GetNameBreadCrumb())
                .OrderBy(x => x.Text).ToList();
            var storeIds = contentPage.Stores?.Select(x => x.Id).ToList();

            model.StoreIds = storeIds;
            return(R.Success.With("contentPage", model)
                   .With("availablePages", contentPageModels)
                   .WithAvailableStores(storeIds)
                   .WithActiveThemeTemplates()
                   .Result);
        }
Пример #9
0
        public async Task <IActionResult> Edit(string url, string operation = null)
        {
            SpeedWagonContent contentType = await this._speedWagon.ContentTypeService.Get(url);

            IEnumerable <SpeedWagonContent> editors = await this._speedWagon.EditorService.List();

            IEnumerable <SpeedWagonContent> contentTypes = await this._speedWagon.ContentTypeService.List();

            EditContentTypeViewModel viewModel = new EditContentTypeViewModel();

            viewModel.Operation   = operation;
            viewModel.ContentType = contentType;
            viewModel.Root        = contentType.GetValue <bool>("Root");
            viewModel.Children    = contentType.GetValue <string[]>("Children");
            viewModel.Name        = contentType.Name;
            viewModel.Url         = url;

            viewModel.AvailableContentTypes = SelectListHelper.GetSelectList(contentTypes);
            viewModel.AvailableEditors      = SelectListHelper.GetSelectList(editors);
            viewModel.Editors = this._speedWagon.ContentTypeService.GetEditors(contentType);

            return(View("~/Views/SpeedWagon/ContentType/Edit.cshtml", viewModel));
        }
Пример #10
0
        public IActionResult StockReport(StockReportSearchModel searchModel)
        {
            searchModel = searchModel ?? new StockReportSearchModel();
            //get availalbe warehouses
            var warehouses = _warehouseService.Get(x => true).ToList();

            if (searchModel.WarehouseId < 1)
            {
                searchModel.WarehouseId = warehouses.First().Id;
            }
            var products = _productService.GetProductsWithVariants(out int totalResults, searchModel.WarehouseId, searchModel.ProductSearch,
                                                                   searchModel.Published, true, page: searchModel.Current, count: searchModel.RowCount);


            var models = products.Select(_reportModelFactory.Create).ToList();

            var warehouseModels = SelectListHelper.GetSelectItemListWithAction(warehouses, x => x.Id, x => x.Address.Name);

            return(R.Success.WithGridResponse(totalResults, searchModel.Current, searchModel.RowCount)
                   .With("reportItems", models)
                   .With("availableWarehouses", warehouseModels)
                   .Result);
        }
        public async Task <IActionResult> Add(ContentViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                SpeedWagonContent contentRoot = await this._speedWagon.WebContentService.GetContent(viewModel.Parent);

                IEnumerable <SpeedWagonContent> contents = await this._speedWagon.ContentService.Children(contentRoot);

                IEnumerable <SpeedWagonContent> contentTypes = await this._speedWagon.ContentTypeService.List();

                IList <SelectListItem> contentTypeSelct = SelectListHelper.GetSelectList(contentTypes);

                viewModel.AvailableContentTypes = contentTypeSelct;
                viewModel.Content        = contentRoot;
                viewModel.Contents       = contents;
                viewModel.ContentService = this._speedWagon.ContentService;

                return(View("~/Views/SpeedWagon/Content/List.cshtml", viewModel));
            }

            this._speedWagon.WebContentService.Add(viewModel.Parent, viewModel.Name, viewModel.Type, User.Identity.Name.MaskEmail());
            return(RedirectToAction("List", "SpeedWagonContent", new { url = viewModel.Parent }));
        }
Пример #12
0
        public async Task PrepareModelAsync(ProductEditModel model, Product product, User seller)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

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

            if (product != null)
            {
                model        = _mapper.Map(product, model);
                model.Images = product.Images.ToList();
                model.TagNames.AddRange(product.Tags.Select(x => x.Name));
            }
            else
            {
                model.Published = true;
                model.Stock     = ProductStock.InStock;
            }

            model.StockOptions.AddRange(SelectListHelper.GetEnumSelectList <ProductStock>(selectedEnum: model.Stock));

            var categoryNames = (await _categoryService.ListAsync(new CategoryFilter {
                SellerId = seller.Id
            })).Select(x => x.Name).Distinct();
            var tagNames      = (await _tagService.ListAsync(new TagFilter {
                SellerId = seller.Id
            })).Select(x => x.Name).Distinct();

            tagNames = categoryNames.Concat(tagNames).Distinct(StringComparer.InvariantCultureIgnoreCase);

            model.TagOptions.AddRange(SelectListHelper.GetSelectList(tagNames, x => new SelectListItem <string>(text: x, value: x)));
        }
Пример #13
0
        public Task PrepareModelAsync(BannerListModel model, IPageable <Banner> banners)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            if (banners == null)
            {
                throw new ArgumentNullException(nameof(banners));
            }

            foreach (var banner in banners)
            {
                var bannerModel = new BannerModel
                {
                    Banner = banner
                };
                model.Items.Add(bannerModel);
            }

            var imageSize     = model.Filter.Size.GetValueOrDefault();
            var imageSizeInfo = AttributeHelper.GetMemberAttribute <ImageSizeAttribute>(typeof(BannerSize).GetMember(imageSize.ToString())[0]);

            model.ImageWidth  += imageSizeInfo.Width;
            model.ImageHeight += imageSizeInfo.Height;

            model.SizeOptions.AddRange(SelectListHelper.GetEnumSelectList(selectedEnum: model.Filter.Size, defaultText: "All"));

            model.Page       = banners.Page;
            model.PageSize   = banners.PageSize;
            model.PageFrom   = banners.PageFrom;
            model.PageTo     = banners.PageTo;
            model.TotalPages = banners.TotalPages;
            model.TotalItems = banners.TotalItems;

            return(Task.CompletedTask);
        }
Пример #14
0
        public ActionResult Edit(int?Id)
        {
            var DocumentField = DocumentFieldRepository.GetDocumentFieldById(Id.Value);

            if (DocumentField != null && DocumentField.IsDeleted != true)
            {
                var model = new DocumentFieldViewModel();
                AutoMapper.Mapper.Map(DocumentField, model);
                if (model.Category == "Contract")
                {
                    model.DetailCategoryList = SelectListHelper.GetSelectList_Contract(model.CategoryId);
                }
                else if (model.Category == "LabourContract")
                {
                    model.DetailCategoryList = SelectListHelper.GetSelectList_LabourContract(model.CategoryId, App_GlobalResources.Wording.Empty);
                }
                else if (model.Category == "InternalNotifications")
                {
                    model.DetailCategoryList = SelectListHelper.GetSelectList_InternalNotifications(model.CategoryId, App_GlobalResources.Wording.Empty);
                }
                else
                {
                    model.DetailCategoryList = new List <SelectListItem>();
                }
                //if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1)
                //{
                //    TempData["FailedMessage"] = "NotOwner";
                //    return RedirectToAction("Index");
                //}
                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }
Пример #15
0
        public async Task PrepareModelAsync(UserListModel model, IPageable <User> users, Func <UserModel, User, Task> prepareChildModel = null)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            if (users == null)
            {
                throw new ArgumentNullException(nameof(users));
            }

            foreach (var user in users)
            {
                var userModel = new UserModel
                {
                    User = user
                };

                if (prepareChildModel != null)
                {
                    await prepareChildModel(userModel, user);
                }

                model.Items.Add(userModel);
            }

            model.StoreCategoryOptions.AddRange(SelectListHelper.GetEnumSelectList(selectedEnum: model.Filter.StoreCategory, defaultText: "All"));
            model.StoreSetupOptions.AddRange(SelectListHelper.GetBoolSelectList("Completed", "Not Completed", selectedBool: model.Filter.StoreSetup, defaultText: "Any"));

            model.Page       = users.Page;
            model.PageSize   = users.PageSize;
            model.PageFrom   = users.PageFrom;
            model.PageTo     = users.PageTo;
            model.TotalPages = users.TotalPages;
            model.TotalItems = users.TotalItems;
        }
Пример #16
0
        public Task PrepareModelAsync(StoreEditModel model, User user)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            model = _mapper.Map(user, model);

            model.StoreDeliveryRequiredOptions.AddRange(SelectListHelper.GetBoolSelectList("Required", "Not Required", selectedBool: model.StoreDeliveryRequired));
            model.StoreStatusOptions.AddRange(SelectListHelper.GetEnumSelectList <StoreStatus>(selectedEnum: model.StoreStatus));

            model.StoreThemeModeOptions.AddRange(SelectListHelper.GetEnumSelectList <ThemeMode>(selectedEnum: model.StoreThemeMode));
            model.StoreThemeStyleOptions.AddRange(SelectListHelper.GetEnumSelectList <ThemeStyle>(selectedEnum: model.StoreThemeStyle));

            model.StoreCategorySelections.AddRange(user.StoreCategory.ExpandEnum());
            model.StoreCategoryOptions.AddRange(SelectListHelper.GetEnumSelectList <StoreCategory>(selectedEnum: user.StoreCategory));

            return(Task.CompletedTask);
        }
Пример #17
0
        public static IHtmlString Render(HtmlHelper html, ISelectListBuilder selectListBuilder, FormGroupDisplay display, string expressionText, Func <MvcHtmlString> hiddenField)
        {
            bool readOnlyMode = display == FormGroupDisplay.ReadOnly, labelWithHiddenFieldMode = display == FormGroupDisplay.LabelWithHiddenField;

            if (readOnlyMode || labelWithHiddenFieldMode)
            {
                var builder = new HtmlTagBuilder("div");

                builder.Attr(selectListBuilder.HtmlAttributes);

                IEnumerable <SelectListItem> selectList = SelectListHelper.GetSelectListItems(html, selectListBuilder, expressionText);

                builder.InternalBuilder.InnerHtml = GetDisplayText(selectList);

                if (labelWithHiddenFieldMode)
                {
                    builder.InternalBuilder.InnerHtml += hiddenField();
                }

                return(MvcHtmlString.Create(builder.ToHtmlString()));
            }

            return(selectListBuilder.AddClass("form-control"));
        }
Пример #18
0
        public ActionResult ProductAddPopup(int discountId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageDiscounts))
            {
                return(AccessDeniedView());
            }

            var model = new DiscountModel.AddProductToDiscountModel();

            //categories
            model.AvailableCategories.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            var categories = SelectListHelper.GetCategoryList(_categoryService, _cacheManager, true);

            foreach (var c in categories)
            {
                model.AvailableCategories.Add(c);
            }

            //manufacturers
            model.AvailableManufacturers.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            foreach (var m in _manufacturerService.GetAllManufacturers(showHidden: true))
            {
                model.AvailableManufacturers.Add(new SelectListItem {
                    Text = m.Name, Value = m.Id.ToString()
                });
            }

            //stores
            model.AvailableStores.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            foreach (var s in _storeService.GetAllStores())
            {
                model.AvailableStores.Add(new SelectListItem {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }

            //vendors
            model.AvailableVendors.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            foreach (var v in _vendorService.GetAllVendors(showHidden: true))
            {
                model.AvailableVendors.Add(new SelectListItem {
                    Text = v.Name, Value = v.Id.ToString()
                });
            }

            //product types
            model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList(false).ToList();
            model.AvailableProductTypes.Insert(0, new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });

            return(View(model));
        }
 public ActionResult OgretimGorevlisiEkle()
 {
     ViewBag.Fakulteler = SelectListHelper.GetirFakulteler();
     return(View());
 }
Пример #20
0
        private IActionResult GetSettingResult(string settingType)
        {
            SettingsModel model    = null;
            ISettingGroup settings = null;
            var           result   = R.Success;

            switch (settingType)
            {
            case "general":
                settings = DependencyResolver.Resolve <GeneralSettings>();
                model    = _modelMapper.Map <GeneralSettingsModel>(settings);
                var menuService = DependencyResolver.Resolve <IMenuService>();

                var menus          = menuService.Get(x => true).ToList();
                var menuSelectList = SelectListHelper.GetSelectItemList(menus, x => x.Id, x => x.Name);
                result.WithTimezones();
                result.With("availableMenus", menuSelectList);

                //get themes
                var themes = _themeProvider.GetAvailableThemes()
                             .Select(x => new ThemeInfoModel()
                {
                    DirectoryName  = x.DirectoryName,
                    Name           = x.Name,
                    ThumbnailUrl   = x.ThumbnailUrl,
                    PendingRestart = x.PendingRestart
                }).ToList();
                result.With("availableThemes", themes);
                break;

            case "order":
                settings = DependencyResolver.Resolve <OrderSettings>();
                result.WithAvailableOrderStatusTypes();
                model = _modelMapper.Map <OrderSettingsModel>(settings);
                break;

            case "user":
                settings = DependencyResolver.Resolve <UserSettings>();
                model    = _modelMapper.Map <UserSettingsModel>(settings);
                result.WithRegistrationModes();
                break;

            case "url":
                settings = DependencyResolver.Resolve <UrlSettings>();
                model    = _modelMapper.Map <UrlSettingsModel>(settings);
                break;

            case "media":
                settings = DependencyResolver.Resolve <MediaSettings>();
                model    = _modelMapper.Map <MediaSettingsModel>(settings);
                break;

            case "tax":
                settings = DependencyResolver.Resolve <TaxSettings>();
                var taxService      = DependencyResolver.Resolve <ITaxService>();
                var taxes           = taxService.Get(x => true).ToList();
                var taxesSelectList = SelectListHelper.GetSelectItemList(taxes, x => x.Id, x => x.Name);
                model = _modelMapper.Map <TaxSettingsModel>(settings);
                result.With("availableTaxes", taxesSelectList);
                break;

            case "email":
                settings = DependencyResolver.Resolve <EmailSenderSettings>();
                model    = _modelMapper.Map <EmailSettingsModel>(settings);
                result.WithEmailAccounts();
                break;

            case "catalog":
                settings = DependencyResolver.Resolve <CatalogSettings>();
                model    = _modelMapper.Map <CatalogSettingsModel>(settings);
                result.WithCatalogPaginationTypes();
                break;

            case "localization":
                settings = DependencyResolver.Resolve <LocalizationSettings>();
                model    = _modelMapper.Map <LocalizationSettingsModel>(settings);
                var currencyService      = DependencyResolver.Resolve <ICurrencyService>();
                var currencies           = currencyService.Get(x => x.Published).ToList();
                var currenciesSelectList = SelectListHelper.GetSelectItemListWithAction(currencies, x => x.Id, x => $"{x.Name} ({x.IsoCode})");
                result.With("availableCurrencies", currenciesSelectList);

                result.WithCatalogPaginationTypes();
                break;

            case "gdpr":
                settings = DependencyResolver.Resolve <GdprSettings>();
                model    = _modelMapper.Map <GdprSettingsModel>(settings);
                var consentGroupService = DependencyResolver.Resolve <IConsentGroupService>();
                var consentGroups       = consentGroupService.Get(x => true).ToList();
                var groupSelectList     = SelectListHelper.GetSelectItemList(consentGroups, x => x.Id, x => x.Name);
                result.With("availableConsentGroups", groupSelectList);
                break;

            case "security":
                settings = DependencyResolver.Resolve <SecuritySettings>();
                model    = _modelMapper.Map <SecuritySettingsModel>(settings);
                break;

            case "affiliate":
                settings = DependencyResolver.Resolve <AffiliateSettings>();
                model    = _modelMapper.Map <AffiliateSettingsModel>(settings);
                break;
            }

            return(result.With("settings", model).With("settingType", settingType).Result);
        }
Пример #21
0
        public IActionResult DiscountEditor(int discountId)
        {
            var discount = discountId > 0 ? _discountCouponService.Get(discountId) : new DiscountCoupon();

            if (discount == null)
            {
                return(NotFound());
            }

            var discountModel             = _modelMapper.Map <DiscountModel>(discount);
            var availableCalculationTypes = SelectListHelper.GetSelectItemList <CalculationType>();
            var availableRestrictionTypes = SelectListHelper.GetSelectItemList <RestrictionType>();

            //fetch the additional data if it's an existing discount
            if (discount.Id > 0)
            {
                switch (discount.RestrictionType)
                {
                case RestrictionType.Products:
                    var productIds = discount.RestrictionIds();
                    if (!productIds.Any())
                    {
                        break;
                    }
                    var products = _productService.Get(x => productIds.Contains(x.Id));
                    discountModel.RestrictionValues = products.Select(x => new RestrictionValueModel()
                    {
                        Name = x.Name,
                        RestrictionIdentifier = x.Id.ToString()
                    })
                                                      .ToList();
                    break;

                case RestrictionType.Categories:
                    var categoryIds = discount.RestrictionIds();
                    if (!categoryIds.Any())
                    {
                        break;
                    }
                    var allCategories = _categoryService.GetFullCategoryTree()
                                        .Where(x => categoryIds.Contains(x.Id));
                    discountModel.RestrictionValues = allCategories.Select(x => new RestrictionValueModel()
                    {
                        Name = _categoryAccountant.GetFullBreadcrumb(x),
                        RestrictionIdentifier = x.Id.ToString()
                    })
                                                      .ToList();
                    break;

                case RestrictionType.Users:
                    var userIds = discount.RestrictionIds();
                    if (!userIds.Any())
                    {
                        break;
                    }
                    var users = _userService.Get(x => userIds.Contains(x.Id));
                    discountModel.RestrictionValues = users.Select(x => new RestrictionValueModel()
                    {
                        Name = $"{x.Name} ({x.Email})",
                        RestrictionIdentifier = x.Id.ToString()
                    })
                                                      .ToList();
                    break;

                case RestrictionType.UserGroups:
                    break;

                case RestrictionType.Roles:
                    var roleIds = discount.RestrictionIds();
                    if (!roleIds.Any())
                    {
                        break;
                    }
                    var roles = _roleService.Get(x => roleIds.Contains(x.Id));
                    discountModel.RestrictionValues = roles.Select(x => new RestrictionValueModel()
                    {
                        Name = $"{x.Name}",
                        RestrictionIdentifier = x.Id.ToString()
                    })
                                                      .ToList();
                    break;

                case RestrictionType.Vendors:
                    var vendorIds = discount.RestrictionIds();
                    if (!vendorIds.Any())
                    {
                        break;
                    }
                    var vendors = _vendorService.Get(x => vendorIds.Contains(x.Id));
                    discountModel.RestrictionValues = vendors.Select(x => new RestrictionValueModel()
                    {
                        Name = $"{x.Name}",
                        RestrictionIdentifier = x.Id.ToString()
                    })
                                                      .ToList();
                    break;

                case RestrictionType.Manufacturers:
                    var manufacturerIds = discount.RestrictionIds();
                    if (!manufacturerIds.Any())
                    {
                        break;
                    }
                    var manufacturers = _vendorService.Get(x => manufacturerIds.Contains(x.Id));
                    discountModel.RestrictionValues = manufacturers.Select(x => new RestrictionValueModel()
                    {
                        Name = $"{x.Name}",
                        RestrictionIdentifier = x.Id.ToString()
                    })
                                                      .ToList();
                    break;

                case RestrictionType.PaymentMethods:
                    break;

                case RestrictionType.ShippingMethods:
                    break;

                case RestrictionType.OrderTotal:
                    break;

                case RestrictionType.OrderSubTotal:
                    break;
                }
            }

            return(R.Success.With("discount", discountModel)
                   .With("availableCalculationTypes", availableCalculationTypes)
                   .With("availableRestrictionTypes", availableRestrictionTypes)
                   .Result);
        }
Пример #22
0
 public ActionResult BolumEkle()
 {
     ViewBag.Fakulteler = SelectListHelper.GetirFakulteler();
     return(View());
 }
Пример #23
0
 private void InitViewBags()
 {
     ViewBag.UserType       = SelectListHelper.UserTypes();
     ViewBag.GeneralManager = SelectListHelper.GeneralManagers();
 }
Пример #24
0
 public UserSearchModel()
 {
     OrderByFields = SelectListHelper.GetFields <UserOrderByField>();
     OrderBy       = new ColumnOrder(OrderByFields.First().Value);
 }
Пример #25
0
 // GET: Customer/Create
 public async Task <IActionResult> Create()
 {
     ViewData["idAddress"] = SelectListHelper.SelectListAddresses(await addressBusiness.GetAddresses());
     ViewData["idCountry"] = SelectListHelper.SelectListCountries(await countryBusiness.GetCountries());
     return(View());
 }
Пример #26
0
        public virtual ActionResult ArticleAddPopup(int publisherId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePublishers))
            {
                return(AccessDeniedView());
            }

            var model = new PublisherModel.AddPublisherArticleModel();

            //categories
            model.AvailableCategories.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            var categories = SelectListHelper.GetCategoryList(_categoryService, _cacheManager, true);

            foreach (var c in categories)
            {
                model.AvailableCategories.Add(c);
            }

            //publishers
            model.AvailablePublishers.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            var publishers = SelectListHelper.GetPublisherList(_publisherService, _cacheManager, true);

            foreach (var m in publishers)
            {
                model.AvailablePublishers.Add(m);
            }

            //stores
            model.AvailableStores.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            foreach (var s in _storeService.GetAllStores())
            {
                model.AvailableStores.Add(new SelectListItem {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }

            //contributors
            model.AvailableContributors.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            var contributors = SelectListHelper.GetContributorList(_contributorService, _cacheManager, true);

            foreach (var v in contributors)
            {
                model.AvailableContributors.Add(v);
            }

            //article types
            model.AvailableArticleTypes = ArticleType.SimpleArticle.ToSelectList(false).ToList();
            model.AvailableArticleTypes.Insert(0, new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });

            return(View(model));
        }
        // Dropdownlist
        private static MvcHtmlString dropdown(HtmlHelper html, ConfiguracaoAssociadoCampo OCampo)
        {
            var attrs = new Dictionary <string, object>(); // {@class = OCampo.cssClassField, id = OCampo.idDOM};

            attrs.Add("class", OCampo.cssClassCampo + (OCampo.flagMultiSelect == true ? " input-multiselect" : ""));

            attrs.Add("id", OCampo.idDOM);

            string postedValue = html.ViewContext.HttpContext.Request[OCampo.name] ?? "";

            string valorPadrao = postedValue.isEmpty()? OCampo.valorPadrao: postedValue;

            string valorAtual = OCampo.valorAtual.isEmpty() ? valorPadrao : OCampo.valorAtual;

            if (!valorAtual.isEmpty())
            {
                attrs.Add("data-selected", valorAtual);
            }

            if (OCampo.flagReadOnly == true)
            {
                attrs.Add("disabled", "disabled");
                OCampo.name = String.Concat(OCampo.name, "Display");
            }

            if (OCampo.flagReadOnly != true)
            {
                var listaPropriedades = OCampo.listaCampoPropriedades.Where(x => x.dtExclusao == null).ToList();

                foreach (var Prop in listaPropriedades)
                {
                    attrs.Add(Prop.nome, Prop.valor.decodeString());
                }
            }

            SelectList      listaItens      = new SelectList(new object[] { "" });
            MultiSelectList listaMultiItens = new MultiSelectList(new object[] { "" });

            MvcHtmlString ddRetorno;

            if (OCampo.flagMultiSelect == true)
            {
                if (OCampo.idTipoCampo == ConfiguracaoTipoCampoConst.SELECT_DINAMICO && !OCampo.nameHelper.isEmpty())
                {
                    listaMultiItens = SelectListHelper.multiSelectListDinamico(OCampo.nameHelper, OCampo.methodHelper, OCampo.parametrosHelper, valorAtual, html.ViewContext.HttpContext.Request.Form);
                }

                if (OCampo.idTipoCampo == ConfiguracaoTipoCampoConst.SELECT_FIXO)
                {
                    var listaOpcoes = OCampo.listaCampoOpcoes.Where(x => x.dtExclusao == null).ToList();

                    if (listaOpcoes.Any())
                    {
                        listaMultiItens = new MultiSelectList(listaOpcoes, "value", "texto", valorAtual);
                    }
                }

                ddRetorno = html.ListBox(OCampo.name, listaMultiItens, attrs);
            }
            else
            {
                if (OCampo.idTipoCampo == ConfiguracaoTipoCampoConst.SELECT_DINAMICO && !OCampo.nameHelper.isEmpty())
                {
                    listaItens = SelectListHelper.selectListDinamico(OCampo.nameHelper, OCampo.methodHelper, OCampo.parametrosHelper, valorAtual, html.ViewContext.HttpContext.Request.Form);
                }

                if (OCampo.idTipoCampo == ConfiguracaoTipoCampoConst.SELECT_FIXO)
                {
                    var listaOpcoes = OCampo.listaCampoOpcoes.Where(x => x.dtExclusao == null).ToList();

                    if (listaOpcoes.Any())
                    {
                        listaItens = new SelectList(listaOpcoes, "value", "texto", valorAtual);
                    }
                }

                if (OCampo.flagExibirOptionVazio == true)
                {
                    ddRetorno = html.DropDownList(OCampo.name, listaItens, "...", attrs);
                }
                else
                {
                    ddRetorno = html.DropDownList(OCampo.name, listaItens, attrs);
                }
            }

            return(new MvcHtmlString(ddRetorno.ToHtmlString().decodeString()));
        }
Пример #28
0
 private void LoadEmployeeCombo(string companyStr, string branchStr, bool showActive = false, bool useItemNo = false)
 {
     cbEmployee.DataSource    = SelectListHelper.GetEmployeeList(companyStr, branchStr, showActive, useItemNo);
     cbEmployee.DisplayMember = "key";
     cbEmployee.ValueMember   = "value";
 }
Пример #29
0
 private void LoadClassCombo(string companyStr, string branchStr, bool useItemNo)
 {
     cbClassEquip.DataSource    = SelectListHelper.GetClassCombo(companyStr, branchStr, useItemNo);
     cbClassEquip.DisplayMember = "key";
     cbClassEquip.ValueMember   = "value";
 }
Пример #30
0
 private void LoadCustomerCombo(string companyStr, string branchStr, bool showActive, bool useItemNo)
 {
     cbCustomer.DataSource    = SelectListHelper.GetCustomerList(companyStr, branchStr, showActive, useItemNo);
     cbCustomer.DisplayMember = "key";
     cbCustomer.ValueMember   = "value";
 }