private void InsertData()
        {
            clsBenhAn objBenhAn = new clsBenhAn();
            try
            {
                m_SoLuuTru = txtSoLuuTru.Text;
                objBenhAn.GetBySoLuuTru(m_SoLuuTru,Code);
                objBenhAn.SoLuuTru = txtSoLuuTru.Text;
                objBenhAn.MaYTe = txtMaYTe.Text;
                objBenhAn.HoTen = txtHoTen.Text;
                objBenhAn.GioiTinh = int.Parse(cboGioiTinh.SelectedValue.ToString());
                objBenhAn.Tuoi = txtTuoi.IntValue;
                objBenhAn.DanToc = txtDanToc.Text;
                objBenhAn.DiaChi = txtDiaChi.Text;
                objBenhAn.QuocTich = txtQuocTich.Text;
                objBenhAn.GiaTriTu = txtGiaTriTu.GetDate;
                objBenhAn.GiaTriDen = txtGiaTriDen.GetDate;
                objBenhAn.SoTheBHYT = txtSoTheBHYT.Text;
                objBenhAn.MaCSKCB = conf.MaCSKCB;

                DateTime? datetimeNgayVao = new DateTime?();
                DateTime? datetimeNgayRa = new DateTime?();

                if (txtNgayVaoVien.GetDate != null)
                    datetimeNgayVao = txtNgayVaoVien.GetDate.Value.AddHours(txtGioVaoVien.IntValue).AddMinutes(txtPhutVaoVien.IntValue);
                if (txtNgayRaVien.GetDate != null)
                    datetimeNgayRa = txtNgayRaVien.GetDate.Value.AddHours(txtGioRaVien.IntValue).AddMinutes(txtPhutRaVien.IntValue);

                objBenhAn.NgayVao = datetimeNgayVao;
                objBenhAn.NgayRa = datetimeNgayRa;

                objBenhAn.Loai = "GiayRaVien";
                objBenhAn.ChanDoan = txtChanDoan.Text;
                objBenhAn.ChanDoanGPBL = txtChanDoanGPBL.Text;
                objBenhAn.LoiDanThayThuoc = txtLoiDanThayThuoc.Text;
                objBenhAn.PhuongPhap = txtPhuongPhapDieuTri.Text;

                int kq = objBenhAn.Insert();
                if (kq > 0)
                {
                    //MessageBox.Show("Thêm mới bảng kê thành công", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    lblThongBao.Text = "Thêm giấy ra viện thành công.";
                    timerThongBao.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Thêm giấy ra viện không thành công.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Thêm giấy ra viện không thành công.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //lblThongBao.Text = "Thêm mới bảng kê không thành công";
                //timerThongBao.Enabled = true;
            }
        }
        private void InsertData()
        {
            clsBenhAn objBenhAn = new clsBenhAn();
            try
            {
                m_SoLuuTru = txtSoLuuTru.Text;
                objBenhAn.SoLuuTru = txtSoLuuTru.Text;
                objBenhAn.MaYTe = txtMaYTe.Text;
                objBenhAn.HoTen = txtHoTen.Text;
                objBenhAn.GioiTinh = int.Parse(cboGioiTinh.SelectedValue.ToString());
                objBenhAn.NoiChuyenDen = txtNoiChuyenDen.Text;
                objBenhAn.Tuoi = txtTuoi.IntValue;
                objBenhAn.DanToc = txtDanToc.Text;
                objBenhAn.DiaChi = txtDiaChi.Text;
                objBenhAn.QuocTich = txtQuocTich.Text;
                objBenhAn.NgheNghiep = txtNgheNghiep.Text;
                objBenhAn.NoiLamViec = txtNoiLamViec.Text;
                objBenhAn.GiaTriTu = txtGiaTriTu.GetDate;
                objBenhAn.GiaTriDen = txtGiaTriDen.GetDate;
                objBenhAn.SoTheBHYT = txtSoTheBHYT.Text;
                objBenhAn.TenCSKCB = lblCSKCB.Text;
                objBenhAn.MaCSKCB = conf.MaCSKCB;
                objBenhAn.NgayVao = txtTuNgay.GetDate;
                objBenhAn.NgayRa = txtDenNgay.GetDate;
                objBenhAn.DauHieu = txtDauHieuLamSang.Text;
                objBenhAn.KetQua = txtKetQuaXetNghiem.Text;
                objBenhAn.ChanDoan = txtChanDoan.Text;
                objBenhAn.PhuongPhap = txtPhuongPhap.Text;
                objBenhAn.TinhTrang = txtTinhTrang.Text;
                objBenhAn.LyDo = rdoDuDieuKien.Checked ? 1 : 0;

                DateTime? datetime = new DateTime?();
                if (txtNgayChuyenTuyen.GetDate != null)
                    datetime = txtNgayChuyenTuyen.GetDate.Value.AddHours(txtGio.IntValue).AddMinutes(txtPhut.IntValue);
                objBenhAn.ChuyenTuyenHoi = datetime;
                objBenhAn.HuongDieuTri = txtHuongDieuTri.Text;
                objBenhAn.PhuongTienVanChuyen = txtPhuongTienVanChuyen.Text;
                objBenhAn.NguoiHoTong = txtNguoiHoTong.Text;
                objBenhAn.Loai = "GiayChuyenTuyen";
                //objBenhAn.ChanDoanGPBL=;
                //objBenhAn.LoiDanThayThuoc=;
                objBenhAn.LyDoStr = rdoDuDieuKien.Checked ? rdoDuDieuKien.Text : rdoKhongDuDieuKien.Text;

                int kq = objBenhAn.Insert();
                if (kq > 0)
                {
                    //MessageBox.Show("Thêm mới bảng kê thành công", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    lblThongBao.Text = "Thêm giấy chuyển tuyến thành công.";
                    timerThongBao.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Thêm giấy chuyển tuyến không thành công.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Thêm giấy chuyển tuyến không thành công.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //lblThongBao.Text = "Thêm mới bảng kê không thành công";
                //timerThongBao.Enabled = true;
            }
        }