public bool SuaDoiThongTinNhapVienBN(NhapVien nvi) { string sql = string.Format("Update NHAPVIEN set MaKhoa = '{0}', MaPhongBenh = '{1}', MaGiuongBenh = '{2}', " + "KetQuaChuanDoan = N'{3}', PhuongPhapDieuTri = N'{4}', NgayNhapVien = N'{5}', NgayXuatVienDK = N'{6}', TamUng = '{7}' where MaNhapVien = '{8}'", nvi.MaKhoa, nvi.MaPhongBenh, nvi.MaGiuongBenh, nvi.KetQuaChuanDoan, nvi.PhuongPhapDieuTri, nvi.NgayNhapVien.ToString("MM/dd/yyyy"), nvi.NgayXuatVienDK.ToString("MM/dd/yyyy"), nvi.TamUng, nvi.MaNhapVien); if (connData.ExcuteQuery(sql)) return true; return false; }
//ham luu thong tin nhap vien cua benh nhan public bool LuuThongTinNhapVienBN(NhapVien nvi) { string sql = string.Format("Insert into NHAPVIEN(STT, MaNhapVien, MaBenhAn, MaBenhNhan, MaKhoa, MaPhongBenh, " + " MaGiuongBenh, KetQuaChuanDoan, PhuongPhapDieuTri, NgayNhapVien, NgayXuatVienDK, TamUng) values ('{0}', '{1}'," +" '{2}', '{3}', '{4}', '{5}', '{6}', N'{7}', N'{8}', N'{9}', N'{10}', '{11}' )", "0", nvi.MaNhapVien, nvi.MaBenhAn, nvi.MaBenhNhan, nvi.MaKhoa, nvi.MaPhongBenh, nvi.MaGiuongBenh, nvi.KetQuaChuanDoan, nvi.PhuongPhapDieuTri, nvi.NgayNhapVien.ToString("MM/dd/yyyy"), nvi.NgayXuatVienDK.ToString("MM/dd/yyyy"), nvi.TamUng); if (connData.ExcuteQuery(sql)) return true; return false; }
//ham lay thong tin nhap vien private NhapVien LayThongTinNhapVien() { NhapVien nvi = new NhapVien(); nvi.MaBenhNhan = txtNhapVien_MaBN.Text; nvi.MaBenhAn = txtNhapVien_MaBenhAn.Text; nvi.MaNhapVien = txtNhapVien_MaNhapVien.Text; nvi.KetQuaChuanDoan = txtNhapVien_KQChuanDoan.Text; nvi.MaKhoa = cboNhapVien_KhoaDieuTri.SelectedValue.ToString(); nvi.PhuongPhapDieuTri = txtNhapVien_PPDieuTri.Text; nvi.MaPhongBenh = cboNhapVien_PhongBenh.SelectedValue.ToString(); nvi.MaGiuongBenh = cboNhapVien_GiuongBenh.SelectedValue.ToString(); nvi.NgayNhapVien = Convert.ToDateTime(dtPickerNhapVien_NgayNhapVien.Value.ToString()); nvi.NgayXuatVienDK = Convert.ToDateTime(dtPickerNgayXuatVienDuKien.Value.ToString()); nvi.TamUng = txtNhapVien_TamUng.Text; return nvi; }