Ejemplo n.º 1
0
        //method to load category buttons
        public void loadCategoryButtons()
        {
            //clear the list
            itemCategoryButtonList.Clear();
            clearFlowcategorybutton();

            using (DBEntities db = new DBEntities())
            {
                itemCategoriesList = db.ItemCategories.Where(x => x.itemCategoryID.StartsWith("KIc")).ToList();
            }

            foreach (ItemCategory Item in itemCategoriesList)
            {
                //creating new Button
                buttonItemCategory = new ItemCategoryButton();

                buttonItemCategory.ItemButtonName = Item.categoryName;
                buttonItemCategory.ItemButtonID   = Item.itemCategoryID;

                //add button to the List
                itemCategoryButtonList.Add(buttonItemCategory);
            }

            //load button list to the flow panel
            foreach (ItemCategoryButton Item in itemCategoryButtonList)
            {
                flowCategoryButtons.Controls.Add(Item);
            }
        }//end of the method
Ejemplo n.º 2
0
        //----------Manage Category buttons-
        public void loadCategoryButtons()
        {
            //clear the list
            foodCategoryButtonList.Clear();
            clearFlowcategorybutton();
            using (DBEntities db = new DBEntities())
            {
                foodCategoryList      = db.FoodCategories.ToList();
                readyMadecategoryList = db.ItemCategories.Where(x => x.itemCategoryID.StartsWith("RPc")).ToList();
            }

            //adding Category buttons ==============================================================================
            foreach (FoodCategory Item in foodCategoryList)
            {
                //creating new Button
                foodcategorybutton            = new foodcategoryButton();
                foodcategorybutton.ButtonName = Item.name;
                foodcategorybutton.ButtonID   = Item.foodCategoryID;
                //add button to the List
                foodCategoryButtonList.Add(foodcategorybutton);
            }

            //load food category button list to the flow panel
            foreach (foodcategoryButton Item in foodCategoryButtonList)
            {
                flowPanelCategories.Controls.Add(Item);
            }


            //Adding ReadyMade products
            foreach (ItemCategory product in readyMadecategoryList)
            {
                //ceating new RP button
                readyMAdeCategoryBtn = new ItemCategoryButton();
                readyMAdeCategoryBtn.ItemButtonName = product.categoryName;
                readyMAdeCategoryBtn.ItemButtonID   = product.itemCategoryID;

                readyMadeCategoryBtnList.Add(readyMAdeCategoryBtn);
            }
            //adding to panel
            foreach (ItemCategoryButton Item in readyMadeCategoryBtnList)
            {
                flowPanelCategories.Controls.Add(Item);
            }
        } //======================================================================================================