//Sua Doi Thong tin benh nhan cho public void SuaDoiBenhNhanCho(BenhNhanCho bnc) { string sql = string.Format("Update BENHNHANCHO set Ho = N'{0}', Ten = N'{1}', NgaySinh = N'{2}', GioiTinh = N'{3}', DiaChi = N'{4}'," + " CMND = '{5}', MaDoiTuong = '{6}', NgheNghiep = N'{7}', SDT = '{8}', YeuCauKham = '{9}', NgayKham = N'{10}', MaPhongKham = '{11}'" + " where MaBenhNhan = '{12}'", bnc.Ho, bnc.Ten, bnc.NgaySinh.ToString("MM/dd/yyyy"), bnc.GioiTinh, bnc.DiaChi, bnc.CMND, bnc.MaDoiTuong, bnc.NgheNghiep, bnc.SDT, bnc.YeuCauKham, bnc.NgayKham.ToString("MM/dd/yyyy"), bnc.MaPhongKham, bnc.MaBenhNhan); conn.ExcuteQuery(sql); }
//Ham Them Benh Nhan Moi vao danh sach benh nhan cho public bool ThemBenhNhanCho(BenhNhanCho bnc) { string sql = string.Format("Insert into BENHNHANCHO(STT, MaBenhNhan, MaDoiTuong, MaPhongKham, MaBacSi, Ho, Ten, GioiTinh, CMND, NgheNghiep, NgaySinh," + "DiaChi, SDT, YeuCauKham, GioKham, NgayKham) values('{0}', '{1}', '{2}', '{3}', '{4}', N'{5}', N'{6}', N'{7}', '{8}', N'{9}', N'{10}', N'{11}', '{12}', N'{13}', '{14}', N'{15}')", "0", bnc.MaBenhNhan, bnc.MaDoiTuong, bnc.MaPhongKham, bnc.MaBacSi, bnc.Ho, bnc.Ten, bnc.GioiTinh, bnc.CMND, bnc.NgheNghiep, bnc.NgaySinh.ToString("MM/dd/yyyy"), bnc.DiaChi, bnc.SDT, bnc.YeuCauKham, bnc.GioKham.ToString("hh:mm:ss"), bnc.NgayKham.ToString("MM/dd/yyyy")); if (connData.ExcuteQuery(sql)) return true; return false; }
//dong thoi lay thong tin benh nhan cho private BenhNhanCho LayThongTinBenhNhanCho() { BenhNhanCho bnc = new BenhNhanCho(); bnc.MaBenhNhan = txtThemBN_MaBenhNhan.Text; bnc.MaBenhAn = txtThemBN_MaBenhAnBN.Text; bnc.MaDoiTuong = cboThemBN_MaDoiTuongBN.SelectedValue.ToString(); bnc.MaPhieuKham = txtThemBN_MaPhieuBN.Text; bnc.MaPhongKham = cboThemBN_PhongKham.SelectedValue.ToString(); bnc.MaBacSi = txtThemBN_MaBacSi.Text; bnc.Ho = txtThemBN_HoBN.Text; bnc.Ten = txtThemBN_TenBN.Text; bnc.GioiTinh = cboThemBN_GioiTinhBN.SelectedValue.ToString(); bnc.CMND = Convert.ToInt32(txtThemBN_CMNDBN.Text); bnc.NgheNghiep = txtThemBN_NgheNghiepBN.Text; bnc.NgaySinh = Convert.ToDateTime(dtPickerThemBN_NgaySinhBN.Value.ToString()); bnc.DiaChi = txtThemBN_DiaChiBN.Text; bnc.SDT = Convert.ToInt64(txtThemBN_SDTBN.Text); bnc.YeuCauKham = rtxtThemBN_YeuCauKhamBN.Text; bnc.NgayKham = Convert.ToDateTime(dtPickerThemBN_NgayKhamBN.Value.ToString()); bnc.GioKham = Convert.ToDateTime(dtPicker_GioKhamBN.Value.ToString()); return bnc; }
// them vao danh sach benh nhan cho //ham them benh nhan moi vao CSDL public bool ThemBenhNhanCho(BenhNhanCho bnc) { //them thong tin vao table BENHNHAN string sql = string.Format("Insert into BENHNHANCHO(STT, MaBenhNhan, MaDoiTuong, Ho, Ten, GioiTinh, CMND, NgheNghiep, NgaySinh," + "DiaChi, SDT, YeuCauKham, MaBenhAn, NgayKham, MaPhongKham) values('{0}', '{1}', '{2}', N'{3}', N'{4}', N'{5}', '{6}', N'{7}', N'{8}', N'{9}', '{10}', N'{11}', '{12}', N'{13}', '{14}' )", "0", bnc.MaBenhNhan, bnc.MaDoiTuong, bnc.Ho, bnc.Ten, bnc.GioiTinh, bnc.CMND, bnc.NgheNghiep, bnc.NgaySinh.ToString("MM/dd/yyyy"), bnc.DiaChi, bnc.SDT, bnc.YeuCauKham, bnc.MaBenhAn, bnc.NgayKham.ToString("MM/dd/yyyy"), bnc.MaPhongKham); if (conn.ExcuteQuery(sql)) { MessageBox.Show("Đã thêm bệnh nhân thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return true; } else return false; }