Beispiel #1
0
        /// <summary>
        /// 搜索功能
        /// 王冀 2012-10-30
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFind_Click(object sender, EventArgs e)
        {
            try
            {
                string key = this.tbQuery.Text.Trim().Replace("'", "''").Replace("*", "[*]").Replace("%", "[%]");
                m_HaveBindNode.Clear();//已绑定节点 清空 王冀 2012-10-30
                treeList_Medicine.ClearNodes();
                if (CheckKey(key))
                {
                    this.tbQuery.Focus(); return;
                }
                if (key == null || key.Trim() == string.Empty)
                {
                    DataTable rootDrug = m_SqlManger.GetMedicineTreeOne();
                    MakeTreeone(rootDrug);
                    this.tbQuery.Focus();
                }
                else
                {
                    DataTable rootDrug = m_SqlManger.GetMedicineTreeOneByKey(key);
                    MakeTreeone(rootDrug);

                    DataTable secondDrug = m_SqlManger.GetMedicaineTreeSecByKey(key);
                    MakeTwoone(secondDrug);

                    DataTable drug = m_SqlManger.GetMedicaineByKey(key);
                    MakeThreeOne(drug);
                }
                tbQuery.Focus();
            }
            catch (Exception ex)
            {
                MyMessageBox.Show(1, ex);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 搜索功能
        /// 王冀2012-10-29
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFind_Click(object sender, EventArgs e)
        {
            try
            {
                DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在构建树控件!");
                m_HaveBindNode.Clear();
                treeListFind.ClearNodes();
                string key = this.txtFind.Text.Trim().Replace("'", "''").Replace("*", "[*]").Replace("%", "[%]");
                if (CheckKey(key))
                {
                    this.txtFind.Focus(); return;
                }

                if (key == null || key.Trim() == string.Empty)
                {
                    this.treeListFind.Visible      = false;
                    this.treeList_Medicine.Visible = true;
                }
                else
                {
                    this.treeList_Medicine.Visible = false;
                    this.treeListFind.Visible      = true;
                    dtMyLeafNode = m_SqlManger.GetMedicaineByKey(sqlGetDrug, key);
                    if (dtMyLeafNode.Rows.Count == 0)
                    {
                        MessageBox.Show("没有查询到结果,请重新输入!");
                        return;
                    }
                    else
                    {
                        LoadTreeList(dtMyLeafNode);
                    }
                }
                DS_Common.HideWaitDialog(m_WaitDialog);
                txtFind.Focus();
            }
            catch (Exception ex)
            {
                MyMessageBox.Show(1, ex);
            }
        }