Beispiel #1
0
        }//end of the method

        //method to display filtered kitchenitem list
        public void filterFoodCards(String categoryID)
        {
            //clear the card list
            kitchenitemcardList.Clear();
            flowKitchenItems.Controls.Clear();

            using (DBEntities db = new DBEntities())
            {
                itemsList = db.Items.Where(x => x.categoryID == categoryID).ToList();;

                foreach (Item Item in itemsList)
                {
                    //creating new card
                    kicard = new POSKICard();

                    kicard.KItemName       = Item.name;
                    kicard.KItemCardID     = Item.itemID;
                    kicard.KItemPrice      = Item.purchase_price.ToString();
                    kicard.ItemImage       = Util.convertBinaryToImage(Item.image);
                    kicard.MeasurementUnit = Item.unitOfMeasurement;
                    //adding card to the list
                    kitchenitemcardList.Add(kicard);
                }
            }


            //adding cards to the flow panel
            foreach (POSKICard card in kitchenitemcardList)
            {
                flowKitchenItems.Controls.Add(card);
            }
        }//
        //method to filter the Items/Foods
        public void filterFoodCards(String categoryID)
        {
            //clear the card list
            posFoodCards.Clear();
            posProducrtCard.Clear();
            flowPanelFoods.Controls.Clear();

            using (DBEntities db = new DBEntities())
            {
                foodItems         = db.Foods.Where(x => x.categoryID == categoryID).ToList();
                readyMadeProducts = db.Items.Where(y => y.categoryID == categoryID).ToList();


                foreach (Food Item in foodItems)
                {
                    //creating new card
                    cardpos            = new POSFoodCard();
                    cardpos.foodName   = Item.name;
                    cardpos.foodCardID = Item.foodCode;
                    cardpos.foodPrice  = Item.sellingPrice.ToString();
                    cardpos.foodImage  = Util.convertBinaryToImage(Item.foodImage);
                    //adding card to the list
                    posFoodCards.Add(cardpos);
                }

                foreach (Item item in readyMadeProducts)
                {
                    cardProduct = new POSKICard();

                    cardProduct.KItemName   = item.name;
                    cardProduct.KItemCardID = item.itemID;
                    //getting the selling price ...
                    readyMAde = db.ReadyMadeProducts.Where(s => s.productID == item.itemID).FirstOrDefault();
                    cardProduct.KItemPrice = readyMAde.sellingPrice.ToString();

                    cardProduct.ItemImage = Util.convertBinaryToImage(item.image);

                    posProducrtCard.Add(cardProduct);
                }
            }


            //adding Food cards to the flow panel
            foreach (POSFoodCard card in posFoodCards)
            {
                flowPanelFoods.Controls.Add(card);
            }

            //adding Product cards to the flow panel
            foreach (POSKICard card in posProducrtCard)
            {
                flowPanelFoods.Controls.Add(card);
            }
        }//end of filtering method