/// <summary> /// 在主目录树中定位具体的项,如果还未载入数据的载入此数据 /// </summary> /// <param name="level">定位的层级</param> /// <param name="selectnode">需要选中的节点数据</param> private void LocationNode(string level, Model.meddra selectnode) { TreeNode soc_tn, hlgt_tn, hlt_tn, pt_tn, llt_tn; switch (level) { case "soc": soc_tn = FindNodeByLevelCode("soc", selectnode.soc_code); mainTreeLoad("soc", soc_tn.Name, soc_tn); tvMedDra.SelectedNode = FindNodeByLevelCode("soc", selectnode.soc_code); break; case "hlgt": soc_tn = FindNodeByLevelCode("soc", selectnode.soc_code); mainTreeLoad("soc", soc_tn.Name, soc_tn); hlgt_tn = FindNodeByLevelCode("hlgt", selectnode.hlgt_code); mainTreeLoad("hlgt", hlgt_tn.Name, hlgt_tn); tvMedDra.SelectedNode = hlgt_tn; break; case "hlt": soc_tn = FindNodeByLevelCode("soc", selectnode.soc_code); mainTreeLoad("soc", soc_tn.Name, soc_tn); hlgt_tn = FindNodeByLevelCode("hlgt", selectnode.hlgt_code); mainTreeLoad("hlgt", hlgt_tn.Name, hlgt_tn); hlt_tn = FindNodeByLevelCode("hlt", selectnode.hlt_code); mainTreeLoad("hlt", hlt_tn.Name, hlt_tn); tvMedDra.SelectedNode = hlt_tn; break; case "pt": soc_tn = FindNodeByLevelCode("soc", selectnode.soc_code); mainTreeLoad("soc", soc_tn.Name, soc_tn); hlgt_tn = FindNodeByLevelCode("hlgt", selectnode.hlgt_code); mainTreeLoad("hlgt", hlgt_tn.Name, hlgt_tn); hlt_tn = FindNodeByLevelCode("hlt", selectnode.hlt_code); mainTreeLoad("hlt", hlt_tn.Name, hlt_tn); pt_tn = FindNodeByLevelCode("pt", selectnode.pt_code); mainTreeLoad("pt", pt_tn.Name, pt_tn); tvMedDra.SelectedNode = pt_tn; break; case "llt": soc_tn = FindNodeByLevelCode("soc", selectnode.soc_code); mainTreeLoad("soc", soc_tn.Name, soc_tn); hlgt_tn = FindNodeByLevelCode("hlgt", selectnode.hlgt_code); mainTreeLoad("hlgt", hlgt_tn.Name, hlgt_tn); hlt_tn = FindNodeByLevelCode("hlt", selectnode.hlt_code); mainTreeLoad("hlt", hlt_tn.Name, hlt_tn); pt_tn = FindNodeByLevelCode("pt", selectnode.pt_code); mainTreeLoad("pt", pt_tn.Name, pt_tn); llt_tn = FindNodeByLevelCode("llt", selectnode.llt_code); mainTreeLoad("llt", llt_tn.Name, llt_tn); tvMedDra.SelectedNode = llt_tn; break; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(MedDRASearch.Model.meddra model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(MedDRASearch.Model.meddra model) { return(dal.Add(model)); }
private void SearchCode() { string strResults = "查询返回结果:"; string strDetails = "内容:"; int resultsCount = 0; mSearchWord = txtSearch.Text; mSearchWord = mSearchWord.Trim(); if (mSearchWord.Length == 0) { MessageBox.Show("请输入搜索词再查询!", "MedDRA 数据查询", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //处理搜索SOCs范围 string strSOCs = ""; foreach (ListViewItem lvi in lvSOC.SelectedItems) { Model.meddra md = (Model.meddra)lvi.Tag; strSOCs = $"{strSOCs}or (soc_name = '{md.soc_name}') "; } if (strSOCs.Length > 0) { strSOCs = strSOCs.Substring(2); strSOCs = $" and ({strSOCs})"; } //根据搜索设置查询不同级别的数据 if (mSE.sSOC) { mSOC = bllMeddra.GetModelList($" soc_name like '%{mSearchWord}%'{strSOCs} group by soc_code"); if (mSOC.Count > 0) { strDetails = $"{strDetails}SOC({mSOC.Count().ToString()}) "; } resultsCount += mSOC.Count(); } if (mSE.sHLGT) { mHLGT = bllMeddra.GetModelList($" hlgt_name like '%{mSearchWord}%'{strSOCs} group by hlgt_code"); if (mHLGT.Count > 0) { strDetails = $"{strDetails}HLGT({mHLGT.Count().ToString()}) "; } resultsCount += mHLGT.Count(); } if (mSE.sHLT) { mHLT = bllMeddra.GetModelList($" hlt_name like '%{mSearchWord}%'{strSOCs} group by hlt_code"); if (mHLT.Count > 0) { strDetails = string.Format("{0}HLT({1}) ", strDetails, mHLT.Count().ToString()); } resultsCount += mHLT.Count(); } if (mSE.sPT) { mPT = bllMeddra.GetModelList($" pt_name like '%{mSearchWord}%'{strSOCs} group by pt_code"); if (mPT.Count > 0) { strDetails = $"{strDetails}PT({mPT.Count().ToString()}) "; } resultsCount += mPT.Count(); } if (mSE.sLLT) { mLLT = bllMeddra.GetModelList($" llt_name like '%{mSearchWord}%'{strSOCs} group by llt_code"); if (mLLT.Count > 0) { strDetails = $"{strDetails}LLT({mLLT.Count().ToString()}) "; } resultsCount += mLLT.Count(); } lblResults.Text = strResults + resultsCount.ToString(); lblDetails.Text = strDetails; //把新的搜索关键词添加到显示框中,当这个词已经存在,把这个词置前到首条 bool isExist = false; int itemIndex = 0; for (int i = 0; i < lbHistroy.Items.Count; i++) { if (lbHistroy.Items[i].ToString() == mSearchWord) { isExist = true; itemIndex = i; } } if (!isExist) { lbHistroy.Items.Insert(0, mSearchWord); } else { lbHistroy.Items.RemoveAt(itemIndex); lbHistroy.Items.Insert(0, mSearchWord); } //按当前选中的标签在树型框中显示查询结果 iniTreeview(); if (resultsCount > 0) { loadResultsData(tcResultOption.SelectedTab.Text); tcResultOption.Enabled = true; tvResults.Enabled = true; } else { tcResultOption.Enabled = false; tvResults.Enabled = false; } }