public void GetTree(string pid, TreeNode root) { try { PSP_ImgTree tree=new PSP_ImgTree(); tree.PID=pid; IList list = Services.BaseService.GetList("SelectPSP_ImgTreeListByPID", tree); for (int i = 0; i < list.Count;i++ ) { PSP_ImgTree nd = (PSP_ImgTree)list[i]; TreeNode node = new TreeNode(); node.Tag = nd.UID; node.Text = nd.Name; GetTree(nd.UID,node); root.Nodes.Add(node); } } catch (Exception exc) { } }
private void frmImgManager_Load(object sender, EventArgs e) { PSP_ImgTree tree = new PSP_ImgTree(); tree.PID = "0"; IList list = Services.BaseService.GetList("SelectPSP_ImgTreeListByPID", tree); for (int i = 0; i < list.Count; i++) { PSP_ImgTree nd = (PSP_ImgTree)list[i]; TreeNode node=new TreeNode(); node.Tag= nd.UID; node.Text= nd.Name; GetTree(nd.UID, node); treeView1.Nodes.Add(node); } if(pic==null){ btSave.Enabled = false; } }
private void addMenuItem_Click(object sender, EventArgs e) { if(uid==""){ MessageBox.Show("请选择节点", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } frmInputDialog frm = new frmInputDialog(); if (frm.ShowDialog()==DialogResult.OK) { string str= frm.InputStr; TreeNode node = new TreeNode(); node.Tag = Guid.NewGuid().ToString(); node.Text = str; treeView1.SelectedNode.Nodes.Add(node); PSP_ImgTree t=new PSP_ImgTree(); t.UID=node.Tag.ToString(); t.Name=node.Text; t.PID=treeView1.SelectedNode.Tag.ToString(); Services.BaseService.Create<PSP_ImgTree>(t); } }