private void Button_Click_1(object sender, RoutedEventArgs e) { TABLELIST table = dtgvBill.Tag as TABLELIST; int tableID = table.tableID; var bill = DataProvider.Ins.DB.BILLs.Where(x => x.tableID == tableID && x.billStatus == 0).ToList(); if (bill.Count > 0) { //Lay Bill cua ban hien tai var b = bill.First(); MessageBoxResult rs = MessageBox.Show("Bạn có chắc muốn thanh toán hóa đơn cho bàn " + table.tableName, "Xác nhận thanh toán", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (rs == MessageBoxResult.OK) { if (b != null) { var tb = DataProvider.Ins.DB.TABLELISTs.Where(x => x.tableID == tableID).ToList(); var t = tb.First(); wBill w = new wBill(t); w.ShowDialog(); b.billStatus = 1; b.checkOut = DateTime.Now.Date; DataProvider.Ins.DB.SaveChanges(); t.tableStatus = "Trống"; DataProvider.Ins.DB.SaveChanges(); ShowBill(tableID); stacklist.Children.Clear(); LoadTable(); } } } }
public wBill(TABLELIST table) { InitializeComponent(); this.Table = table; }