public void NewProducts() { // заполнение БД Random random = new Random(); for (int i = 0; i < 10; i++) { pizza pizza = new pizza(); pizza._name = $"Здесь должно быть название пиццы {i}"; pizza._price = random.Next(300, 400); // рандомная цена pizza._img = $"Здесь должна быть картинка пиццы {i}"; for (int j = 0; j < 5; j++) { ingredeent ingredeent = new ingredeent(); ingredeent.name = $"Сдесь должно быть название ингереента {j}"; pizza._ingredeents.Add(ingredeent); context.ingredeents.Add(ingredeent); context.SaveChanges(); Console.WriteLine("Добавлен ингедеент:" + ingredeent.name); } context.pizza.Add(pizza); context.SaveChanges(); Console.WriteLine("Давленна пицца" + pizza._name); } }
public PizzaOven() { Ingredients = new Dictionary <System.Type, Consumable>(); MaxIngredients = new Dictionary <System.Type, double>(); Ingredients[typeof(cheese)] = new cheese(); Ingredients[typeof(dough)] = new dough(); Ingredients[typeof(sauce)] = new sauce(); Ingredients[typeof(toppings)] = new toppings(); Ingredients[typeof(money)] = new money(); Ingredients[typeof(pizza)] = new pizza(); MaxIngredients[typeof(cheese)] = 5; MaxIngredients[typeof(dough)] = 10; MaxIngredients[typeof(sauce)] = 5; MaxIngredients[typeof(toppings)] = 10; MaxIngredients[typeof(money)] = 100000000000000000; }
static void Main(string[] args) { try { var tokens = Console.ReadLine().Split(); pizza pizza = new pizza(tokens[1]); tokens = Console.ReadLine().Split(); pizza.Dough = new dough(tokens[1], tokens[2], int.Parse(tokens[3])); string command; while ((command = Console.ReadLine()) != "END") { tokens = command.Split(); pizza.AddTopping(new topping(tokens[1], int.Parse(tokens[2]))); } Console.WriteLine(pizza); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }
public Barbeque(pizza pizza) { this.pizza = pizza; nome = "Barbeque"; }
public freshtomato(pizza pizza) { this.pizza = pizza; nome = "fresh tomato"; }
public ActionResult addOrder(string name, string address, string zip, string cc, string phone, bool delivary, int amountOfPizza, int[] size, bool[] pepperoni, bool[] mushrooms, bool[] onions, bool[] sasusage, bool[] bacon, bool[] extracheese, bool[] blackOlives, bool[] spinach, bool[] pineapple) { List <pizza> aListOfPizza = new List <pizza>(); List <orderConfirm> aListOfOrder = new List <orderConfirm>(); float pizzaprice = 0.0f; float toppingprice = 0.0f; float orderTotal = 0.0f; pizza thePizza; orderConfirm confirmPizza; aConn.addOrder(name, address, phone, delivary); for (int i = 0; i < amountOfPizza; i++) { thePizza = new pizza(); confirmPizza = new orderConfirm(); //setting the price for my pizza switch (size[i]) { case 1: pizzaprice = 7.45f; thePizza.SizeID = 1; confirmPizza.SizeID = "Small"; break; case 2: pizzaprice = 10.45f; thePizza.SizeID = 2; confirmPizza.SizeID = "Medium"; break; case 3: pizzaprice = 13.45f; thePizza.SizeID = 3; confirmPizza.SizeID = "Large"; break; } if (pepperoni[i] == true) { toppingprice += 1.25f; thePizza.Pepperoni = true; confirmPizza.Pepperoni = "pepperoni"; } else { toppingprice += 0; confirmPizza.Pepperoni = " "; } if (mushrooms[i] == true) { toppingprice += 0.75f; thePizza.Mushrooms = true; confirmPizza.Mushrooms = "mushroom"; } else { toppingprice += 0; confirmPizza.Mushrooms = " "; } if (onions[i] == true) { toppingprice += 1f; thePizza.Onions = true; confirmPizza.Onions = "onions"; } else { toppingprice += 0; confirmPizza.Onions = " "; } if (sasusage[i] == true) { toppingprice += 2f; thePizza.Sasuage = true; confirmPizza.Sasuage = "Sasuage"; } else { toppingprice += 0; confirmPizza.Sasuage = " "; } if (bacon[i] == true) { toppingprice += 2.50f; thePizza.Bacon = true; confirmPizza.Bacon = "Bacon"; } else { toppingprice += 0; confirmPizza.Bacon = " "; } if (extracheese[i] == true) { toppingprice += 1f; thePizza.ExtraCheese = true; confirmPizza.ExtraCheese = "Extra Cheese"; } else { toppingprice += 0; confirmPizza.ExtraCheese = " "; } if (blackOlives[i] == true) { toppingprice += 0.75f; thePizza.BlackOlives = true; confirmPizza.BlackOlives = "black Olives "; } else { toppingprice += 0; confirmPizza.BlackOlives = " "; } if (spinach[i] == true) { toppingprice += 1.50f; thePizza.Spinach = true; confirmPizza.Spinach = "Spinach "; } else { toppingprice += 0; confirmPizza.Spinach = " "; } if (pineapple[i] == true) { toppingprice += 1.50f; thePizza.Pineapple = true; confirmPizza.Pineapple = "pineapple"; } else { toppingprice += 0; confirmPizza.Pineapple = " "; } if (delivary == true) { pizzaprice += 1.0f; } else { pizzaprice += 0; } //Setting the price of one pizza float pizzaPrice = pizzaprice + toppingprice; thePizza.Price = pizzaPrice; // Put it inseide a list aListOfPizza.Add(thePizza); aListOfOrder.Add(confirmPizza); aConn.addPizzaDetails(name, size[i], pepperoni[i], mushrooms[i], onions[i], sasusage[i], bacon[i], extracheese[i], blackOlives[i], spinach[i], pineapple[i], pizzaPrice); } //adding all the prices in pizza foreach (var pizzas in aListOfPizza) { orderTotal += pizzas.Price; } //one more insert statement aConn.addTotal(name, orderTotal); ViewBag.Pizzas = aListOfOrder; ViewBag.TheOrderPrice = orderTotal; ViewBag.AmountOfPizzas = amountOfPizza; return(View()); }
public void NewOrder() { Console.Clear(); Order order = new Order(); order._timeOrder = DateTime.Now; Person person = new Person(); person.NewPerson(); while (true) { Console.WriteLine("что заказать? для выхода введите exit"); GetAllProducts(); if (Console.ReadLine() == "exit") { break; } else { try { int productID = Convert.ToInt32(Console.ReadLine()); pizza pizza = context.pizza.Find(productID); order._products.Add(pizza); Console.WriteLine("Сколько штук? "); OrderHistory History = new OrderHistory(); History.order = order; History.pizza = pizza; try { History.countProduct = Convert.ToInt32(Console.ReadLine()); } catch (Exception ex) { Console.WriteLine(ex.Message); } order.orderHistories.Add(History); } catch (Exception ex) { Console.WriteLine(ex.Message); } } Console.Clear(); } Console.Clear(); order._isDone = false; order._timeWait = order._timeOrder.AddMinutes(30); Console.WriteLine("Состав заказа: "); if (context.orders.Count() > 0) { order.orderNumber = context.orders.OrderBy(p => p.orderNumber).Last <Order>().orderNumber + 1; } else { order.orderNumber = 1; } context.people.Include(p => p.order); person.order.Add(order); context.people.Add(person); context.orders.Add(order); context.SaveChanges(); Console.WriteLine("Заказ сделан: "); GetInfoOrder(order.orderNumber); }