//thêm
        //    int index = e.RowIndex;
        //    tbxmssv1.Text = dGVdsphieudangky["Column5", index].Value.ToString();
        //    tbxmapdk.Text = dGVdsphieudangky["Column1", index].Value.ToString();
        //    tbxmaquyenda.Text = dGVdsphieudangky["Column2", index].Value.ToString();

        //    dtpngaydkdt.Text = dGVdsphieudangky["Column4", index].Value.ToString();
        //    tbxmadt.Text = dGVdsphieudangky["Column3", index].Value.ToString();


        private void btnthem_Click(object sender, EventArgs e)
        {
            try
            {
                PhieuPhanCong PPC = new PhieuPhanCong();
                PPC.MaPhieuPC = tbxmaphieuphancong.Text.Trim();
                PPC.NgayPC    = dtpngayphancong.Value;
                PPC.MaGV      = tbxmaGV.Text.Trim();
                PPC.MaQuyenDA = tbxmaquyendoan.Text.Trim();
                PPC.MaChucVu  = tbxmachucvu.Text.Trim();
                PhieuPhanCongBLL PPCBLL = new PhieuPhanCongBLL();

                string _MaPhieuPC = tbxmaphieuphancong.Text.Trim();
                if (!(PPCBLL.CheckID(_MaPhieuPC)))
                {
                    PPCBLL.Insert(PPC);
                    LoadData();
                }
                else
                {
                    MessageBox.Show("Mã phieu phan cong " + _MaPhieuPC.ToString() + "đã tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Thêm bị lỗi: " + ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        public int Update(PhieuPhanCong obj)
        {
            int        result   = 0;
            string     strQuery = "update PHIEUPHANCONG set NgayPC='" + obj.NgayPC + "',FK_MaQuyenDA='" + obj.MaQuyenDA + "',FK_MaGV='" + obj.MaGV + "',FK_MaChucVu='" + obj.MaChucVu + "' where MaPhieuPC='" + obj.MaPhieuPC + "'";
            DataConfig config   = new DataConfig();

            result = config.excuteNoneQuery(strQuery);
            return(result); //tra ve so ghi nhan thuc hien
        }
        ////ham tim kiem
        //public DataTable TimKiem(string chuoi)
        //{
        //    DataTable result = new DataTable();
        //    DataConfig config = new DataConfig();//tao ket noi
        //    string strQuery = "select * from PHIEUPHANCONG Where MaPhieuPC like'%" + chuoi + "%'";   // tim kiem theo ma
        //    result = config.GetData(strQuery);// form load len thi thuc hien load data
        //    return result;
        //}
        //them csdl
        public int Insert(PhieuPhanCong obj)
        {
            int    result   = 0;
            string strQuery = "insert into PHIEUPHANCONG (MaPhieuPC,NgayPC,FK_MaQuyenDA,FK_MaGV,FK_MaChucVu) values ('" + obj.MaPhieuPC
                              + "','" + obj.NgayPC + "','" + obj.MaQuyenDA + "','" + obj.MaGV + "','" + obj.MaChucVu + "')";
            DataConfig config = new DataConfig();

            result = config.excuteNoneQuery(strQuery);
            return(result); //tra ve so ghi nhan thuc hien
        }
        private void btncapnhat_Click(object sender, EventArgs e)
        {
            try
            {
                PhieuPhanCong PPC = new PhieuPhanCong();
                PPC.MaPhieuPC = tbxmaphieuphancong.Text.Trim();
                PPC.NgayPC    = dtpngayphancong.Value;
                PPC.MaGV      = tbxmaGV.Text.Trim();
                PPC.MaQuyenDA = tbxmaquyendoan.Text.Trim();
                PPC.MaChucVu  = tbxmachucvu.Text.Trim();

                PhieuPhanCongBLL PPCBLL = new PhieuPhanCongBLL();

                string _MaPhieuPC = tbxmaphieuphancong.Text.Trim();
                PPCBLL.Update(PPC);
                LoadData();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Sửa bị lỗi: " + ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }