private bool CheckTonTai(string strMa)
 {
     bool kq = false;
     clsDM_ICD obj = new clsDM_ICD();
     kq = obj.CheckTonTai(strMa);
     return kq;
 }
        public bool CheckTonTai(int intMucHuong)
        {
            SQLiteConnection m_dbConnection = new SQLiteConnection(connectionString);
            m_dbConnection.Open();
            DataTable dt = new DataTable();
            string sql = "SELECT MucHuong FROM DM_MucHuongDoiTuong WHERE MucHuong=@MucHuong";
            SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
            command.Parameters.Add(new SQLiteParameter("@MucHuong", intMucHuong));
            SQLiteDataAdapter da = new SQLiteDataAdapter(command);
            da.Fill(dt);
            m_dbConnection.Close();

            clsDM_ICD obj = new clsDM_ICD();

            if (dt.Rows.Count > 0)
            {
                return true;
            }
            return false;
        }
        public bool CheckTonTai(string strMa)
        {
            //SQLiteConnection m_dbConnection = new SQLiteConnection(connectionString);
            m_dbConnection.Open();
            DataTable dt = new DataTable();
            string sql = "SELECT MaICD FROM DM_ICD WHERE MaICD=@MaICD";
            SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
            command.Parameters.Add(new SQLiteParameter("@MaICD", strMa));
            SQLiteDataAdapter da = new SQLiteDataAdapter(command);
            da.Fill(dt);
            m_dbConnection.Close();

            clsDM_ICD obj = new clsDM_ICD();

            if (dt.Rows.Count > 0)
            {
                return true;
            }
            return false;
        }
 private void txtMaICD_Validated(object sender, EventArgs e)
 {
     try
     {
         //txtMaICD.UpdateData();
         clsDM_ICD obj = new clsDM_ICD();
         obj.GetByKey(txtMaICD.Text);
         if (obj.MaICD == null)
         {
             txtMaICD.Text = "";//txtMaICD.SelectedValues["TenICD"].ToString();
             txtChanDoan.Text = "";
         }
         else
         {
             txtChanDoan.Text = obj.TenICD;
         }
         txtChanDoan.Select(txtChanDoan.Text.Length, 0);
     }
     catch { }
 }
        private void LoadDataCombobox()
        {
            //Chú ý khi đổ dữ liệu lần đầu, không cho valuechanged sự kiện cbo

            //Load data cbo trạng thái - 2 trạng thái: "tạo mới" và "đã gửi BHXH". Mặc định là tạo mới, khi cột DaGuiBHXH trong bảng BangKe là 1 thì sẽ là "đã gửi BHXH"

            cboTinhTrang.DataSource = Utilities.Utils.GetTrangThai();
            cboTinhTrang.DisplayMember = "Name";
            cboTinhTrang.ValueMember = "Value";

            //Load data cbo mã nơi sinh sống - 3 nơi: K1, K2, K3
            cboMaNoiSinhSong.DisplayMember = "Name";
            cboMaNoiSinhSong.ValueMember = "Value";
            cboMaNoiSinhSong.DataSource = Utilities.Utils.GetKhuVucSong();

            //Load gioi tinh
            cboGioiTinh.DataSource = Utilities.Utils.GetGioiTinh();
            cboGioiTinh.DisplayMember = "Name";
            cboGioiTinh.ValueMember = "Value";

            //Load gioi tinh
            cboTuyenKham.DataSource = Utilities.Utils.GetTuyenKham();
            cboTuyenKham.DisplayMember = "Name";
            cboTuyenKham.ValueMember = "Value";

            //Load data cơ sở khám chữa bệnh

            clsDM_CSKCB cskcb = new clsDM_CSKCB();
            dtCSKCB = cskcb.GetAllActive();
            txtNoiChuyenDen.Values = dtCSKCB;
            List<CDisplayColumns> lstColCSKCB = new List<CDisplayColumns>();
            lstColCSKCB.Add(new CDisplayColumns("MaCSKCB", "Mã CSKCB", true, true));
            lstColCSKCB.Add(new CDisplayColumns("TenCSKCB", "Tên CSKCB", true, true));

            txtNoiChuyenDen.DisplayColumns = lstColCSKCB;

            //Load data cbo mức hưởng
            clsDM_MucHuong mucHuong = new clsDM_MucHuong();
            cboMucHuong.DataSource = mucHuong.GetAllActive();
            cboMucHuong.DisplayMember = "MucHuong";
            cboMucHuong.ValueMember = "MucHuong";
            cboMucHuong.SelectedValue = 0;

            //Load data cbo ICD

            clsDM_ICD icd = new clsDM_ICD();

            DataTable dt = new DataTable();
            dt = icd.GetAllActive();

            txtMaICD.Values = dt;
            List<CDisplayColumns> lstCol = new List<CDisplayColumns>();
            lstCol.Add(new CDisplayColumns("MaICD", "Mã ICD", true, true));
            lstCol.Add(new CDisplayColumns("TenICD", "Tên ICD", true, true));

            txtMaICD.DisplayColumns = lstCol;

            txtBenhKhac.DisplayColumns = lstCol;
            txtBenhKhac.Values = dt;

            //Load data cbo Thuốc

            clsDM_Thuoc thuoc = new clsDM_Thuoc();
            txtThuoc.DropDownSize = new Size(600, 155);
            txtThuoc.Values = thuoc.GetAllALL();

            List<CDisplayColumns> lstColT = new List<CDisplayColumns>();
            lstColT.Add(new CDisplayColumns("Nhom", "Nhóm", false, true));
            lstColT.Add(new CDisplayColumns("MaChiPhi", "Mã chi phí", true, true));
            lstColT.Add(new CDisplayColumns("TenChiPhi", "Tên chi phí", true, true));
            lstColT.Add(new CDisplayColumns("DonGiaBHYT", "Đơn giá", false, true));
            txtThuoc.DisplayColumns = lstColT;
            txtThuoc.DisplayMember = "TenChiPhi";

            //Danh mục phòng ban
            clsDM_PhongBan phongban = new clsDM_PhongBan();
            txtKhoa.DropDownSize = new Size(300, 110);
            txtKhoa.Values = phongban.GetAllActive();
            List<CDisplayColumns> lstColPB = new List<CDisplayColumns>();
            lstColPB.Add(new CDisplayColumns("MaPhongBan", "Mã Khoa", true, true));
            lstColPB.Add(new CDisplayColumns("TenPhongBan", "Tên khoa", true, true));
            txtKhoa.DisplayColumns = lstColPB;
            txtKhoa.DisplayMember = "TenPhongBan";
        }
 private void LoadGridView()
 {
     clsDM_ICD obj = new clsDM_ICD();
     TableDanhMucICD = obj.GetAll();
     grdDM_ICD.DataSource = TableDanhMucICD;
 }