private void BtnSuaDocGia_Click(object sender, EventArgs e)
 {
     if (id == -1)
     {
         ErrorMessage("Vui lòng chọn Độc Giả!!!", "Data Check Error");
     }
     else
     {
         if (checkNullForm() == false)
         {
             if (txtTienNo.Text.Equals(""))
             {
                 txtTienNo.Text = "0";
             }
             if (checkDateTime() == false)
             {
                 DocGia dg = new DocGia();
                 dg.SuaDocGia(txtNameDG.Text, datePickerNSDG.Value, txtAddressDG.Text, txtEmailDG.Text, datePickerNgayLapThe.Value, datePickerNgayHetHan.Value, Int16.Parse(txtTienNo.Text), id);
                 loadDocGia();
                 setNullForText();
                 id = -1;
             }
         }
     }
 }
        private void loadDocGia()
        {
            DocGia    dg = new DocGia();
            DataTable dt = dg.LayDSDocGia();

            GridViewDG.DataSource = dt;
        }
 private void BtnThemDocGia_Click(object sender, EventArgs e)
 {
     if (checkNullForm() == false)
     {
         if (txtTienNo.Text.Trim().Equals(""))
         {
             txtTienNo.Text = "0";
         }
         if (checkDateTime() == false)
         {
             DocGia dg = new DocGia();
             dg.ThemDocGia(txtNameDG.Text, datePickerNSDG.Value, txtAddressDG.Text, txtEmailDG.Text, datePickerNgayLapThe.Value, datePickerNgayHetHan.Value, Int16.Parse(txtTienNo.Text));
             loadDocGia();
         }
     }
 }
 private void BtnXoaDocGia_Click(object sender, EventArgs e)
 {
     if (id == -1)
     {
         ErrorMessage("Vui lòng chọn độc giả!!!", "Data Check Error");
     }
     else
     {
         DialogResult dlrs = MessageBox.Show("Bạn có chắc chắn muốn xoá không ?", "Warning !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (dlrs == DialogResult.Yes)
         {
             DocGia dg = new DocGia();
             dg.XoaDocGia(id);
             loadDocGia();
             setNullForText();
             id = -1;
         }
         else
         {
             setNullForText();
             id = -1;
         }
     }
 }