/// <summary> /// 向TreeView中插入新节点 /// </summary> /// <param name="parent">父级节点</param> /// <param name="item">插入的节点</param> /// <returns></returns> private int AddTreeViewItem(TreeNode parent, neuObject item) { //设置插入的节点信息 TreeNode tn = new TreeNode(); tn.Text = item.Name; tn.ImageIndex = -1; tn.SelectedImageIndex = -1; tn.Tag = item; //Tag属性保存item //返回插入的节点 return(parent.Nodes.Add(tn)); }
/// <summary> /// 取分类明细中的各项数据,并显示在TreeView中 /// </summary> /// <param name="drugBillClassCode">摆药单分类编码</param> public void ShowList(string drugBillClassCode) { ArrayList al; //医嘱类别 this.tvOrderType.Nodes[0].Checked = false; al = this.myDrugStore.GetDrugBillList(drugBillClassCode, "TYPE_CODE"); foreach (DrugBillList info in al) { foreach (TreeNode tn in this.tvOrderType.Nodes[0].Nodes) { neuObject obj = (neuObject)tn.Tag; if (info.ID == obj.ID) { tn.Checked = true; } } } //药品用法 this.tvUsage.Nodes[0].Checked = false; al = this.myDrugStore.GetDrugBillList(drugBillClassCode, "USAGE_CODE"); foreach (DrugBillList info in al) { foreach (TreeNode tn in this.tvUsage.Nodes[0].Nodes) { neuObject obj = (neuObject)tn.Tag; if (info.ID == obj.ID) { tn.Checked = true; } } } //药品剂型 this.tvDosageForm.Nodes[0].Checked = false; al = this.myDrugStore.GetDrugBillList(drugBillClassCode, "DOSE_MODEL_CODE"); foreach (DrugBillList info in al) { foreach (TreeNode tn in this.tvDosageForm.Nodes[0].Nodes) { neuObject obj = (neuObject)tn.Tag; if (info.ID == obj.ID) { tn.Checked = true; } } } //药品性质 this.tvDrugQuality.Nodes[0].Checked = false; al = this.myDrugStore.GetDrugBillList(drugBillClassCode, "DRUG_QUALITY"); foreach (DrugBillList info in al) { foreach (TreeNode tn in this.tvDrugQuality.Nodes[0].Nodes) { neuObject obj = (neuObject)tn.Tag; if (info.ID == obj.ID) { tn.Checked = true; } } } //药品类别 this.tvDrugType.Nodes[0].Checked = false; al = this.myDrugStore.GetDrugBillList(drugBillClassCode, "DRUG_TYPE"); foreach (DrugBillList info in al) { foreach (TreeNode tn in this.tvDrugType.Nodes[0].Nodes) { neuObject obj = (neuObject)tn.Tag; if (info.ID == obj.ID) { tn.Checked = true; } } } }