Exemplo n.º 1
0
        private void UpdateCategoryItems()
        {
            var oldSelectedCategoryItem = _selectedCategoryItem;

            CategoryItems.Clear();
            var allCategoryItem = new Item {
                ID = "-1", Name = "All"
            };

            CategoryItems.Add(new ItemVM {
                Model = allCategoryItem
            });
            using (var context = new ERPContext())
            {
                var categoryItemsFromDatabase = _selectedCategory.Name.Equals("All")
                    ? context.Inventory.Include("Suppliers").OrderBy(item => item.Name)
                    : context.Inventory.Include("Suppliers")
                                                .Where(item => item.ItemCategory.ID.Equals(_selectedCategory.ID))
                                                .OrderBy(item => item.Name);

                foreach (var item in categoryItemsFromDatabase)
                {
                    CategoryItems.Add(new ItemVM {
                        Model = item
                    });
                }
            }

            UpdateSelectedCategoryItem(oldSelectedCategoryItem);
        }
Exemplo n.º 2
0
 public void SetCategoryItems(IEnumerable <Category> categories)
 {
     foreach (var c in categories)
     {
         CategoryItems.Add(new SelectListItem()
         {
             Value = c.CategoryId.ToString(),
             Text  = c.Description
         });
     }
 }
        private async void GetCategoryItems()
        {
            var Categories = await conn_api.GetBlogCategories();

            CategoryItems.Add(new CategoriesForBlog {
                Id = 0, Name = "Reset"
            });
            foreach (var item in Categories)
            {
                CategoryItems.Add(item);
            }
        }
Exemplo n.º 4
0
 public void SetCategories(List <Category> category)
 {
     category = category.OrderBy(c => c.CategoryName).ToList();
     foreach (var c in category)
     {
         CategoryItems.Add(new SelectListItem()
         {
             Value = c.CategoryId.ToString(),
             Text  = c.CategoryName
         });
     }
 }
Exemplo n.º 5
0
        internal void Add(SettingInfo info, SettingItem setting)
        {
            string categoryText = GetCategoryText(info.Category);

            CategoryViewModel cvm = CategoryItems.Find(c => c.Category == categoryText);

            if (cvm == null)
            {
                cvm          = new CategoryViewModel();
                cvm.Category = categoryText;
                CategoryItems.Add(cvm);
            }

            cvm.SettingItems.Add(new SettingItemViewModel(info, setting));
        }
Exemplo n.º 6
0
        public NavigationViewModel()
        {
            AllItems      = new VaultPage("All items");
            FavoriteItems = new FavoritesVaultPage();
            CategoryItems.Add(new CategoryVaultPage("Login", "LoginIcon", typeof(LoginItem)));
            CategoryItems.Add(new CategoryVaultPage("Note", "NoteIcon", typeof(NoteItem)));
            CategoryItems.Add(new CategoryVaultPage("Card", "CardIcon", typeof(CardItem)));
            CategoryItems.Add(new CategoryVaultPage("Identity", "IdentityIcon", typeof(IdentityItem)));

            Settings = new SettingsPageViewModel();
            Account  = new AccountPageViewModel();

            UpdateFolders();

            BitwardenFoldersRepository.Instance.PropertyChanged += Folders_PropChanged;
        }
Exemplo n.º 7
0
        public void FillLists()
        {
            Legoitems.Add(new ItemVM("5+", "Ritterburg", new BitmapImage(new Uri("Bilder_Lego/Lego_burg.jpg", UriKind.Relative))));
            Legoitems.Add(new ItemVM("12+", "City", new BitmapImage(new Uri("Bilder_Lego/Lego_city.jpg", UriKind.Relative))));
            Legoitems.Add(new ItemVM("10+", "Dr. Who", new BitmapImage(new Uri("Bilder_Lego/Lego_DrWho.jpg", UriKind.Relative))));
            Legoitems.Add(new ItemVM("8+", "Harry Potter", new BitmapImage(new Uri("Bilder_Lego/Lego_harrypotter.jpg", UriKind.Relative))));
            Legoitems.Add(new ItemVM("5+", "Superheroes", new BitmapImage(new Uri("Bilder_Lego/Lego_superheroes.jpg", UriKind.Relative))));

            Playitems.Add(new ItemVM("5+", "Piraten", new BitmapImage(new Uri("Bilder_Play/Play_piratenschatz.jpg", UriKind.Relative))));
            Playitems.Add(new ItemVM("3+", "Schulbus", new BitmapImage(new Uri("Bilder_Play/Play_schulbus.jpg", UriKind.Relative))));
            Playitems.Add(new ItemVM("8+", "Schwimmbad", new BitmapImage(new Uri("Bilder_Play/Play_schwimmen.jpg", UriKind.Relative))));
            Playitems.Add(new ItemVM("5+", "Spielplatz", new BitmapImage(new Uri("Bilder_Play/Play_spielplatz.jpg", UriKind.Relative))));
            Playitems.Add(new ItemVM("10+", "Zoo", new BitmapImage(new Uri("Bilder_Play/Play_zoo.jpg", UriKind.Relative))));


            CategoryItems.Add(new CategoryVM("My Lego", new BitmapImage(new Uri("Bilder_Lego/Lego_city.jpg", UriKind.Relative)), Legoitems));
            CategoryItems.Add(new CategoryVM("My Playmobil", new BitmapImage(new Uri("Bilder_Play/Play_zoo.jpg", UriKind.Relative)), Playitems));
        }
Exemplo n.º 8
0
        public void BindCategoryfromSqlite()
        {
            catsubcat1      = new CategorySubCat();
            memberDatabase1 = new MemberDatabase();

            var catesubcat = memberDatabase1.GetCatSubCat();

            List <CategorySubCat> list = catesubcat
                                         .GroupBy(a => a.CategoryName)
                                         .Select(g => g.First())
                                         .ToList();

            foreach (CategorySubCat var1 in list)
            {
                CategoryItems.Add(new CategorySubC1 {
                    CategoryID = var1.CategoryID, CategoryName = var1.CategoryName
                });
            }
        }
Exemplo n.º 9
0
        internal async void AddItemToCategory()
        {
            //Remove the item from ItemList, Add item to CategoryItems and add Item to Category.Item on the backend
            if (SelectedItem != null)
            {
                var item = SelectedItem;

                var values = new Dictionary <string, string>
                {
                    { "CategorylId", Category.Id.ToString() },
                    { "ItemId", item.Id.ToString() }
                };
                var content = new System.Net.Http.FormUrlEncodedContent(values);
                var result  = await Client.HttpClient.PutAsync("http://localhost:65177/api/Category/Item", content);

                if (result.StatusCode == HttpStatusCode.OK)
                {
                    CategoryItems.Add(item);
                    ItemList.Remove(item);
                }
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Gauna visus Categories iš DB
        /// </summary>
        private void CategoryListGetter()
        {
            var categoriesGetter = CategorySystemManager.NewCategoryGetter();

            categoriesGetter.Result += (status, categories) =>
            {
                if (status == CategoryGetStatus.Success)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        CategoryItems.Clear();
                        CategoryItems.Add(new CategoryModel
                        {
                            Title    = "Visi",
                            Category = null
                        });
                        categories.ForEach(category =>
                        {
                            CategoryItems.Add(new CategoryModel
                            {
                                Title    = category.Title,
                                Category = category,
                            });
                        });
                        //FilterFinal();
                        //CategoryList.IsRefreshing = false;
                    });
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        //CategoryList.IsRefreshing = false;
                    });
                }
            };
            categoriesGetter.Get();
        }
 /// <summary>
 /// Add a single category item
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <param name="isWinner"></param>
 public void AddCategoryItem(string key, string value, bool isWinner = false)
 {
     CategoryItems.Add(new Tuple <bool, string, string>(isWinner, key, value));
 }