public override void LoadData() { base.LoadData(); CategoryOrderItems = BistroDatabase.Instance.Get <CategoryOrderItem>(DBQuery.GET_CATEGORY_ORDER_ITEM).ToObservableCollection(); IEnumerable <SubCategory> subCategory = BistroDatabase.Instance.Get <SubCategory>(DBQuery.GET_SUB_CATEGORIES); SubCategories.AddRange(subCategory); }
private void UpdateMenuButtons(ScreenMenuCategory category) { MenuItems = CreateMenuButtons(category, CurrentPageNo, CurrentTag ?? ""); SubCategories.Clear(); SubCategories.AddRange( AppServices.DataAccessService.GetSubCategories(category, CurrentTag) .Select(x => new ScreenSubCategoryButton(x, SubCategoryCommand, category.MButtonColor, category.SubButtonHeight))); if (!string.IsNullOrEmpty(CurrentTag)) { var backButton = new ScreenSubCategoryButton(CurrentTag.Replace(CurrentTag.Split(',').Last(), "").Trim(new[] { ',', ' ' }), SubCategoryCommand, "Gainsboro", category.SubButtonHeight, true); SubCategories.Add(backButton); } if (Categories != null && MenuItems.Count == 0) { if (category.NumeratorType == 2 && SubCategories.Count == 0) { InteractionService.ShowKeyboard(); } MenuItems.Clear(); if (category.MaxItems > 0) { IEnumerable <ScreenMenuItem> sitems = category.ScreenMenuItems.OrderBy(x => x.Order); if (SubCategories.Count == 0) { sitems = Categories.Select(x => x.Category).SelectMany(x => x.ScreenMenuItems); } var items = sitems.Select(x => new ScreenMenuItemButton(x, MenuItemCommand, SelectedCategory)); if (category.SortType == 1) { items = items.OrderByDescending(x => x.UsageCount); } MenuItems.AddRange(items.Take(category.MaxItems)); } } RaisePropertyChanged("MenuItems"); RaisePropertyChanged("IsPageNumberNavigatorVisible"); RaisePropertyChanged("MenuItemsVerticalAlignment"); }
private void InitialInitialization() { List <CategoryEntity> categories = new List <CategoryEntity>() { new CategoryEntity() { Name = "Категория-1" }, new CategoryEntity() { Name = "Категория-2" }, new CategoryEntity() { Name = "Категория-3" } }; List <RoleEntity> roles = new List <RoleEntity>() { new RoleEntity() { Name = "Operator" }, new RoleEntity() { Name = "Customer" } }; List <GenderEntity> genders = new List <GenderEntity>() { new GenderEntity() { Name = "Male" }, new GenderEntity() { Name = "Female" } }; UserEntity user = new UserEntity() { Email = "*****@*****.**", Password = "******", //TODO hash этого пароля test Role = roles[1], Name = "Test", LastName = "Test", Gender = genders[0] }; Categories.AddRange(categories); Roles.AddRange(roles); Genders.AddRange(genders); Users.Add(user); SaveChanges(); List <SubCategoryEntity> subCategories = new List <SubCategoryEntity>() { new SubCategoryEntity() { Name = "Подкатегория-1-1", CategoryId = categories[0].Id }, new SubCategoryEntity() { Name = "Подкатегория-1-2", CategoryId = categories[0].Id }, new SubCategoryEntity() { Name = "Подкатегория-1-3", CategoryId = categories[0].Id }, new SubCategoryEntity() { Name = "Подкатегория-2-1", CategoryId = categories[1].Id }, new SubCategoryEntity() { Name = "Подкатегория-2-2", CategoryId = categories[1].Id }, new SubCategoryEntity() { Name = "Подкатегория-2-3", CategoryId = categories[1].Id }, new SubCategoryEntity() { Name = "Подкатегория-3-1", CategoryId = categories[2].Id }, new SubCategoryEntity() { Name = "Подкатегория-3-2", CategoryId = categories[2].Id }, new SubCategoryEntity() { Name = "Подкатегория-3-3", CategoryId = categories[2].Id } }; SubCategories.AddRange(subCategories); SaveChanges(); }