예제 #1
0
        private void PhucVu_Load(object sender, EventArgs e)
        {
            //loi chao
            labelChao.Text = DangNhap._manhanvien;

            lbBan.Text = DSBan._ban;

            int ban = int.Parse(lbBan.Text);

            //neu ban chua dat
            if (DSBan.mang[ban - 1, 1] == -1)
            {
                btnLapHoaDonMoi.Visible = true;
                btnGiaiPhongBan.Visible = false;
            }
            else //neu ban da co
            {
                btnLapHoaDonMoi.Visible = false;
                btnGiaiPhongBan.Visible = true;
                //load ds loai
                dataGridView1.DataSource = LoaiMon_BUS.LoadDSLoaiMon();
                //load mon an trong hd vao data3
                dataGridView3.DataSource = CTHD_BUS.LoadCTHDTheoMHD(DSBan.mang[ban - 1, 1]);
                //cap nhat lb MHD
                lbMHD.Text = DSBan.mang[ban - 1, 1].ToString();
                //cap nhat tong tien
                float kq   = 0;
                int   dong = dataGridView3.RowCount;
                for (int i = 0; i < dong; i++)
                {
                    kq += float.Parse(dataGridView3.Rows[i].Cells[1].Value.ToString()) * float.Parse(dataGridView3.Rows[i].Cells[2].Value.ToString());
                }
                txtTongTien.Text = kq.ToString();
            }
        }
예제 #2
0
        private void btnCapNhatLoai_Click(object sender, EventArgs e)
        {
            //lay du lieu
            string maloaimon  = txtMaLoai.Text;
            string tenloaimon = txtTenLoai.Text;

            LoaiMon_DTO loaimon = new LoaiMon_DTO(maloaimon, tenloaimon);

            bool kt = LoaiMon_BUS.CapNhatLoaiMon(loaimon);

            if (kt == false)
            {
                //khong thanh cong
                MessageBox.Show("Mã loại món đã tồn tại!");
                return;
            }
            else
            {
                //thanh cong
                MessageBox.Show("Cập nhật loại món thành công!");
                //load lai danh sach
                dataGridView1.DataSource = LoaiMon_BUS.LoadDSLoaiMon();
                bingdingLoaiMon();
                //do du lieu vao comboboxLoai
                comboBoxThuocLoai.DataSource    = LoaiMon_BUS.DSMaLoaiMon();
                comboBoxThuocLoai.DisplayMember = "Maloaimon";
            }
        }
예제 #3
0
 private void QLMon_Loai_Load(object sender, EventArgs e)
 {
     //load danh sach loai mon
     dataGridView1.DataSource = LoaiMon_BUS.LoadDSLoaiMon();
     bingdingLoaiMon();
     //do du lieu vao combobox
     comboBoxThuocLoai.DataSource    = LoaiMon_BUS.DSMaLoaiMon();
     comboBoxThuocLoai.DisplayMember = "Maloaimon";
     //load danh sach mon an
     dataGridView2.DataSource = Mon_BUS.LoadDSMon();
     bingdingMon();
 }
예제 #4
0
        private void btnLapHoaDonMoi_Click(object sender, EventArgs e)
        {
            btnLapHoaDonMoi.Visible = false;
            btnGiaiPhongBan.Visible = true;

            DSBan.dsbutton[int.Parse(lbBan.Text) - 1].BackColor = Color.Red;
            //load ds loai
            dataGridView1.DataSource = LoaiMon_BUS.LoadDSLoaiMon();
            //them 1 hd moi
            HoaDon_DTO hd = new HoaDon_DTO(int.Parse(lbBan.Text), 0);

            HoaDon_BUS.ThemHoaDon(hd);
            //cap nhat mang
            DSBan.mang[int.Parse(lbBan.Text) - 1, 1] = int.Parse(HoaDon_BUS.CoutDS());
            //cap nhat lb
            lbMHD.Text = HoaDon_BUS.CoutDS();
        }
예제 #5
0
 private void btnDanhSachLoai_Click(object sender, EventArgs e)
 {
     dataGridView1.DataSource = LoaiMon_BUS.LoadDSLoaiMon();
     bingdingLoaiMon();
 }