private void Button_Click(object sender, RoutedEventArgs e) { int p = 1; if (input1.Text == "1") { p = 10; } else if (input1.Text == "2") { p = 20; } else if (input1.Text == "3") { p = 30; } else if (input1.Text == "4") { p = 40; } else if (input1.Text == "5") { p = 50; } Order added = new Order(); added.type = Convert.ToInt32(input1.Text); added.quantity = Convert.ToInt32(input2.Text); added.counter = counter; //orderArr.Add(added); OrderDI addedDI = new OrderDI(added); orderList.addNewOrder(addedDI); output.Text = ""; //foreach (Order s in orderArr) foreach (OrderDI s in orderList.orderArr) { output.Text += s.o.counter + " ,тип= " + s.o.type + " ,к-сть= " + s.o.quantity + " ,ціна= " + s.o.quantity * p + "\n"; } counter++; }
public void addNewOrder(OrderDI el) { orderArr.Add(el); }