private void grdTestInfo_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                flpStandardTest.Controls.Clear();
                flpTestGroup.Controls.Clear();
                if (grdTestInfo.CurrentRow == null)
                {
                    spcStandardTest.Panel1Collapsed = true;
                    return;
                }
                currentTestType_ID = Utility.Int32Dbnull(grdTestInfo.GetValue("TestType_ID"));
                LoadStandardTestType(currentTestType_ID);
                if (Utility.GetDataRow(dtTestTypeList, "TestType_ID", Utility.Int32Dbnull(grdTestInfo.GetValue("TestType_ID"))) == null)
                {
                    uiGroupBox4.Enabled = false;
                }
                else
                {
                    uiGroupBox4.Enabled = true;
                }

                if (flpStandardTest.Controls.Count > 0)
                {
                    ResetTabKey resetTabKey = new ResetTabKey();
                    resetTabKey.ArrControl = new Control[] { grdTestInfo, flpStandardTest.Controls[0] };
                    resetTabKey.Implement();
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
        private void grdTestInfo_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                flpStandardTest.Controls.Clear();
                flpTestGroup.Controls.Clear();
                if (grdTestInfo.CurrentRow == null)
                {
                    spcStandardTest.Panel1Collapsed = true;
                    return;
                }
                currentTestType_ID = Utility.Int32Dbnull(grdTestInfo.GetValue("TestType_ID"));
                LoadStandardTestType(currentTestType_ID);
                if (Utility.GetDataRow(dtTestTypeList, "TestType_ID", Utility.Int32Dbnull(grdTestInfo.GetValue("TestType_ID"))) == null)
                    uiGroupBox4.Enabled = false;
                else uiGroupBox4.Enabled = true;

                if (flpStandardTest.Controls.Count > 0)
                {
                    ResetTabKey resetTabKey = new ResetTabKey();
                    resetTabKey.ArrControl = new Control[] {grdTestInfo,flpStandardTest.Controls[0]};
                    resetTabKey.Implement();
                }

            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
        private void frm_AllMain_Load(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    var asm = Assembly.LoadFrom("VIETBAIT.LIS.HISConnectivity.dll");
                    var obj = (UserControl)asm.CreateInstance("VIETBAIT.LIS.HISConnectivity.Usc_KetNoi_XetNghiem");
                    if (obj != null)
                    {
                        obj.Dock = DockStyle.Fill;
                        obj.Visible = true;
                        tabHISLIS.TabVisible = true;
                        tabHISLIS.Controls.Add(obj);
                        //obj.BringToFront();
                    }
                }
                catch (Exception ex)
                {

                }
                try
                {
                    var asm = Assembly.LoadFrom("VIETBAIT.LIS.HISConnectivity.dll");
                    var obj = (UserControl)asm.CreateInstance("VIETBAIT.LIS.HISConnectivity.Usc_HisLis_Gtvt");
                    if (obj != null)
                    {
                        obj.Dock = DockStyle.Fill;
                        obj.Visible = true;
                        tabHISLIS.TabVisible = true;
                        tabHISLIS.Controls.Add(obj);
                        //obj.BringToFront();
                    }
                }
                catch (Exception ex)
                {
                    // Utility.ShowMsg("Lỗi ko load form HISConnectivity" + ex.ToString());
                }
                // Load tab HIS-LIS
                try
                {
                    var asm = Assembly.LoadFrom("VIETBAIT.LIS.HISConnectivity2.dll");
                    var obj = (UserControl) asm.CreateInstance("VIETBAIT.LIS.HISConnectivity.Uc_HisLis_NoiTiet");
                    if (obj != null)
                    {
                        obj.Dock = DockStyle.Fill;
                        obj.Visible = true;
                        tabHISLIS.TabVisible = true;
                        tabHISLIS.Controls.Add(obj);
                        //obj.BringToFront();
                    }
                }
                catch (Exception ex)
                {
                    //   Utility.ShowMsg("Lỗi ko load form HISConnectivity" + ex.ToString());
                }

                try
                {
                    if(_myProperties.TabCapNhapKetQua ==false)
                    {
                         var x = new Uc_QuickInputResult();
                    x.Dock = DockStyle.Fill;
                    x.Visible = true;
                    tabQuickInput.TabVisible = true;
                    tabQuickInput.Controls.Add(x);
                    }

                }
                catch (Exception ex)
                {
                    //  Utility.ShowMsg("Lỗi ko load form Uc_QuickInputResult" + ex.ToString());
                }
                try
                {
                    if (_myProperties.TabXulyDL == false)
                    {
                        tabDataMonitor.TabVisible = true;
                    }

                }
                catch (Exception ex)
                {
                    //  Utility.ShowMsg("Lỗi ko load form Uc_QuickInputResult" + ex.ToString());
                }

                SetEventColumnHeaderColor();

                if (!File.Exists(_autoLoadRegListFile))
                {
                    _autoLoadRegList = false;
                    File.WriteAllText(_autoLoadRegListFile, "0");
                }
                else
                {
                    var tempStr = File.ReadAllText(_autoLoadRegListFile);
                    _autoLoadRegList = tempStr.Contains("1");
                }

                ControlUtilities controlUtilities = new ControlUtilities();
                controlUtilities.FormName = this.Name;
                controlUtilities.Control = this;
                controlUtilities.SetChildWindowsFormProperties();

                ResetTabKey resetTabKey = new ResetTabKey();
                resetTabKey.ArrControl = new Control[] {grdTestInfoModification, grdResultModification};
                resetTabKey.Implement();

                _bw.DoWork += BwPerformSearch;
                _bw.RunWorkerCompleted += BwRunWorkerCompleted;

              //  btnExpandPanelText = btnExpandPanel.Text;
                LoadTestType();
                LoadDepartment();
                LoadObjectType();
                LoadSexCombo();
                LoadDevice();
                //cboDate.SelectedIndex = 0;
                grdPatients.CheckAllRecords();
                if (cmsResultDetail.Items["tsmEditResult"].Enabled == false)
                {
                    grdResultDetail.RootTable.Columns["Test_Result"].EditType = EditType.NoEdit;
                    grdResultDetail.RootTable.Columns["Test_Result"].CellStyle.BackColor = colorNoEditResult;
                }

                // Gán sự kiện cho các nút lọc đã in và chưa in
                rbtTatCa.CheckedChanged += rbtPrint_Checked_Changed;
                rbtChuaIn.CheckedChanged += rbtPrint_Checked_Changed;
                rbtDaIn.CheckedChanged += rbtPrint_Checked_Changed;
                tabTestInfo.SelectedIndex = 1;
                cmdSearch.PerformClick();
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Lỗi:" + ex.Message);
                Dispose();
            }
        }
 private void tabTestInfo_SelectedTabChanged(object sender, TabEventArgs e)
 {
     try
     {
         ResetTabKey resetTabKey;
         switch (tabTestInfo.SelectedTab.Name)
         {
             case "tabReg":
                 //PerformTabKeyAdjustment(grdPatients,grdTestTypeRegList);
                 //new ResetTabKey().Implement(new Control[] {grdPatients,grdTestTypeRegList});
                 resetTabKey = new ResetTabKey();
                 resetTabKey.ArrControl = new Control[] {grdPatients, grdTestTypeRegList};
                 resetTabKey.Implement();
                 break;
             case "tabResult":
                 //new ResetTabKey().Implement(new Control[] {grdPatients,grdTestInfo,grdResultDetail});
                 //PerformTabKeyAdjustment(grdPatients, grdTestInfo);
                 //PerformTabKeyAdjustment(grdTestInfo,grdResultDetail);
                 resetTabKey = new ResetTabKey();
                 resetTabKey.ArrControl = new Control[] {grdPatients, grdTestInfo, grdResultDetail};
                 resetTabKey.Implement();
                 break;
         }
         ModifyCommand();
         grdPatients_SelectionChanged(new object(), new EventArgs());
     }
     catch (Exception ex)
     {
         Utility.ShowMsg(ex.Message);
     }
 }