public void Chop(Mobile from)
 {
     if (from.InRange(this.GetWorldLocation(), 1))
     {
         if (from == m_sower)
         {
             from.Direction = from.GetDirectionTo(this);
             double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100;
             if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue))
             {
                 Onion fruit = new Onion(Utility.Random(m_yield + 2));
                 from.AddToBackpack(fruit);
             }
             this.Delete();
             from.SendMessage("You chop the plant up");
         }
         else
         {
             from.SendMessage("You do not own this plant !!!");
         }
     }
     else
     {
         from.SendLocalizedMessage(500446);
     }
 }
Esempio n. 2
0
		public override Item GetCropObject()
		{
			var onion = new Onion();

			onion.ItemID = Utility.Random(3181, 2);

			return onion;
		}
Esempio n. 3
0
        public override Item GetCropObject()
        {
            Onion onion = new Onion();

            onion.ItemID = Utility.Random(3181, 2);

            return(onion);
        }
        public void NumberOfLayers()
        {
            var numberOfLayers = new Onion(new Onion(new Onion(new Onion()))).NumberOfInnerLayers;
            var didItWork      = false;

            if (numberOfLayers == 3)
            {
                didItWork = true;
            }

            Assert.AreEqual(true, didItWork); //assert if result is as expected
        }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        sentences = new Queue <string>();
        images    = new Queue <Sprite>();
        names     = new Queue <string>();

        //audios = new Queue<AudioSource>();

        o      = FindObjectOfType <Onion>();
        dog    = FindObjectOfType <DogBehavior>();
        player = FindObjectOfType <Playermovement>();
    }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
        rand = new System.Random();

        indexIcon = rand.Next(0, 12);
        noEffect  = new Effect("No Disease", 0, false);

        purifyEffect = new Effect("Cure", 1, false);

        malaria = new Effect("Malaria", -1, false);

        bilharzia = new Effect("Bilharzia", -2, false);

        effectExp1 = "lose 1 HP every turn";
        effectExp2 = "Cure all disease and +1 HP";
        effectExp3 = "lose 2 HP every turn";

        effectsActive = new ArrayList();
        foods         = new ArrayList();

        birdseed = new BirdSeed("Bird Seed", 1, noEffect, 0);
        oat      = new Oat("Oat", 1, malaria, 1);
        Lettuce             lettuce             = new Lettuce("Lettuce", 3, bilharzia, 2); // lose speed -> speed/2
        Rice                rice                = new Rice("Rice", 1, purifyEffect, 3);
        RottenGrape         rottenGrape         = new RottenGrape("Rotten Grape", -2, malaria, 4);
        PollutedCrackedCorn pollutedCrackedCorn = new PollutedCrackedCorn("Polluted Cracked Corn", -2, malaria, 5);
        Avocado             avocado             = new Avocado("Avocado", -2, malaria, 6);
        Onion               onion               = new Onion("Onion", -2, purifyEffect, 7);
        Nuts                nuts                = new Nuts("Nuts", -2, purifyEffect, 8);
        Chocolate           chocolate           = new Chocolate("Chocolate", -2, purifyEffect, 9);
        Popcorn             popcorn             = new Popcorn("Popcorn", -2, bilharzia, 10);
        Bread               bread               = new Bread("Bread", -2, malaria, 11);



        for (int i = 0; i < 3; i++)
        {
            foods.Add(birdseed);
            foods.Add(oat);
            foods.Add(lettuce);
            foods.Add(rice);
            foods.Add(rottenGrape);
            foods.Add(pollutedCrackedCorn);
            foods.Add(avocado);
            foods.Add(onion);
            foods.Add(nuts);
            foods.Add(chocolate);
            foods.Add(popcorn);
            foods.Add(bread);
        }
    }
        public void DecoratorTest()
        {
            IOrderable pizza         = new Margerita();
            IOrderable ham           = new Ham(pizza);
            IOrderable kebab         = new Kebab(ham);
            IOrderable onion         = new Onion(kebab);
            var        expectedPizza = $"Margerita{Environment.NewLine} with ham{Environment.NewLine} with kebab{Environment.NewLine} with onion";
            var        expectedPrice = 125;
            var        actualPizza   = onion.GetName();
            var        actualPrice   = onion.GetPrice();

            Assert.AreEqual(expectedPizza, actualPizza);
            Assert.IsTrue(expectedPrice == actualPrice);
        }
Esempio n. 8
0
        private static void DecoratorDosa()
        {
            IDosa plainDosa = new PlainDosa();
            //Console.WriteLine("Description : {0} - Price {1}", plainDosa.GetDescription(), plainDosa.GetPrice());

            Ghee ghee = new Ghee(plainDosa);

            Onion onion = new Onion(ghee);

            Console.WriteLine("Description : {0} - Total Price : Rs. {1}", onion.GetDescription(), onion.GetPrice());

            Powder powder = new Powder(onion);

            Console.WriteLine("Description : {0} - Total Price : Rs. {1}", powder.GetDescription(), powder.GetPrice());
        }
Esempio n. 9
0
        public override bool LootItem(Mobile from)
        {
            if (Utility.RandomDouble() <= .05)
            {
                OnionSeed item = new OnionSeed();
                from.AddToBackpack(item);
                from.SendMessage("You manage to gather 1 onion seed.");
            }
            Onion c = new Onion();

            c.ItemID = 3182;
            from.AddToBackpack(c);
            from.SendMessage("You manage to gather 1 onion.");
            return(true);
        }
Esempio n. 10
0
        private void InitContents(FruitType type)
        {
            Food item  = null;
            byte count = (byte)Utility.RandomMinMax(10, 30);

            for (byte i = 0; i < count; i++)
            {
                switch (type)
                {
                default:
                case FruitType.Apples: item = new Apple(); break;

                case FruitType.Bananas: item = new Banana(); break;

                case FruitType.Bread: item = new BreadLoaf(); break;

                case FruitType.Gourds: item = new Gourd(); break;

                case FruitType.Grapes: item = new Grapes(); break;

                case FruitType.Lemons: item = new Lemon(); break;

                case FruitType.Tomatoes: item = new Tomato(); break;

                case FruitType.Vegetables1:
                case FruitType.Vegetables2:
                case FruitType.Vegetables3:
                {
                    switch (Utility.Random(4))
                    {
                    case 0: item = new Carrot(); break;

                    case 1: item = new Onion(); break;

                    case 2: item = new Pumpkin(); break;

                    case 3: item = new Gourd(); break;
                    }
                    break;
                }
                }

                if (item != null)
                {
                    DropItem(item);
                }
            }
        }
Esempio n. 11
0
        // GET: Decoration
        public ActionResult Index()
        {
            Pancake pancake = new DesertPanCake();

            pancake = new CherryCream(pancake);

            var cost2 = pancake.Cost();

            LunchPanCake pancake2 = new LunchPanCake();

            pancake2 = new Onion(pancake2);

            var cost3 = pancake2.Cost();

            return(View());
        }
Esempio n. 12
0
        public List <object> Products()
        {
            List <object> products = new List <object>();
            Beet          Beet     = new Beet();
            Carrot        Carrot   = new Carrot();
            Meat          Meat     = new Meat();
            Onion         Onion    = new Onion();
            Potato        Potato   = new Potato();
            Rise          Rise     = new Rise();

            Beet.Name   = "Свёкла";
            Carrot.Name = "Морковь";
            Meat.Name   = "Мясо";
            Onion.Name  = "Лук";
            Potato.Name = "Картошка";
            Rise.Name   = "Рис";

            products.AddRange(new object[] { Beet, Carrot, Meat, Onion, Potato, Rise });

            return(products);
        }
Esempio n. 13
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_sower == null || m_sower.Deleted)
            {
                m_sower = from;
            }

            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage(AgriTxt.CannotWorkMounted);
                return;
            }

            if (DateTime.Now > lastpicked.AddSeconds(3))               // 3 seconds between picking
            {
                lastpicked = DateTime.Now;

                int lumberValue = (int)from.Skills[SkillName.Lumberjacking].Value / 5;
                if (lumberValue == 0)
                {
                    from.SendMessage(AgriTxt.DunnoHowTo);
                    return;
                }

                if (from.InRange(this.GetWorldLocation(), 2))
                {
                    if (m_yield < 1)
                    {
                        from.SendMessage(AgriTxt.NoCrop);

                        if (PlayerCanDestroy && !(m_sower.AccessLevel > AccessLevel.Counselor))
                        {
                            UpRootGump g = new UpRootGump(from, this);
                            from.SendGump(g);
                        }
                    }
                    else                     //check skill and sower
                    {
                        from.Direction = from.GetDirectionTo(this);

                        from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0);

                        if (from == m_sower)
                        {
                            lumberValue *= 2;
                            m_lastvisit  = DateTime.Now;
                        }

                        if (lumberValue > m_yield)
                        {
                            lumberValue = m_yield + 1;
                        }

                        int pick = Utility.Random(lumberValue);
                        if (pick == 0)
                        {
                            from.SendMessage(AgriTxt.ZeroPicked);
                            return;
                        }

                        m_yield -= pick;
                        from.SendMessage(AgriTxt.YouPick + " {0} gousse{1} d'oignon!", pick, (pick == 1 ? "" : "s"));

                        //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield ));
                        ((Item)this).ItemID = pickedGraphic;

                        Onion crop = new Onion(pick);
                        from.AddToBackpack(crop);

                        if (SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !(m_sower.AccessLevel > AccessLevel.Counselor))
                        {
                            this.UpRoot(from);
                            return;
                        }

                        if (!regrowTimer.Running)
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage(AgriTxt.TooFar);
                }
            }
        }
Esempio n. 14
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_sower == null || m_sower.Deleted)
            {
                m_sower = from;
            }

            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage("You cannot harvest a crop while mounted.");
                return;
            }

            if (DateTime.Now > lastpicked.AddSeconds(3))               // 3 seconds between picking
            {
                lastpicked = DateTime.Now;

                int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20;
                if (cookValue == 0)
                {
                    from.SendMessage("You have no idea how to harvest this crop.");
                    return;
                }

                if (from.InRange(this.GetWorldLocation(), 1))
                {
                    if (m_yield < 1)
                    {
                        from.SendMessage("There is nothing here to harvest.");

                        if (PlayerCanDestroy && !(m_sower.AccessLevel > AccessLevel.Counselor))
                        {
                            UpRootGump g = new UpRootGump(from, this);
                            from.SendGump(g);
                        }
                    }
                    else                     //check skill and sower
                    {
                        from.Direction = from.GetDirectionTo(this);

                        from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0);

                        if (from == m_sower)
                        {
                            cookValue  *= 2;
                            m_lastvisit = DateTime.Now;
                        }

                        if (cookValue > m_yield)
                        {
                            cookValue = m_yield + 1;
                        }

                        int pick = Utility.Random(cookValue);
                        if (pick == 0)
                        {
                            from.SendMessage("You do not manage to harvest any crops.");
                            return;
                        }

                        m_yield -= pick;
                        from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s"));

                        //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield ));
                        ((Item)this).ItemID = pickedGraphic;

                        Onion crop = new Onion(pick);
                        from.AddToBackpack(crop);

                        if (SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !(m_sower.AccessLevel > AccessLevel.Counselor))
                        {
                            this.UpRoot(from);
                            return;
                        }

                        if (!regrowTimer.Running)
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage("You are too far away to harvest anything.");
                }
            }
        }
Esempio n. 15
0
        static void Main()
        {
            ICookBorshch  cookBorshch  = new Borshch();
            ICookPilaf    cookPilaf    = new Pilaf();
            ICookRagout   cookRagout   = new Ragout();
            IReadyBorshch readyBorshch = new Chef();
            IReadyPilaf   readyPilaf   = new Chef();
            IReadyRagout  readyRagout  = new Chef();

            Chef Kolya = new Chef
            {
                Age  = 40,
                Name = "Колян"
            };

            Chef Vitya = new Chef
            {
                Age  = 35,
                Name = "Витёк"
            };

            Chef Vasya = new Chef
            {
                Age  = 25,
                Name = "Васька"
            };

            Borshch borshch = new Borshch();
            Pilaf   pilaf   = new Pilaf();
            Ragout  ragout  = new Ragout();
            Cutting cut     = new Cutting();

            Beet   beet   = new Beet();
            Carrot carrot = new Carrot();
            Meat   meat   = new Meat();
            Onion  onion  = new Onion();
            Potato potato = new Potato();
            Rise   rise   = new Rise();

            List <object> friedBorshch  = cookBorshch.FryBorshch();
            List <object> boiledBorshch = cookBorshch.BoilBorshch();
            List <object> friedPilaf    = cookPilaf.FryPilaf();
            List <object> boiledPilaf   = cookPilaf.BoilPilaf();
            List <object> friedRagout   = cookRagout.FryRagout();
            List <object> boiledRagout  = cookRagout.BoilRagout();

            List <List <object> > readyBorshchDish = readyBorshch.FinishedDishBorshch(friedBorshch, boiledBorshch);
            List <List <object> > readyPilafDish   = readyPilaf.FinishedDishPilaf(friedPilaf, boiledPilaf);
            List <List <object> > readyRagoutDish  = readyRagout.FinishedDishRagout(friedRagout, boiledRagout);

            cut.Products();

            Console.WriteLine($"Сегодняшние повара:" +
                              $"\n\n{Kolya.Name} ({Kolya.Age} лет), {Vasya.Name} ({Vasya.Age} лет) и {Vitya.Name} ({Vitya.Age} лет)" +
                              $"\n\nОни приготовили сегодня:" +
                              $"\n{borshch.Dish}, {pilaf.Dish}, {ragout.Dish}" +
                              $"\n\nРецепт такой:" +
                              $"\n\n{beet.Name} - {beet.Weight} кг" +
                              $"\n{carrot.Name} - {carrot.Weight} кг" +
                              $"\n{meat.Name} - {meat.Weight} (тип {meat.Type}) кг" +
                              $"\n{onion.Name} - {onion.Weight}" +
                              $"\n{potato.Name} - {potato.Weight}" +
                              $"\n{rise.Name} - {rise.Weight} (тип {rise.Type}) кг" +
                              $"\n{cut.Pepper}" +
                              $"\n{cut.Salt}" +
                              $"\n{cut.Spices}");
            Console.WriteLine("\n\nГотовили блюда следующим образом:");

            foreach (var mainList in readyBorshchDish)
            {
                foreach (var item in mainList)
                {
                    Console.WriteLine("");
                    Console.WriteLine($"{item}");
                }
            }
        }
Esempio n. 16
0
        public void AddToppings(IOrderable pizza, string type)
        {
            switch (type)
            {
            case "1":
                IOrderable artichoke = new Artichoke(pizza);
                AddToppingsMenu(artichoke);
                return;

            case "2":
                IOrderable cilantro = new Cilantro(pizza);
                AddToppingsMenu(cilantro);
                return;

            case "3":
                IOrderable ham = new Ham(pizza);
                AddToppingsMenu(ham);
                return;

            case "4":
                IOrderable kebab = new Kebab(pizza);
                AddToppingsMenu(kebab);
                return;

            case "5":
                IOrderable kebabsauce = new Kebabsauce(pizza);
                AddToppingsMenu(kebabsauce);
                return;

            case "6":
                IOrderable mushroom = new Mushroom(pizza);
                AddToppingsMenu(mushroom);
                return;

            case "7":
                IOrderable mussels = new Mussels(pizza);
                AddToppingsMenu(mussels);
                return;

            case "8":
                IOrderable onion = new Onion(pizza);
                AddToppingsMenu(onion);
                return;

            case "9":
                IOrderable pineapple = new Pinapple(pizza);
                AddToppingsMenu(pineapple);
                return;

            case "10":
                IOrderable shrimp = new Shrimp(pizza);
                AddToppingsMenu(shrimp);
                return;

            case "y":
                currentOrder.ItemsOrdered.Add(pizza);
                PlaceOrderMenu();
                return;

            default:
                Console.WriteLine("Please write the number of the topping you want.");
                AddToppingsMenu(pizza);
                return;
            }
        }
Esempio n. 17
0
        public ActionResult AddMorePizza(string size, string name, bool?bacon, bool?bbq, bool?cheese, bool?mushroom, bool?onion, bool?pepperoni, bool?pepper, bool?pineapple, bool?sausage, bool?shrimp, int amt)
        {
            if (!string.IsNullOrEmpty(size))
            {
                double totalCost;
                Pizza  aPizza = null;

                //Switch statement for the size of the pizza
                switch (size)
                {
                case "Small":
                    aPizza = new Small();
                    break;

                case "Medium":
                    aPizza = new Medium();
                    break;

                case "Large":
                    aPizza = new Large();
                    break;
                }

                //If the topping was selected then it is added to the pizza
                if (bacon == true)
                {
                    aPizza = new Bacon(aPizza);
                }

                if (bbq == true)
                {
                    aPizza = new BBQ(aPizza);
                }

                if (cheese == true)
                {
                    aPizza = new ExCheese(aPizza);
                }

                if (mushroom == true)
                {
                    aPizza = new Mushroom(aPizza);
                }

                if (onion == true)
                {
                    aPizza = new Onion(aPizza);
                }

                if (pepperoni == true)
                {
                    aPizza = new Pepperoni(aPizza);
                }

                if (pepper == true)
                {
                    aPizza = new Peppers(aPizza);
                }

                if (pineapple == true)
                {
                    aPizza = new Pineapple(aPizza);
                }

                if (sausage == true)
                {
                    aPizza = new Sausage(aPizza);
                }

                if (shrimp == true)
                {
                    aPizza = new Shrimp(aPizza);
                }


                //Created a variable to contain and manipulate the cost
                totalCost = aPizza.GetCost();

                if (Session["cart"] == null)
                {
                    List <CartItem> cart = new List <CartItem>
                    {
                        new CartItem {
                            ID        = 1,
                            Pizza     = aPizza,
                            Quant     = amt,
                            ViewModel = (InfoViewModel)Session["info"]
                        }
                    };
                    Session["cart"]  = cart;
                    Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant);
                }
                else
                {
                    List <CartItem> cart  = (List <CartItem>)Session["cart"];
                    int             index = IsExist(aPizza);
                    if (index != -1)
                    {
                        cart[index].Quant++;
                    }
                    else
                    {
                        int currentID = cart.Count();
                        cart.Add(new CartItem {
                            ID = currentID, Pizza = aPizza, Quant = amt, ViewModel = (InfoViewModel)Session["info"]
                        });
                    }
                    Session["cart"]  = cart;
                    Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant);
                }


                return(RedirectToAction("DisplayCart"));
            }
            else
            {
                if (string.IsNullOrEmpty(size))
                {
                    TempData["Amt"]  = "The amount must be a number";
                    TempData["Size"] = "A size must be selected";
                }

                return(View("AddMorePizzaForm"));
            }
        }
Esempio n. 18
0
 void Dt_Traversor_selectionChanged(Onion.Controls.DtTraversor d, EventArgs e)
 {
     ShowProgress(d.CurrentRowIndex);
 }
Esempio n. 19
0
 public void openXCVehicleData(Onion onion)
 {
 }
Esempio n. 20
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_sower == null || m_sower.Deleted)
            {
                m_sower = from;
            }
            if (from != m_sower)
            {
                from.SendMessage("You do not own this plant !!!"); return;
            }

            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage("You cannot harvest a crop while mounted."); return;
            }
            if (DateTime.UtcNow > lastpicked.AddSeconds(3))
            {
                lastpicked = DateTime.UtcNow;
                int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20;
                if (cookValue == 0)
                {
                    from.SendMessage("You have no idea how to harvest this crop."); return;
                }
                if (from.InRange(this.GetWorldLocation(), 1))
                {
                    if (m_yield < 1)
                    {
                        from.SendMessage("There is nothing here to harvest.");
                    }
                    else
                    {
                        from.Direction = from.GetDirectionTo(this);
                        from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0);
                        m_lastvisit = DateTime.UtcNow;
                        if (cookValue > m_yield)
                        {
                            cookValue = m_yield + 1;
                        }
                        int pick = Utility.RandomMinMax(cookValue - 4, cookValue);
                        if (pick < 0)
                        {
                            pick = 0;
                        }
                        if (pick == 0)
                        {
                            from.SendMessage("You do not manage to harvest any crops."); return;
                        }
                        m_yield -= pick;
                        from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s"));
                        if (m_yield < 1)
                        {
                            ((Item)this).ItemID = pickedGraphic;
                        }
                        Onion crop = new Onion(pick);
                        from.AddToBackpack(crop);
                        if (!regrowTimer.Running)
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage("You are too far away to harvest anything.");
                }
            }
        }
Esempio n. 21
0
        public ActionResult CreatePizza(string size, string name, bool?bacon, bool?bbq, bool?cheese, bool?mushroom, bool?onion, bool?pepperoni, bool?pepper, bool?pineapple, bool?sausage, bool?shrimp, int amt, bool?deliver, InfoViewModel infoView)
        {
            bool isNum = IsNumber(amt);

            if (ModelState.IsValid && !string.IsNullOrEmpty(size) && isNum)
            {
                double totalCost;
                Pizza  aPizza = null;

                //Switch statement for the size of the pizza
                switch (size)
                {
                case "Small":
                    aPizza = new Small();
                    break;

                case "Medium":
                    aPizza = new Medium();
                    break;

                case "Large":
                    aPizza = new Large();
                    break;
                }

                //If the topping was selected then it is added to the pizza
                if (bacon == true)
                {
                    aPizza = new Bacon(aPizza);
                }

                if (bbq == true)
                {
                    aPizza = new BBQ(aPizza);
                }

                if (cheese == true)
                {
                    aPizza = new ExCheese(aPizza);
                }

                if (mushroom == true)
                {
                    aPizza = new Mushroom(aPizza);
                }

                if (onion == true)
                {
                    aPizza = new Onion(aPizza);
                }

                if (pepperoni == true)
                {
                    aPizza = new Pepperoni(aPizza);
                }

                if (pepper == true)
                {
                    aPizza = new Peppers(aPizza);
                }

                if (pineapple == true)
                {
                    aPizza = new Pineapple(aPizza);
                }

                if (sausage == true)
                {
                    aPizza = new Sausage(aPizza);
                }

                if (shrimp == true)
                {
                    aPizza = new Shrimp(aPizza);
                }


                //Created a variable to contain and manipulate the cost
                totalCost = aPizza.GetCost();

                infoView.Delivery = deliver;

                if (Session["cart"] == null)
                {
                    List <CartItem> cart = new List <CartItem>
                    {
                        new CartItem {
                            ID        = 1,
                            Pizza     = aPizza,
                            Quant     = amt,
                            ViewModel = infoView
                        }
                    };
                    Session["info"]  = infoView;
                    Session["cart"]  = cart;
                    Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant);
                }
                else
                {
                    List <CartItem> cart  = (List <CartItem>)Session["cart"];
                    int             index = IsExist(aPizza);
                    if (index != -1)
                    {
                        cart[index].Quant++;
                    }
                    else
                    {
                        int currentID = cart.Count();
                        cart.Add(new CartItem {
                            ID = currentID, Pizza = aPizza, Quant = amt, ViewModel = infoView
                        });
                    }

                    Session["info"]  = infoView;
                    Session["cart"]  = cart;
                    Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant);
                }



                //Method sends order to database
                //aConnection.InsertPizzaOrder(aPizza, totalCost, name, amt, deliver, addy, city, zip, time);

                //Adds everything to a ViewBag to send to confirmation page
                //ViewBag.APizza = aPizza;
                //ViewBag.Total = totalCost;
                //ViewBag.Name = name;
                //ViewBag.Amt = amt;
                //ViewBag.Deliver = deliver;
                //ViewBag.Addy = addy;
                //ViewBag.City = city;
                //ViewBag.Zip = zip;
                //ViewBag.Time = time;

                return(RedirectToAction("DisplayCart"));
            }
            else
            {
                if (string.IsNullOrEmpty(size))
                {
                    TempData["Amt"]  = "The amount must be a number";
                    TempData["Size"] = "A size must be selected";
                }

                return(View("CreatePizzaForm", infoView));
            }
        }
Esempio n. 22
0
		private void InitContents( FruitType type )
		{
			Food item = null;
			byte count = (byte)Utility.RandomMinMax( 10, 30 );

			for( byte i = 0; i < count; i++ )
			{
				switch( type )
				{
					default:
					case FruitType.Apples: item = new Apple(); break;
					case FruitType.Bananas: item = new Banana(); break;
					case FruitType.Bread: item = new BreadLoaf(); break;
					case FruitType.Gourds: item = new Gourd(); break;
					case FruitType.Grapes: item = new Grapes(); break;
					case FruitType.Lemons: item = new Lemon(); break;
					case FruitType.Tomatoes: item = new Tomato(); break;
					case FruitType.Vegetables1:
					case FruitType.Vegetables2:
					case FruitType.Vegetables3:
						{
							switch( Utility.Random( 4 ) )
							{
								case 0: item = new Carrot(); break;
								case 1: item = new Onion(); break;
								case 2: item = new Pumpkin(); break;
								case 3: item = new Gourd(); break;
							}
							break;
						}
				}

				if( item != null )
					DropItem( item );
			}
		} 
Esempio n. 23
0
 public Object supplyHardwareHandle(Onion onion)
 {
     return(new ComPort_Win());
 }