Beispiel #1
0
 private OrderItem createOrderItem()
 {
     if (arrangementTypeCmbBox.Text.Trim().Equals("Bouquet") == true)
     {
         Flower    flower1   = new Flower(flowerTypesCmbBox.Text.Trim(), getFlowerPrice());
         Flower    flower2   = new Flower(secondFlowerTypeCmb.Text.Trim(), getFlowerPrice());
         Bouquet   bouquet   = new Bouquet(flower1, flower2, "Bouquet", int.Parse(nbOfFlowers1TB.Text.Trim()), int.Parse(nbOfFlowers2TB.Text.Trim()));
         OrderItem orderItem = new OrderItem(bouquet, addRibbonCheck.Checked);
         return(orderItem);
     }
     else
     {
         Flower    flower    = new Flower(flowerTypesCmbBox.Text.Trim(), getFlowerPrice());
         Basket    basket    = new Basket(flower, "Basket");
         OrderItem orderItem = new OrderItem(basket, addRibbonCheck.Checked);
         return(orderItem);
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            var theCustomer = new Customer("*****@*****.**", "Tamara", "Bagration");

            var           rose  = new Flower(1, "Rose Red", "", 10.5);
            var           rose2 = new Flower(2, "Rose Red2", "", 9.5);
            List <Flower> roses = new List <Flower>();

            roses.Add(rose);
            roses.Add(rose2);
            var rosesBouquet = new Bouquet(1, "Wedding Bouquete", 100d, roses);


            // var lily = new Flower(3, "Lily", "", 5.7);
            //List<Flower> lilies = new List<Flower>();



            Console.WriteLine("Welcome to our the flower paradise!");
        }
Beispiel #3
0
 private int[] getFlowerSalesQuantity()
 {
     int[] flowerSalesQ = new int[_flowers.Count];
     foreach (Order order in _orders)
     {
         foreach (OrderItem orderI in order.OrderItems)
         {
             if (orderI.Arrangement.getType() == "Bouquet")
             {
                 Bouquet temp    = (Bouquet)orderI.Arrangement;
                 int     counter = 0;
                 foreach (Flower flower in _flowers)
                 {
                     if (flower.Name.Equals(temp.Flower1.Name))
                     {
                         flowerSalesQ[counter]++;
                     }
                     if (flower.Name.Equals(temp.Flower2.Name))
                     {
                         flowerSalesQ[counter]++;
                     }
                     counter++;
                 }
             }
             else if (orderI.Arrangement.getType() == "Basket")
             {
                 Basket temp    = (Basket)orderI.Arrangement;
                 int    counter = 0;
                 foreach (Flower flower in _flowers)
                 {
                     if (flower.Name.Equals(temp.Flower.Name))
                     {
                         flowerSalesQ[counter]++;
                     }
                     counter++;
                 }
             }
         }
     }
     return(flowerSalesQ);
 }