示例#1
0
        private void InitFreddyStore()
        {
            Dictionary <string, decimal> toppings = new Dictionary <string, decimal>();

            toppings.Add("onions", 0.75m);
            toppings.Add("tomatoes", 1.50m);
            toppings.Add("spinach", 0.57m);
            toppings.Add("mushroom", 0.45m);
            toppings.Add("olive", 0.25m);
            toppings.Add("peppers", 0.30m);
            toppings.Add("pineapple", 0.50m);
            Dictionary <string, decimal> sizes = new Dictionary <string, decimal>();

            sizes.Add("medium", 5.00m);
            sizes.Add("large", 6.00m);
            Dictionary <string, decimal> crusts = new Dictionary <string, decimal>();

            crusts.Add("regular", 0.50m);
            crusts.Add("hand-tossed", 1.00m);
            crusts.Add("thin", 0.50m);
            //3, 100.00, 20
            AStore tempStore = InitNewStore("Freddy's Pizza Store", 10, 3, 100.00m, toppings, crusts, sizes);

            BasicPizza tempP = new BasicPizza();

            tempP.Type = "Basic Veggie Pizza";
            tempP.AddCrust(tempStore.CrustList[0]);
            tempP.AddTopping(tempStore.ToppingsList[0]);
            tempP.AddTopping(tempStore.ToppingsList[1]);
            tempP.AddTopping(tempStore.ToppingsList[4]);
            tempP.AddTopping(tempStore.ToppingsList[6]);
            //tempP.CalculatePrice();
            tempStore.PresetPizzas.Add(tempP);

            context.Add <AStore>(tempStore);
            context.SaveChanges();
        }
示例#2
0
        private void InitNewYorkStore()
        {
            Random rng = new Random();
            Dictionary <string, decimal> toppings = new Dictionary <string, decimal>();

            toppings.Add("beef", (rng.Next(1, 101) / 100.0m));
            toppings.Add("chicken", (rng.Next(1, 101) / 100.0m));
            toppings.Add("ham", (rng.Next(1, 101) / 100.0m));
            toppings.Add("mushroom", (rng.Next(1, 101) / 100.0m));
            toppings.Add("olive", (rng.Next(1, 101) / 100.0m));
            toppings.Add("peppers", (rng.Next(1, 101) / 100.0m));
            toppings.Add("pineapple", (rng.Next(1, 101) / 100.0m));
            toppings.Add("pepporoni", (rng.Next(1, 101) / 100.0m));
            toppings.Add("salami", (rng.Next(1, 101) / 100.0m));
            toppings.Add("sausage", (rng.Next(1, 101) / 100.0m));
            toppings.Add("meat ball", (rng.Next(1, 101) / 100.0m));
            toppings.Add("anchovies", (rng.Next(1, 101) / 100.0m));
            Dictionary <string, decimal> sizes = new Dictionary <string, decimal>();

            sizes.Add("small", 4.50m);
            sizes.Add("large", 5.50m);
            sizes.Add("extra large", 6.50m);
            Dictionary <string, decimal> crusts = new Dictionary <string, decimal>();

            crusts.Add("regular", 1.00m);
            crusts.Add("hand-tossed", 1.00m);
            crusts.Add("thin", 1.00m);
            //7, 250.00, 50)
            AStore tempStore = InitNewStore("NewYork Pizza Store", 50, 7, 200.0m, toppings, crusts, sizes);

            //     /*Meat*/
            BasicPizza tempP = new BasicPizza();

            tempP.Type = "Meat Pizza";
            tempP.AddCrust(tempStore.CrustList[0]);
            tempP.AddTopping(tempStore.ToppingsList[0]);
            tempP.AddTopping(tempStore.ToppingsList[1]);
            tempP.AddTopping(tempStore.ToppingsList[2]);
            tempP.AddTopping(tempStore.ToppingsList[6]);
            tempP.AddTopping(tempStore.ToppingsList[8]);
            //tempP.CalculatePrice();
            tempStore.PresetPizzas.Add(tempP);
            /*Hawaiian*/
            tempP      = new BasicPizza();
            tempP.Type = "Hawaiian Pizza";
            tempP.AddCrust(tempStore.CrustList[0]);
            tempP.AddTopping(tempStore.ToppingsList[2]);
            tempP.AddTopping(tempStore.ToppingsList[5]);
            tempP.AddTopping(tempStore.ToppingsList[7]);
            //tempP.CalculatePrice();
            tempStore.PresetPizzas.Add(tempP);
            /*Deluxe*/
            tempP      = new BasicPizza();
            tempP.Type = "Deluxe Pizza";
            tempP.AddCrust(tempStore.CrustList[0]);
            tempP.AddTopping(tempStore.ToppingsList[6]);
            tempP.AddTopping(tempStore.ToppingsList[9]);
            tempP.AddTopping(tempStore.ToppingsList[3]);
            tempP.AddTopping(tempStore.ToppingsList[5]);
            tempP.AddTopping(tempStore.ToppingsList[11]);
            //tempP.CalculatePrice();
            tempStore.PresetPizzas.Add(tempP);

            context.Add <AStore>(tempStore);
            context.SaveChanges();
        }