Example #1
0
        public static ObservableCollection <Category> GetCategoriesFromDb()
        {
            var       categoriesList = new ObservableCollection <Category>();
            DataTable q = QueryForSQLServer.GetCategory();

            foreach (DataRow row in q.Rows)
            {
                var category = new Category {
                    Id = (int)row.ItemArray[0], Name = (string)row.ItemArray[1]
                };
                categoriesList.Add(category);
            }
            return(categoriesList);
        }
Example #2
0
        public void searchFillter(ObservableCollection <Product> products)
        {
            this.InitializeComponent();
            var       categoriesList = new ObservableCollection <Category>();
            DataTable q = QueryForSQLServer.GetCategory();

            foreach (DataRow row in q.Rows)
            {
                var category = new Category {
                    Id = (int)row.ItemArray[0], Name = (string)row.ItemArray[1]
                };
                categoriesList.Add(category);
            }

            ProductData = products;
            PagingPage();
            cbbListType.ItemsSource = categoriesList;
        }