private void DSACH_ICD(EditBox tEditBox, string LOAITIMKIEM, int CP)
 {
     try
     {
         this.Selected = false;
         string filterExpression = "";
         if (LOAITIMKIEM.ToUpper() == DmucChung.Columns.Ten)
         {
             filterExpression = " Disease_Name like '%" + tEditBox.Text + "%' OR FirstChar LIKE '%" + tEditBox.Text + "%'";
         }
         else if (LOAITIMKIEM == DmucChung.Columns.Ma)
         {
             filterExpression = DmucBenh.Columns.MaBenh + " LIKE '%" + tEditBox.Text + "%'";
         }
         DataRow[] source = this.dt_ICD.Select(filterExpression);
         if (source.Length == 1)
         {
             if (CP == 0)
             {
                 this.txtMaBenhChinh.Text = "";
                 this.txtMaBenhChinh.Text = Utility.sDbnull(source[0][DmucBenh.Columns.MaBenh], "");
                 this.hasMorethanOne = false;
                 this.txtMaBenhChinh_TextChanged(this.txtMaBenhChinh, new EventArgs());
                 this.txtMaBenhChinh.Focus();
             }
             else if (CP == 1)
             {
                 this.txtMaBenhphu.Text = Utility.sDbnull(source[0][DmucBenh.Columns.MaBenh], "");
                 this.hasMorethanOne = false;
                 this.txtMaBenhphu_TextChanged(this.txtMaBenhphu, new EventArgs());
                 this.txtMaBenhphu_KeyDown(this.txtMaBenhphu, new KeyEventArgs(Keys.Enter));
                 this.Selected = false;
             }
         }
         else if (source.Length > 1)
         {
             frm_DanhSach_ICD h_icd = new frm_DanhSach_ICD(CP)
             {
                 dt_ICD = source.CopyToDataTable<DataRow>()
             };
             h_icd.ShowDialog();
             if (!h_icd.has_Cancel)
             {
                 List<GridEXRow> lstSelectedRows = h_icd.lstSelectedRows;
                 if (CP == 0)
                 {
                     this.isLike = false;
                     this.txtMaBenhChinh.Text = "";
                     this.txtMaBenhChinh.Text = Utility.sDbnull(lstSelectedRows[0].Cells[DmucBenh.Columns.MaBenh].Value, "");
                     this.hasMorethanOne = false;
                     this.txtMaBenhChinh_TextChanged(this.txtMaBenhChinh, new EventArgs());
                     this.txtMaBenhChinh_KeyDown(this.txtMaBenhChinh, new KeyEventArgs(Keys.Enter));
                     this.Selected = false;
                 }
                 else if (CP == 1)
                 {
                     if (lstSelectedRows.Count == 1)
                     {
                         this.isLike = false;
                         this.txtMaBenhphu.Text = "";
                         this.txtMaBenhphu.Text = Utility.sDbnull(lstSelectedRows[0].Cells[DmucBenh.Columns.MaBenh].Value, "");
                         this.hasMorethanOne = false;
                         this.txtMaBenhphu_TextChanged(this.txtMaBenhphu, new EventArgs());
                         this.txtMaBenhphu_KeyDown(this.txtMaBenhphu, new KeyEventArgs(Keys.Enter));
                         this.Selected = false;
                     }
                     else
                     {
                         foreach (GridEXRow row in lstSelectedRows)
                         {
                             this.isLike = false;
                             this.txtMaBenhphu.Text = "";
                             this.txtMaBenhphu.Text = Utility.sDbnull(row.Cells[DmucBenh.Columns.MaBenh].Value, "");
                             this.hasMorethanOne = false;
                             this.txtMaBenhphu_TextChanged(this.txtMaBenhphu, new EventArgs());
                             this.txtMaBenhphu_KeyDown(this.txtMaBenhphu, new KeyEventArgs(Keys.Enter));
                             this.Selected = false;
                         }
                         this.hasMorethanOne = true;
                     }
                 }
                 tEditBox.Focus();
             }
             else
             {
                 this.hasMorethanOne = true;
                 tEditBox.Focus();
             }
         }
         else
         {
             this.hasMorethanOne = true;
             tEditBox.SelectAll();
         }
     }
     catch
     {
     }
     finally
     {
         this.isLike = true;
     }
 }
 private void DSACH_ICD(EditBox tEditBox, string LOAITIMKIEM, int CP)
 {
     try
     {
         Selected = false;
         string sFillter = "";
         if (LOAITIMKIEM.ToUpper() == DmucChung.Columns.Ten)
         {
             sFillter = " Disease_Name like '%" + tEditBox.Text + "%' OR FirstChar LIKE '%" + tEditBox.Text +
                        "%'";
         }
         else if (LOAITIMKIEM == DmucChung.Columns.Ma)
         {
             sFillter = DmucBenh.Columns.MaBenh+ " LIKE '%" + tEditBox.Text + "%'";
         }
         DataRow[] dataRows;
         dataRows = dt_ICD.Select(sFillter);
         if (dataRows.Length == 1)
         {
             if (CP == 0)
             {
                 txtMaBenhChinh.Text = "";
                 txtMaBenhChinh.Text = Utility.sDbnull(dataRows[0][DmucBenh.Columns.MaBenh], "");
                 hasMorethanOne = false;
                 txtMaBenhChinh_TextChanged(txtMaBenhChinh, new EventArgs());
                 txtMaBenhChinh.Focus();
             }
             else if (CP == 1)
             {
                 txtMaBenhphu.Text = Utility.sDbnull(dataRows[0][DmucBenh.Columns.MaBenh], "");
                 hasMorethanOne = false;
                 txtMaBenhphu_TextChanged(txtMaBenhphu, new EventArgs());
                 txtMaBenhphu_KeyDown(txtMaBenhphu, new KeyEventArgs(Keys.Enter));
                 Selected = false;
             }
         }
         else if (dataRows.Length > 1)
         {
             var frmDanhSachIcd = new frm_DanhSach_ICD(CP);
             frmDanhSachIcd.dt_ICD = dataRows.CopyToDataTable();
             frmDanhSachIcd.ShowDialog();
             if (!frmDanhSachIcd.has_Cancel)
             {
                 List<GridEXRow> lstSelectedRows = frmDanhSachIcd.lstSelectedRows;
                 if (CP == 0)
                 {
                     isLike = false;
                     txtMaBenhChinh.Text = "";
                     txtMaBenhChinh.Text =
                         Utility.sDbnull(lstSelectedRows[0].Cells[DmucBenh.Columns.MaBenh].Value, "");
                     hasMorethanOne = false;
                     txtMaBenhChinh_TextChanged(txtMaBenhChinh, new EventArgs());
                     txtMaBenhChinh_KeyDown(txtMaBenhChinh, new KeyEventArgs(Keys.Enter));
                     Selected = false;
                 }
                 else if (CP == 1)
                 {
                     if (lstSelectedRows.Count == 1)
                     {
                         isLike = false;
                         txtMaBenhphu.Text = "";
                         txtMaBenhphu.Text =
                             Utility.sDbnull(lstSelectedRows[0].Cells[DmucBenh.Columns.MaBenh].Value, "");
                         hasMorethanOne = false;
                         txtMaBenhphu_TextChanged(txtMaBenhphu, new EventArgs());
                         txtMaBenhphu_KeyDown(txtMaBenhphu, new KeyEventArgs(Keys.Enter));
                         Selected = false;
                     }
                     else
                     {
                         foreach (GridEXRow row in lstSelectedRows)
                         {
                             isLike = false;
                             txtMaBenhphu.Text = "";
                             txtMaBenhphu.Text =
                                 Utility.sDbnull(row.Cells[DmucBenh.Columns.MaBenh].Value, "");
                             hasMorethanOne = false;
                             txtMaBenhphu_TextChanged(txtMaBenhphu, new EventArgs());
                             txtMaBenhphu_KeyDown(txtMaBenhphu, new KeyEventArgs(Keys.Enter));
                             Selected = false;
                         }
                         hasMorethanOne = true;
                     }
                 }
                 tEditBox.Focus();
             }
             else
             {
                 hasMorethanOne = true;
                 tEditBox.Focus();
             }
         }
         else
         {
             hasMorethanOne = true;
             tEditBox.SelectAll();
         }
     }
     catch
     {
     }
     finally
     {
         isLike = true;
     }
 }