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


C# ICategoryService.GetAllCategories方法代码示例

本文整理汇总了C#中ICategoryService.GetAllCategories方法的典型用法代码示例。如果您正苦于以下问题:C# ICategoryService.GetAllCategories方法的具体用法?C# ICategoryService.GetAllCategories怎么用?C# ICategoryService.GetAllCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICategoryService的用法示例。


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

示例1: GetCategoryList

        /// <summary>
        /// Get category list
        /// </summary>
        /// <param name="categoryService">Category service</param>
        /// <param name="cacheManager">Cache manager</param>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Category list</returns>
        public static List<SelectListItem> GetCategoryList(ICategoryService categoryService, ICacheManager cacheManager, bool showHidden = false)
        {
            string cacheKey = string.Format(ModelCacheEventConsumer.CATEGORIES_LIST_KEY, showHidden);
            var categoryListItems = cacheManager.Get(cacheKey, () =>
            {
                var categories = categoryService.GetAllCategories(showHidden: showHidden);
                return categories.Select(c => new SelectListItem
                {
                    Text = c.GetFormattedBreadCrumb(categories),
                    Value = c.Id.ToString()
                });
            });

            var result = new List<SelectListItem>();
            //clone the list to ensure that "selected" property is not set
            foreach (var item in categoryListItems)
            {
                result.Add(new SelectListItem
                {
                    Text = item.Text,
                    Value = item.Value
                });
            }

            return result;
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:33,代码来源:SelectListHelper.cs

示例2: DiscountImportService

 public DiscountImportService(
     ICustomerService customerService, 
     ICurrencyService currencyService, 
     IDiscountService discountService,
     ILanguageService languageService,
     ICountryService countryService,
     IGenericAttributeService genericAttributeService,
     ICategoryService categoryService
     )
     : base(discountService, currencyService, languageService, genericAttributeService, countryService)
 {
     this._customerService = customerService;
     this._categoryService = categoryService;
     _customerRoles = _customerService.GetAllCustomerRoles(true);
     _categories = _categoryService.GetAllCategories(true);
 }
开发者ID:Schtolz,项目名称:NopcommerceC5,代码行数:16,代码来源:DiscountImportService.cs

示例3: ProcessDatasOnDB

        public static void ProcessDatasOnDB(IAccountService AccountService, ICategoryService CategoryService, ITransactionService TransactionService, IOptionService OptionService)
        {
            #region Categories

            var c1 = new Category();
            c1.Balance = 7.0;
            c1.Color = "FFA640";
            c1.Name = "Vacances";

            var c2 = new Category();
            c2.Balance = 7.0;
            c2.Color = "FFA640";
            c2.Name = "Profesionnel";

            #endregion

            #region Accounts

            var na1 = new Account();
            na1.Balance = 7.0;
            na1.BankName = "Credit Agricole";
            na1.Name = "Mon compte courant";

            var na2 = new Account();
            na2.Balance = 7.0;
            na2.BankName = "HSBC";
            na2.Name = "Mon compte courant";

            var na3 = new Account();
            na3.Balance = 7.0;
            na3.BankName = "HSBC";
            na3.Name = "Mon compte epargne HSBC";

            #endregion

            #region DB Cleaner

            var Categories = CategoryService.GetAllCategories(true);

            var Accounts = AccountService.GetAllAccounts(true);

            if (Categories.Value.Count > 0)
            {
                foreach (var entity in Categories.Value)
                {
                    CategoryService.DeleteCategorieById(entity.ID);
                }
            }

            if (Accounts.Value.Count > 0)
            {
                foreach (var entity in Accounts.Value)
                {
                    AccountService.DeleteAccountById(entity.ID);

                }
            }

            var transactions =

            #endregion

            #region Ajout Données

             na1 = AccountService.CreateAccount(new CreateAccountCommand() { BankName = na1.BankName, Name = na1.Name }).Value;
            na2 = AccountService.CreateAccount(new CreateAccountCommand() { BankName = na2.BankName, Name = na2.Name }).Value;
            na3 = AccountService.CreateAccount(new CreateAccountCommand() { BankName = na3.BankName, Name = na3.Name }).Value;

            c1 = CategoryService.CreateCategory(new CreateCategoryCommand() { Name = c1.Name, Color = c1.Color }).Value;
            c2 = CategoryService.CreateCategory(new CreateCategoryCommand() { Name = c2.Name, Color = c2.Color }).Value;

            #endregion

            #region Ajout 26 transactions

            var listDeTransaction = new List<Transaction>();

            listDeTransaction.Add(new Transaction() { Name = "redevance tv", Account = na1, Amount = -100, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "les courses", Account = na1, Amount = -80, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "restau", Account = na2, Category = c2, Amount = -40, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "piscine", Account = na1, Amount = -10, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "ciné", Account = na1, Amount = -5, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "bar", Account = na1, Category = c1, Amount = -10.5, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "club", Account = na1, Category = c1, Amount = -15.5, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "lotto", Account = na1, Amount = 7, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "la biere", Account = na1, Amount = -10, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "bouquet de fleur", Account = na1, Amount = -20, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "medicaments", Account = na1, Amount = -5, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "pizza tv", Account = na1, Amount = -10, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "moulin de la forge tv", Account = na1, Category = c1, Amount = -150, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "licence MS", Account = na2, Category = c2, Amount = -35, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "James", Account = na2, Category = c2, Amount = 500, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "Ian", Account = na2, Category = c2, Amount = 1000, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "Villa", Account = na2, Category = c1, Amount = -200, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "Telephone", Account = na2, Category = c2, Amount = -30, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "park d'actraction", Account = na2, Amount = -20, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "enfants", Account = na2, Amount = 46.7, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "nouvelle maison", Account = na3, Amount = -33.6, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "epargne taux fixe", Account = na3, Amount = 10, Description = "test de la description" });
            listDeTransaction.Add(new Transaction() { Name = "epargne sur montpellier", Account = na3, Amount = 60, Description = "test de la description" });
//.........这里部分代码省略.........
开发者ID:streathamAdministrators,项目名称:AKWP7,代码行数:101,代码来源:DumpMyDBSQLCE.cs


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