Example #1
0
        /// <summary>
        /// Method to Get the Product Structures(Hierachie) to fill the Category and Subcategory Combobox
        /// </summary>
        public void GetProductStructure()
        {
            if (CategoryList.Count() > 0)
            {
                CategoryList.Clear();
            }

            if (SubCategoryList.Count() > 0)
            {
                SubCategoryList.Clear();
            }

            using (var db = new DataSmartDBContext())
            {
                var structure = db.ProductStructure.ToList();

                if (structure != null)
                {
                    foreach (var d in structure)
                    {
                        CategoryList.Add(d.Category_1);
                        SubCategoryList.Add(d.Category_2);
                    }
                    CategoryList    = CategoryList.Distinct().ToList();
                    SubCategoryList = SubCategoryList.Distinct().ToList();
                }
            }
        }