Пример #1
0
        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);
        }
Пример #2
0
        private void ptbDelete_Click(object sender, EventArgs e)
        {
            string BillID = (from p in table.coffeeTables
                             where p.tableID == Convert.ToInt32(lblTN.Text)
                             select p.billID).First().ToString();

            table.updateCoffeeTable(Convert.ToInt32(lblTN.Text), null, "empty");
            ptbView.Visible   = false;
            ptbDelete.Visible = false;
            lblTable.Visible  = false;
            lblTN.Visible     = false;
            int i = Convert.ToInt32(lblTN.Text);

            switch (i)
            {
            case 1:
                ptbTable1F.Visible = false;
                break;

            case 2:
                ptbTable2F.Visible = false;
                break;

            case 3:
                ptbTable3F.Visible = false;
                break;

            case 4:
                ptbTable4F.Visible = false;
                break;

            case 5:
                ptbTable5F.Visible = false;
                break;

            case 6:
                ptbTable6F.Visible = false;
                break;

            case 7:
                ptbTable7F.Visible = false;
                break;

            case 8:
                ptbTable8F.Visible = false;
                break;

            case 9:
                ptbTable9F.Visible = false;
                break;
            }
        }
        private void UpdateBoT(int BillID)
        {
            var c = (from p in Statistics.coffeeTables
                     where p.billID == BillID
                     select p);

            if (c.Any())
            {
                int tblID = Convert.ToInt32((from p in Statistics.coffeeTables
                                             where p.billID == BillID
                                             select p.tableID).First().ToString());
                Statistics.updateCoffeeTable(tblID, null, "empty");
            }
        }