private void btn_Them_Click(object sender, EventArgs e)
        {
            DTO_tbl_BenhNhan bn = new DTO_tbl_BenhNhan();

            bn.CCCD    = txt_CCCD.Text;
            bn.MatKhau = txt_MatKhau.Text;
            bn.HoTen   = txt_HoTen.Text;
            if (rdb_Nam.Checked == true)
            {
                bn.GioiTinh = "Nam";
            }
            else
            {
                bn.GioiTinh = "Nữ";
            }
            bn.NgaySinh = dtp_NgaySinh.Value;
            bn.MaBHYT   = txt_MaBHYT.Text;
            bn.DiaChi   = txt_DiaChi.Text;
            bn.SDT      = txt_SDT.Text;
            bus.InsertBenhNhan(bn);

            FormQuanLyBenhNhan_Load(sender, e);
        }
 private void btn_Them_Click(object sender, EventArgs e)
 {
     try
     {
         DTO_tbl_BenhNhan bn = new DTO_tbl_BenhNhan();
         if (txt_CCCD.Text.Trim() == "")
         {
             throw new Exception("Vui lòng nhập căn cước công dân");
         }
         else if (txt_HoTen.Text.Trim() == "")
         {
             throw new Exception("Vui lòng nhập họ tên bệnh nhân");
         }
         else if (txt_DiaChi.Text.Trim() == "")
         {
             throw new Exception("Vui lòng nhập địa chỉ bệnh nhân");
         }
         else if (txt_MaBHYT.Text.Trim() == "")
         {
             throw new Exception("Vui lòng nhập địa mã bảo hiểm y tế");
         }
         else if (txt_MatKhau.Text.Trim() == "")
         {
             throw new Exception("Vui lòng nhập mật khẩu");
         }
         else if (txt_SDT.Text.Trim() == "")
         {
             throw new Exception("Vui lòng nhập số điện thoại");
         }
         bn.HoTen    = txt_HoTen.Text;
         bn.MatKhau  = txt_MatKhau.Text;
         bn.NgaySinh = dtp_NgaySinh.Value;
         bn.SDT      = txt_SDT.Text;
         bn.CCCD     = txt_CCCD.Text;
         bn.DiaChi   = txt_DiaChi.Text;
         bn.MaBHYT   = txt_MaBHYT.Text;
         if (rdb_Nam.Checked)
         {
             bn.GioiTinh = "Nam";
         }
         else
         {
             bn.GioiTinh = "Nữ";
         }
         bus_benhnhan.InsertBenhNhan(bn);
         FormBacSi_QuanLyBenhNhan_Load(sender, e);
     }
     catch (SqlException er)
     {
         if (er.Message.Contains("DELETE statement conflicted with the REFERENCE constraint"))
         {
             MessageBox.Show("Tồn tại bệnh án vui lòng kiểm tra lại", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             MessageBox.Show(er.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }