private void cmdThemMoiBN_Click(object sender, EventArgs e)
 {
     try
     {
         frm_KCB_DANGKY frm = new frm_KCB_DANGKY(this.Args);
         frm.m_enAction = action.Insert;
         frm.m_dtPatient = m_dtPatient;
         this.myTrace.FunctionID = globalVariables.FunctionID;
         this.myTrace.FunctionName = globalVariables.FunctionName;
         frm.myTrace = this.myTrace;
         frm._OnActionSuccess += frm__OnActionSuccess;
         frm.grdList = grdList;
         frm.ShowDialog();
         if (!frm.m_blnCancel)
         {
             UpdateGroup();
             grdList_SelectionChanged(grdList, new EventArgs());
         }
         ModifyCommand();
         ModifycommandAssignDetail();
         ModifyButtonCommandRegExam();
     }
     catch (Exception ex)
     {
         Utility.ShowMsg("Lỗi:" + ex.Message);
     }
 }
 /// <summary>
 /// hàm thục hiện việc thêm lần khám
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdThemLanKham_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Utility.isValidGrid(grdList))
         {
             Utility.ShowMsg("Bạn phải chọn bệnh nhân để thêm lượt khám mới");
             return;
         }
         DataTable _temp = _KCB_DANGKY.KcbLaythongtinBenhnhan(Utility.Int64Dbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan)));
         if (_temp != null && Utility.ByteDbnull(_temp.Rows[0][KcbLuotkham.Columns.TrangthaiNoitru], 0) > 0 && Utility.ByteDbnull(_temp.Rows[0][KcbLuotkham.Columns.TrangthaiNoitru], 0) < 4)
         {
             Utility.ShowMsg("Bệnh nhân đang ở trạng thái nội trú và chưa ra viện nên không thể thêm lần khám mới. Đề nghị bạn xem lại");
             return ;
         }
         frm_KCB_DANGKY frm = new frm_KCB_DANGKY(this.Args);
         frm.txtMaBN.Text = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan));
         frm.txtMaLankham.Text = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.MaLuotkham));
         frm.txtMaBN.Enabled = false;
         frm._mabenhnhan = Utility.Int32Dbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan));
         frm._maluotkham = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.MaLuotkham));
         this.myTrace.FunctionID = globalVariables.FunctionID;
         this.myTrace.FunctionName = globalVariables.FunctionName;
         frm.myTrace = this.myTrace;
         frm.m_enAction = action.Add;
         frm._OnActionSuccess+=frm__OnActionSuccess;
         frm.m_dtPatient = m_dtPatient;
         frm.grdList = grdList;
         frm.ShowDialog();
         if (!frm.m_blnCancel)
         {
             UpdateGroup();
             grdList_SelectionChanged(grdList, new EventArgs());
         }
         ModifyCommand();
         ModifycommandAssignDetail();
         ModifyButtonCommandRegExam();
     }
     catch (Exception ex)
     {
         Utility.ShowMsg("Lỗi:" +ex.Message);
     }
 }
        private void cmdThemMoiBN_Click(object sender, EventArgs e)
        {
            try
            {
                frm_KCB_DANGKY frm = new frm_KCB_DANGKY();
                frm.m_enAction = action.Insert;
                frm.m_dtPatient = m_dtPatient;
                frm._OnActionSuccess += frm__OnActionSuccess;
                frm.grdList = grdList;
                frm.ShowDialog();
                if (!frm.m_blnCancel)
                {
                    UpdateGroup();
                    grdList_SelectionChanged(grdList, new EventArgs());
                }
                ModifyCommand();
                ModifycommandAssignDetail();
                ModifyButtonCommandRegExam();
            }
            catch (Exception exception)
            {

            }
            finally
            {
               // CauHinh();
            }
        }
        /// <summary>
        /// hàm thực hiện sửa thông tin của bệnh nhân
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdSuaThongTinBN_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Utility.isValidGrid(grdList))
                {
                    Utility.ShowMsg("Bạn phải chọn ít nhất 1 bệnh nhân để sửa thông tin");
                    return;
                }

                frm_KCB_DANGKY frm = new frm_KCB_DANGKY(this.Args);
                frm.txtMaBN.Text = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan));
                frm.txtMaLankham.Text = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.MaLuotkham));
                frm._mabenhnhan = Utility.Int32Dbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan));
                frm._maluotkham = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.MaLuotkham));
                frm.txtMaBN.Enabled = false;
                frm.txtMaLankham.Enabled = false;
                this.myTrace.FunctionID = globalVariables.FunctionID;
                this.myTrace.FunctionName = globalVariables.FunctionName;
                frm.myTrace = this.myTrace;
                frm._OnActionSuccess+=frm__OnActionSuccess;
                frm.m_enAction = action.Update;
                frm.m_dtPatient = m_dtPatient;
                frm.grdList = grdList;
                frm.ShowDialog();
                if (!frm.m_blnCancel)
                {
                    UpdateGroup();
                    grdList_SelectionChanged(grdList, new EventArgs());
                }
                ModifyCommand();
                ModifycommandAssignDetail();
                ModifyButtonCommandRegExam();
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Lỗi:" + ex.Message);
            }
        }
        /// <summary>
        /// hàm thực hiện sửa thông tin của bệnh nhân
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdSuaThongTinBN_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Utility.isValidGrid(grdList))
                {
                    Utility.ShowMsg("Bạn phải chọn ít nhất 1 bệnh nhân để sửa thông tin");
                    return;
                }

                frm_KCB_DANGKY frm = new frm_KCB_DANGKY();
                frm.txtMaBN.Text = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan));
                frm.txtMaLankham.Text = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.MaLuotkham));
                //  frm.cmdDanhSachBN.Enabled = false;
                frm._OnActionSuccess+=frm__OnActionSuccess;
                frm.m_enAction = action.Update;
                frm.m_dtPatient = m_dtPatient;
                frm.grdList = grdList;
                frm.ShowDialog();
                if (!frm.m_blnCancel)
                {
                    UpdateGroup();
                    grdList_SelectionChanged(grdList, new EventArgs());
                }
                ModifyCommand();
                ModifycommandAssignDetail();
                ModifyButtonCommandRegExam();
            }
            catch (Exception)
            {

            }
            finally
            {
                //CauHinh();
            }
        }