示例#1
0
        private void btnDanhSach_Click(object sender, EventArgs e)
        {
            //hien thi ds tiec
            Tiec_BUS t = new Tiec_BUS();

            dataGridViewDSTiec.DataSource = t.LoadTiec();
            //bingding
            bingding();
        }
示例#2
0
        private void QLTiec_Load(object sender, EventArgs e)
        {
            //chao
            labelChao.Text = DangNhap._manhanvien;

            //hien thi ds mon
            dataGridViewDSMon.DataSource = Mon_BUS.LoadDSMon();
            //hien thi ds tiec
            Tiec_BUS t = new Tiec_BUS();

            dataGridViewDSTiec.DataSource = t.LoadTiec();
            //bingding
            bingding();
        }
示例#3
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            //lay du lieu
            string   id         = txtID.Text;
            DateTime ngaytochuc = DateTime.Parse(txtNgayToChuc.Text);
            float    gia        = float.Parse(txtTongTien.Text);

            Tiec_DTO t = new Tiec_DTO(id, ngaytochuc, gia);
            //xoa
            Tiec_BUS t1 = new Tiec_BUS();

            t1.CapNhatTiec(t);
            //cap nhat danh sach tiec
            dataGridViewDSTiec.DataSource = t1.LoadTiec();
            //bingding
            bingding();
        }
示例#4
0
        private void btnThemMon_Click(object sender, EventArgs e)
        {
            //lay du lieu
            string id     = dataGridViewDSTiec.CurrentRow.Cells[0].Value.ToString();
            string mon    = dataGridViewDSMon.CurrentRow.Cells[1].Value.ToString();
            float  dongia = float.Parse(dataGridViewDSMon.CurrentRow.Cells[2].Value.ToString());

            int soluong = 0;

            if (txtSoLuong.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập số lượng! Vui lòng thử lại.");
                return;
            }
            else
            {
                soluong = int.Parse(txtSoLuong.Text);
            }
            CTTiec_DTO tiec = new CTTiec_DTO(id, mon, dongia, soluong);
            //them vao CTTiec
            CTTiec_BUS t = new CTTiec_BUS();

            t.ThemCTTiec(tiec);
            //hien thi CTTiec
            dataGridViewDSDaDat.DataSource = t.LoadCTHDTheoIDTiec(id);
            //cap nhat tong tien
            float kq   = 0;
            int   dong = dataGridViewDSDaDat.RowCount;

            for (int i = 0; i < dong; i++)
            {
                kq += (float.Parse(dataGridViewDSDaDat.Rows[i].Cells[1].Value.ToString()) * float.Parse(dataGridViewDSDaDat.Rows[i].Cells[2].Value.ToString()));
            }
            labelTongTien.Text = kq.ToString();
            //cap nhat tong tien TIEC
            Tiec_BUS tiecbus = new Tiec_BUS();

            tiecbus.CapNhatTongTien(id, float.Parse(labelTongTien.Text));
            //cap nhat ds
            dataGridViewDSTiec.DataSource = tiecbus.LoadTiec();
            //bingding
            bingding();
        }