Beispiel #1
0
        private BanCoKhach getBanCoKhach()
        {
            BanCoKhach ban = new BanCoKhach();
            int        i   = 0;

            ban.MaBan = txtMaBan.Text;
            string soban = bckBO.laySoBan(txtMaBan.Text);

            Int32.TryParse(soban, out i);
            ban.SoBan = i;
            return(ban);
        }
Beispiel #2
0
        private void btnOKChuyen_Click(object sender, EventArgs e)
        {
            gbChuyenBan.Visible = false;
            BanCoKhach bck  = getBanCoKhach();
            Oder       od   = getOder();
            CTOder     ctod = getCTOder();
            HoaDon     hd   = getHD();
            int        maod = 0;

            Int32.TryParse(txtMaOder.Text, out maod);
            int soban = 0;

            Int32.TryParse(txtBanChuyen.Text, out soban);
            string maban = orderr.layMaBan(soban);

            od.MaBan   = maban;
            ctod.MaBan = maban;
            hd.MaBan   = maban;
            bck.MaBan  = txtMaBan.Text;
            bancokhach.XoaBanCoKhach(bck);
            bck.MaBan = maban;
            if (bancokhach.ThemBanCoKhach(bck) && orderr.ChuyenBan(od) && ctorder.ChuyenBan(ctod) && hoadon.ChuyenBan(hd))
            {
                MessageBox.Show("Đã chuyển bàn");
            }
            BanSDNhieu bsd1 = getBanSDNhieu();
            BanSDNhieu bsd2 = new BanSDNhieu();

            bsd2.MaBan = txtBanChuyen.Text;
            string soban2 = bansd.laySoBan(txtBanChuyen.Text);
            int    sb2    = 0;

            Int32.TryParse(soban2, out sb2);
            bsd2.SoBan = sb2;
            string luotsd2 = bansd.layLuotSD(txtBanChuyen.Text);
            int    lsd2    = 0;

            Int32.TryParse(luotsd2, out lsd2);
            int luotsddung2 = lsd2 + 1;

            bsd2.LuotSD = luotsddung2;
            bansd.SuaLuotSD(bsd2);

            string luotsd1 = bansd.layLuotSD(txtMaBan.Text);
            int    lsd1    = 0;

            Int32.TryParse(luotsd1, out lsd1);
            int luotsddung1 = lsd1 + 1;

            bsd1.LuotSD = luotsddung1;
            bansd.SuaLuotSD(bsd1);
        }
Beispiel #3
0
        private void btnTinhTien_Click_1(object sender, EventArgs e)
        {
            BanCoKhach bck  = getBanCoKhach();
            Oder       od   = getOder();
            CTOder     ctod = getCTOder();
            int        i    = 0;

            Int32.TryParse(txtMaOder.Text, out i);
            ctod.MaOder        = i;
            gbChonNhom.Visible = false;
            btnHoaDon.Visible  = true;
            bckBO.XoaBanCoKhach(bck);
            ctBO.XoaCTOder(ctod);
        }
Beispiel #4
0
        private void btnTinhTien_Click(object sender, EventArgs e)
        {
            gbThongTin.Visible          = true;
            dataGridViewCTOrder.Visible = true;
            BanCoKhach bck  = getBanCoKhach();
            Oder       od   = getOder();
            CTOder     ctod = getCTOder();
            int        i    = 0;

            Int32.TryParse(txtMaOder.Text, out i);
            ctod.MaOder = i;
            //gbChonNhom.Visible = false;
            btnHoaDon.Visible = true;
            bancokhach.XoaBanCoKhach(bck);
            ctorder.XoaCTOder(ctod);
        }
Beispiel #5
0
        private void btnGoiMon_Click(object sender, EventArgs e)
        {
            Oder       od  = getOder();
            HoaDon     hd  = getHD();
            BanCoKhach ban = getBanCoKhach();
            BanSDNhieu bsd = getBanSDNhieu();

            if (bancokhach.kiemTraBanCoKhach(ban.MaBan))
            {
                gbThongTin.Visible          = true;
                dataGridViewCTOrder.Visible = true;
            }
            else
            {
                if (orderr.ThemOder(od) == false || bancokhach.ThemBanCoKhach(ban) == false)
                {
                    MessageBox.Show("Không thể thực hiện gọi món");
                }
                else
                {
                    gbThongTin.Visible          = true;
                    dataGridViewCTOrder.Visible = true;
                }
                if (hoadon.ThemHD(hd) == false)
                {
                    MessageBox.Show("Không thể thêm hóa đơn");
                }
            }
            if (bansd.kiemTraTonTai(txtMaBan.Text) == false)
            {
                bsd.LuotSD = 1;
                bansd.ThemBanSDNhieu(bsd);
            }
            else
            {
                int i = int.Parse(txtMaOder.Text);
                if (ctorder.kiemTraGoiMon(i) == false)
                {
                    string luotsd = bansd.layLuotSD(txtMaBan.Text);
                    int    lsd    = 0;
                    Int32.TryParse(luotsd, out lsd);
                    int luotsddung = lsd + 1;
                    bsd.LuotSD = luotsddung;
                    bansd.SuaLuotSD(bsd);
                }
            }
        }
Beispiel #6
0
 private void btnThoat_Click(object sender, EventArgs e)
 {
     if (gbThongTin.Visible == false && dataGridViewCTOrder.Visible == false)
     {
         this.Close();
         frmSoDoChinh formchinh = new frmSoDoChinh();
         formchinh.Show();
     }
     else
     {
         frmSoDoChinh SoDoChinh = new frmSoDoChinh();
         string       maban     = txtMaBan.Text;
         //FromSoDoChinh = new frmSoDoChinh();
         BanCoKhach bck  = getBanCoKhach();
         Oder       od   = getOder();
         CTOder     ctod = getCTOder();
         HoaDon     hd   = getHD();
         CTHoaDon   cthd = getCTHD();
         BanSDNhieu bsd  = getBanSDNhieu();
         bck.MaBan = txtMaBan.Text;
         int i = int.Parse(txtMaOder.Text);
         od.MaOder = i;
         hd.MaOder = i;
         string maHD = hoadon.layMaHD(i);
         int    mahd = 0;
         Int32.TryParse(maHD, out mahd);
         string luotsd = bansd.layLuotSD(txtMaBan.Text);
         int    lsd    = 0;
         Int32.TryParse(luotsd, out lsd);
         if (ctorder.kiemTraGoiMon(i) == false)
         {
             hoadon.XoaHD(hd);
             bancokhach.XoaBanCoKhach(bck);
             orderr.XoaOder(od);
             int luotsddung = lsd - 1;
             bsd.LuotSD = luotsddung;
             bansd.SuaLuotSD(bsd);
         }
         this.Close();
         SoDoChinh.Show();
     }
 }
Beispiel #7
0
        private void btnThoat_Click(object sender, EventArgs e)
        {
            frmSoDoChinh SoDoChinh = new frmSoDoChinh();
            string       maban     = txtMaBan.Text;
            //FromSoDoChinh = new frmSoDoChinh();
            BanCoKhach bck  = getBanCoKhach();
            Oder       od   = getOder();
            CTOder     ctod = getCTOder();
            HoaDon     hd   = getHD();
            CTHoaDon   cthd = getCTHD();
            BanSDNhieu bsd  = getBanSDNhieu();

            bck.MaBan = txtMaBan.Text;
            int i = int.Parse(txtMaOder.Text);

            od.MaOder = i;
            hd.MaOder = i;
            string maHD = hdBO.layMaHD(i);
            int    mahd = 0;

            Int32.TryParse(maHD, out mahd);
            string luotsd = bsdBO.layLuotSD(txtMaBan.Text);
            int    lsd    = 0;

            Int32.TryParse(luotsd, out lsd);
            if (ctBO.kiemTraGoiMon(i) == false)
            {
                hdBO.XoaHD(hd);
                bckBO.XoaBanCoKhach(bck);
                odBO.XoaOder(od);
                int luotsddung = lsd - 1;
                bsd.LuotSD = luotsddung;
                bsdBO.SuaLuotSD(bsd);
            }
            this.Close();
            SoDoChinh.Show();
        }