Beispiel #1
0
        private BenhNhan_DTO BiendoiBN()
        {
            BenhNhan_DTO bn = new BenhNhan_DTO();

            bn.Ma_bn     = txtMa.Text;
            bn.Ho_bn     = layho(txtTen.Text.ToString());
            bn.Ten_bn    = layten(txtTen.Text.ToString());
            bn.Gioi      = cboGioi.Text;
            bn.Ngay_sinh = chuyenkieu(dateNgay.Text.ToString());
            bn.Dia_chi   = txtNoio.Text;
            bn.Doi_tuong = cboDTuong.Text;
            return(bn);
        }
        private void btnXoa_Click(object sender, EventArgs e)
        {
            int blresult;

            blresult = 0;
            blresult = Convert.ToInt16(MessageBox.Show("Bạn có muốn xóa benh nhan", "Xóa Benh Nhan", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation));
            //MessageBox.Show(blresult.ToString());
            if (blresult == 1)
            {
                bn_DTO            = new BenhNhan_DTO();
                bn_BUS            = new BenhNhan_BUS();
                bn_DTO.MaBenhNhan = txtMaBenhNhan.Text.Trim();
                bn_BUS.XoaBenhNhan(bn_DTO);
            }
            FrmBenhNhan_GUI FrmBenhNhan = new FrmBenhNhan_GUI();

            Close();
            FrmBenhNhan.Show();
        }
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (txtHoTenBenhNhan.Text.Trim().Equals("") || txtDiaChi.Text.Trim().Equals("") || txtCMND.Text.Trim().Equals("") || txtNamSinh.Text.Trim().Equals(""))
            {
                MessageBox.Show("Loi");
            }
            else
            {
                int blresult;
                blresult = 0;
                blresult = Convert.ToInt16(MessageBox.Show("Bạn có muốn thêm bệnh nhân", "Thêm Bệnh Nhân", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation));
                //MessageBox.Show(blresult.ToString());
                if (blresult == 1)
                {
                    bn_DTO = new BenhNhan_DTO();
                    bn_BUS = new BenhNhan_BUS();

                    if (RadioButton1.Checked == true)
                    {
                        gioitinhbn = "Nam";
                    }
                    else if (RadioButton2.Checked == true)
                    {
                        gioitinhbn = "Nữ";
                    }
                    bn_DTO.MaBenhNhan    = txtMaBenhNhan.Text.Trim();
                    bn_DTO.HoTenBenhNhan = txtHoTenBenhNhan.Text.Trim();
                    bn_DTO.gioitinhbn    = gioitinhbn;
                    bn_DTO.NamSinh       = txtNamSinh.Text.Trim();
                    bn_DTO.DiaChi        = txtDiaChi.Text.Trim();
                    bn_DTO.NgayKham      = dtpNgayKham.Value.ToString("dd/MM/yyyy");
                    bn_DTO.CMND          = txtCMND.Text.Trim();

                    bn_BUS.NhapThongTinBenhNhanMoi(bn_DTO);

                    FrmBenhNhan_GUI FrmBenhNhan = new FrmBenhNhan_GUI();
                    Close();
                    FrmBenhNhan.Show();
                }
            }
        }
Beispiel #4
0
        // sửa bệnh nhân
        public void SuaBN(BenhNhan_DTO bn)
        {
            string sql = "UPDATE benhnhan SET ho_bn = N'" + bn.Ho_bn + "', ten_bn = N'" + bn.Ten_bn + "', gioi = N'" + bn.Gioi + "', ngay_sinh = '" + bn.Ngay_sinh + "', dia_chi = N'" + bn.Dia_chi + "', doi_tuong = N'" + bn.Doi_tuong + "' WHERE ma_bn = '" + bn.Ma_bn + "'";

            KetNoiDB.Khoa.ChayLenh(sql);
        }
Beispiel #5
0
        // thêm bệnh nhân
        public void ThemBN(BenhNhan_DTO bn)
        {
            string sql = @"INSERT INTO benhnhan (ma_bn, ho_bn, ten_bn, gioi, ngay_sinh, dia_chi, doi_tuong) VALUES('" + bn.Ma_bn + "',N'" + bn.Ho_bn + "',N'" + bn.Ten_bn + "',N'" + bn.Gioi + "','" + bn.Ngay_sinh + "',N'" + bn.Dia_chi + "',N'Không BHYT')";

            KetNoiDB.Khoa.ChayLenh(sql);
        }
 public void SuaThongTinBenhNhan(BenhNhan_DTO bn)
 {
     bn.Update();
 }
 public void XoaBenhNhan(BenhNhan_DTO bn)
 {
     bn.Delete();
 }
 public void NhapThongTinBenhNhanMoi(BenhNhan_DTO bn)
 {
     bn.Insert();
 }