// Sua Benh Nhan private void button5_Click(object sender, EventArgs e) { // kiem tra du lieu dau vao if (txb_MaBN.Text == "" || (txb_MaBN.Text).Length > 5) { MessageBox.Show("Mã bệnh nhân không được trống và không quá 5 ký tự. Vui lòng nhập lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (IsNumber(txb_DienThoai.Text) == false || txb_DienThoai.Text == "") { MessageBox.Show("Số điện thoại không đúng. Vui lòng nhập lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txb_HoTen.Text == "") { MessageBox.Show(" Vui lòng nhập tên bệnh nhân lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txb_HoTen.Text == "") { MessageBox.Show(". Vui lòng nhập tên bệnh nhân lại!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // khoi tao doi tuong DTO BENHNHAN bnDTO = new BENHNHAN(); bnDTO.MaBN1 = int.Parse(txb_MaBN.Text); bnDTO.TenBN1 = txb_HoTen.Text; bnDTO.NgaySinh1 = DateTime.Parse(dtp_NgaySinh.Text); bnDTO.DiaChi1 = txb_DiaChi.Text; bnDTO.DienThoai1 = txb_DienThoai.Text.ToString(); //bnDTO.GioiTinh1= if (rdb_Nam.Checked == true) { bnDTO.GioiTinh1 = "Nam"; } else { bnDTO.GioiTinh1 = "Nữ"; } // goi lop nghiep vu BENHNHAN_BUS if (BenhNhanBUS.SuaBenhNhan(bnDTO) == true) { TaiDuLieuVaoDataGirdView(); MessageBox.Show("Sửa thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } MessageBox.Show(" Sửa không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); }