private void addButton_Click(object sender, RoutedEventArgs e) { BillingOperation b = new BillingOperation(Convert.ToDouble(priceTextBox.Text), Convert.ToInt32(quantityTextBox.Text), menuComboBox.Text); BillingService bs = new BillingService(); String query = "select ORDERID,CATEGORYNAME, QUANTITY, PRICE from Orders where CATEGORYNAME = '" + menuComboBox.Text + "'"; SqlDataReader reader = DataAccess.GetData(query); if (reader.HasRows) { reader.Read(); if (reader.GetString(1).Equals(menuComboBox.Text)) { MessageBox.Show(reader.GetString(0)); b.Quantity = b.Quantity + reader.GetInt32(2); b.OrderPrice = Convert.ToDouble(priceTextBox.Text) * b.Quantity; bs.Edit(b, reader.GetString(0)); } } else { //MessageBox.Show(reader.GetString(0)); bs.AddOrder(b); } LoadData(); }
private void addButton_Click(object sender, RoutedEventArgs e) { BillingOperation b = new BillingOperation(Convert.ToDouble(priceTextBox.Text), Convert.ToInt32(quantityTextBox.Text), categoryComboBox.Text); BillingService bs = new BillingService(); bs.AddOrder(b); LoadData(); }
public void GivenIDoNotOrderAnyItem() { List <Item> items = new List <Item>(); IBillingService billingService = new BillingService(); var order = billingService.AddOrder(items); _orderContext.order = order; _orderContext.billingService = billingService; }
public void GivenIOrderAStarterAndAMains() { List <Item> items = new List <Item>() { new Item("Vegetable Gyoza", ItemType.Starter), new Item("Tofu Pad Thai", ItemType.Mains), }; IBillingService billingService = new BillingService(); var order = billingService.AddOrder(items); _orderContext.order = order; _orderContext.billingService = billingService; }
public void GivenIOrderTwoStartersAndOneMain() { List <Item> items = new List <Item>() { new Item("Veg Spring Rolls", ItemType.Starter), new Item("Veg Spring Rolls", ItemType.Starter), new Item("Tofu Pad Thai", ItemType.Mains), }; IBillingService billingService = new BillingService(); var order = billingService.AddOrder(items); _orderContext.order = order; _orderContext.billingService = billingService; }