private void btnConfirm_Click(object sender, EventArgs e) { string Username = frmLogin.loggedUser; if (dgvSell.RowCount > 0) { int rowcount = dgvSell.RowCount; sale.addBills(Username, txtBillName.Text.ToUpper(), DateTime.Now); int BillID = Convert.ToInt32((from p in sale.bills orderby p.billID descending select p.billID).First()); for (int i = 0; i < rowcount; i++) { int Price = Convert.ToInt32(dgvSell.Rows[i].Cells[2].Value.ToString()); string FoodName = dgvSell.Rows[i].Cells[0].Value.ToString(); int Amount = Convert.ToInt32(dgvSell.Rows[i].Cells[1].Value.ToString()); int Total = Price * Amount; int FoodID = Convert.ToInt32((from p in sale.foods where p.foodName == FoodName select p.foodID).First().ToString()); sale.addBillInfo(FoodID, BillID, Amount, Total); } sale.updateBills(BillID, Convert.ToInt32(txtTotal.Text)); if (cbTable.Text != "0") { sale.updateCoffeeTable(Convert.ToInt32(cbTable.Text), BillID, "full"); } frmBillInfo frm = new frmBillInfo(BillID.ToString()); frm.ShowDialog(); } btnClear_Click(sender, e); }
private void ptbView_Click(object sender, EventArgs e) { string BillID = (from p in table.coffeeTables where p.tableID == Convert.ToInt32(lblTN.Text) select p.billID).First().ToString(); frmBillInfo fr = new frmBillInfo(BillID); fr.ShowDialog(); }
private void ptbInfo_Click(object sender, EventArgs e) { frmBillInfo frm = new frmBillInfo(dgvBill.SelectedCells[0].OwningRow.Cells[0].Value.ToString()); frm.ShowDialog(); }