private void doneButton_Click(object sender, RoutedEventArgs e) { var PaymentWindowScreen = new PaymentWindow(0, id2TextBlock.Text, customernameTextBox.Text, phonenumberTextBox.Text, addressTextBox.Text, staffnameTextBlock.Text, _goodsList.ToList(), totalTextBlock.Text); if (PaymentWindowScreen.ShowDialog() == true) { for (int i = 0; i < _goodsList.Count; i++) { Bill newBill = new Bill() { BillCode = id2TextBlock.Text, CustomerName = customernameTextBox.Text, CustomerPhoneNumber = phonenumberTextBox.Text, CustomerAddress = addressTextBox.Text, ID_Staff = _userID, ID_Goods = _goodsList[i].ID, DateTime = DateTime.Now.Date, Total = double.Parse(totalTextBlock.Text), VAT = 10, }; //Decrease number of this goods _goodsList[i].Number--; busGoods.UpdateGoods(_goodsList[i]); busBill.AddBill(newBill); } //Giống sự kiện cancelbillButton_Click id2TextBlock.Text = busBill.GetNextBillCode(); customernameTextBox.Text = ""; phonenumberTextBox.Text = ""; addressTextBox.Text = ""; totalTextBlock.Text = "0"; cashTextBox.Text = "0"; _goodsList.Clear(); return; } else { return; } }
private void searchButton_Click(object sender, RoutedEventArgs e) { if (searchTextBox.Text == "") { return; } List <Bill> bills = billListView.ItemsSource as List <Bill>; for (int i = 0; i < bills.Count; i++) { if (bills[i].BillCode == searchTextBox.Text) { List <Good> goodsOfSelectedBill = new List <Good>(); for (int j = 0; j < busBill.GetID_GoodsByBillCode(bills[i].BillCode).Count; j++) { goodsOfSelectedBill.Add(busGoods.GetGoodsById(busBill.GetID_GoodsByBillCode(bills[i].BillCode)[j])); } var PaymentWindowScreen = new PaymentWindow(1, bills[i].BillCode, bills[i].CustomerName, bills[i].CustomerPhoneNumber, bills[i].CustomerAddress, userConverter.Convert(bills[i].ID_Staff.Value, null, null, null) as string, goodsOfSelectedBill, bills[i].Total.ToString()); if (PaymentWindowScreen.ShowDialog() == true) { return; } else { return; } } } var AnnouncementWindowScreen = new AnnouncementWindow("DON'T FIND THIS CODE... PLEASE TYPE AGAIN!"); if (AnnouncementWindowScreen.ShowDialog() == true) { return; } else { return; } }
private void billListView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var selectedBill = billListView.SelectedItem as Bill; List <Good> goodsOfSelectedBill = new List <Good>(); for (int i = 0; i < busBill.GetID_GoodsByBillCode(selectedBill.BillCode).Count; i++) { goodsOfSelectedBill.Add(busGoods.GetGoodsById(busBill.GetID_GoodsByBillCode(selectedBill.BillCode)[i])); } var PaymentWindowScreen = new PaymentWindow(1, selectedBill.BillCode, selectedBill.CustomerName, selectedBill.CustomerPhoneNumber, selectedBill.CustomerAddress, userConverter.Convert(selectedBill.ID_Staff.Value, null, null, null) as string, goodsOfSelectedBill, selectedBill.Total.ToString()); if (PaymentWindowScreen.ShowDialog() == true) { return; } else { return; } }