示例#1
0
        private void btnXacNhan_Click(object sender, EventArgs e)
        {
            BUL_ChiTietBaoCaoThang bUL_ChiTietBaoCaoThang = new BUL_ChiTietBaoCaoThang();

            if (txtMaCB.Text != "" && txtBCThang.Text != "")
            {
                ChiTietBaoCaoThang ctbct = new ChiTietBaoCaoThang(txtMaCB.Text, txtBCThang.Text);

                if (bUL_ChiTietBaoCaoThang.themCTBaoCaoThang(ctbct))
                {
                    MessageBox.Show("Thêm thành công");
                    dGVchiTietBCThang.DataSource = bUL_ChiTietBaoCaoThang.getCTBaoCaoThang(); // refresh datagridview
                }
                else
                {
                    MessageBox.Show("Đã có lỗi xảy ra", "Lỗi");
                }
            }
            else
            {
                MessageBox.Show("Xin hãy nhập đầy đủ");
            }
        }
        private void btnSua_Click(object sender, EventArgs e)
        {
            BUL_ChiTietBaoCaoThang bUL_ChiTietBaoCaoThang = new BUL_ChiTietBaoCaoThang();

            if (txtSTT.Text != "")
            {
                ChiTietBaoCaoThang ctbct = new ChiTietBaoCaoThang(Convert.ToInt32(txtSTT.Text), txtMaCB.Text, Convert.ToInt32(txtSoVe.Text), Convert.ToInt32(txtDoanhThu.Text), txtMaBCThang.Text);

                if (bUL_ChiTietBaoCaoThang.suaCTBaoCaoThang(ctbct))
                {
                    MessageBox.Show("Sửa thành công");
                    xemdulieu();
                    addbinding();
                }
                else
                {
                    MessageBox.Show("Đã có lỗi xảy ra", "Lỗi");
                }
            }
            else
            {
                MessageBox.Show("Kiểm tra lại");
            }
        }
        public bool xoaCTBaoCaoThang(ChiTietBaoCaoThang ctBCT)
        {
            Ultilies ultilies = new Ultilies();

            return(ultilies.xoaCTBaoCaoThang(ctBCT));
        }