fmDocTree.aspx.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:3k
源码类别:

.net编程

开发平台:

Others

  1. using System;
  2. using System.Data;
  3. //使用TreeView控件的名称空间
  4. using Microsoft.Web.UI.WebControls;
  5. //使用业务层和公共层名称空间
  6. using qminoa.BLL;
  7. using qminoa.Common;
  8. namespace qminoa.Webs.FM
  9. {
  10. public class fmDocTree : qminoa.Webs.PageBase
  11. {
  12. protected Microsoft.Web.UI.WebControls.TreeView TvwDoc;
  13.     static int fm_empid;
  14. private void Page_Load(object sender, System.EventArgs e)
  15. {
  16. if(!this.IsPostBack)
  17. {
  18. this.PageBegin("项目管理",true);
  19.     fm_empid=Convert.ToInt16(this.Empid);
  20.     BuildConstItems(TvwDoc);
  21. TvwDoc.ExpandLevel=2; 
  22.  }
  23. }
  24. public void BuildConstItems(TreeView TvwTree)
  25. {
  26. TreeNode subnode1= new TreeNode(); 
  27. subnode1.Text="文件管理";
  28. subnode1.ID="BB";
  29. subnode1.ImageUrl="images/folder.gif";
  30. subnode1.ExpandedImageUrl="images/folderopen.gif";
  31. subnode1.NavigateUrl="SecurityFMPage.aspx";
  32. subnode1.Target="frmEditor" ;
  33. TvwTree.Nodes.Add(subnode1);
  34. CreateDocTree(subnode1);
  35. }
  36. private void  CreateDocTree(TreeNode node)
  37. {
  38. DocTree doctree =new DocTree();
  39.      DataView dv = doctree.GetTreeNodeFolder(0);
  40.             int nodecounts=dv.Count;
  41. for(int i=0;i<nodecounts;i++)
  42. {
  43. int  id=Convert.ToInt32(dv[i].Row[0].ToString());
  44.     int hifolderid=Convert.ToInt32(dv[i].Row[2].ToString());
  45.     string foldername=dv[i].Row[15].ToString();
  46. TreeNode tvnode= new TreeNode(); 
  47.                 tvnode.Text=foldername;
  48. tvnode.ID=Convert.ToString(id);
  49. tvnode.ImageUrl="images/folder.gif";
  50. tvnode.ExpandedImageUrl="images/folderopen.gif";
  51. tvnode.NavigateUrl="SecurityFMPage.aspx?fid="+hifolderid+"&id="+id+"&type=-4";
  52. tvnode.Target="frmEditor";
  53. node.Nodes.Add(tvnode);
  54. LoadSubFolder(tvnode,id);
  55. }
  56.         }
  57. private void  LoadSubFolder(TreeNode node,int hifolderid)
  58. {
  59. DocTree doctree =new DocTree();
  60. DataView dv=doctree.GetTreeNodeFolder(hifolderid);
  61.     int nodecounts=dv.Count;
  62. if(nodecounts!=0)
  63. {
  64. for(int i=0;i<nodecounts;i++)
  65. {
  66. int  id=Convert.ToInt32(dv[i].Row[0].ToString());
  67. int hifid=Convert.ToInt32(dv[i].Row[2].ToString());
  68. string foldername=dv[i].Row[15].ToString();
  69. TreeNode tvnode= new TreeNode(); 
  70.                     tvnode.Text=foldername;
  71. tvnode.ID=Convert.ToString(hifid);
  72. tvnode.ImageUrl="images/folder.gif";
  73. tvnode.ExpandedImageUrl="images/folderopen.gif";
  74.                     tvnode.NavigateUrl="SecurityFMPage.aspx?fid="+hifid+"&id="+id+"&type=-4";
  75. tvnode.Target="frmEditor"; 
  76. node.Nodes.Add(tvnode);
  77. LoadSubFolder(tvnode,id);
  78. }
  79. }
  80. }
  81. #region Web Form Designer generated code
  82. override protected void OnInit(EventArgs e)
  83. {
  84. //
  85. // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
  86. //
  87. InitializeComponent();
  88. base.OnInit(e);
  89. }
  90. /// <summary>
  91. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  92. /// 此方法的内容。
  93. /// </summary>
  94. private void InitializeComponent()
  95. {    
  96. this.Load += new System.EventHandler(this.Page_Load);
  97. }
  98. #endregion
  99. }
  100. }