- using System;
- using System.Data;
- //使用TreeView控件的名称空间
- using Microsoft.Web.UI.WebControls;
- //使用业务层和公共层名称空间
- using qminoa.BLL;
- using qminoa.Common;
- namespace qminoa.Webs.FM
- {
- public class fmDocTree : qminoa.Webs.PageBase
- {
- protected Microsoft.Web.UI.WebControls.TreeView TvwDoc;
- static int fm_empid;
- private void Page_Load(object sender, System.EventArgs e)
- {
- if(!this.IsPostBack)
- {
- this.PageBegin("项目管理",true);
- fm_empid=Convert.ToInt16(this.Empid);
- BuildConstItems(TvwDoc);
- TvwDoc.ExpandLevel=2;
- }
- }
- public void BuildConstItems(TreeView TvwTree)
- {
- TreeNode subnode1= new TreeNode();
- subnode1.Text="文件管理";
- subnode1.ID="BB";
- subnode1.ImageUrl="images/folder.gif";
- subnode1.ExpandedImageUrl="images/folderopen.gif";
- subnode1.NavigateUrl="SecurityFMPage.aspx";
- subnode1.Target="frmEditor" ;
- TvwTree.Nodes.Add(subnode1);
- CreateDocTree(subnode1);
- }
- private void CreateDocTree(TreeNode node)
- {
- DocTree doctree =new DocTree();
- DataView dv = doctree.GetTreeNodeFolder(0);
- int nodecounts=dv.Count;
- for(int i=0;i<nodecounts;i++)
- {
- int id=Convert.ToInt32(dv[i].Row[0].ToString());
- int hifolderid=Convert.ToInt32(dv[i].Row[2].ToString());
- string foldername=dv[i].Row[15].ToString();
- TreeNode tvnode= new TreeNode();
- tvnode.Text=foldername;
- tvnode.ID=Convert.ToString(id);
- tvnode.ImageUrl="images/folder.gif";
- tvnode.ExpandedImageUrl="images/folderopen.gif";
- tvnode.NavigateUrl="SecurityFMPage.aspx?fid="+hifolderid+"&id="+id+"&type=-4";
- tvnode.Target="frmEditor";
- node.Nodes.Add(tvnode);
- LoadSubFolder(tvnode,id);
- }
- }
- private void LoadSubFolder(TreeNode node,int hifolderid)
- {
- DocTree doctree =new DocTree();
- DataView dv=doctree.GetTreeNodeFolder(hifolderid);
- int nodecounts=dv.Count;
- if(nodecounts!=0)
- {
- for(int i=0;i<nodecounts;i++)
- {
- int id=Convert.ToInt32(dv[i].Row[0].ToString());
- int hifid=Convert.ToInt32(dv[i].Row[2].ToString());
- string foldername=dv[i].Row[15].ToString();
- TreeNode tvnode= new TreeNode();
- tvnode.Text=foldername;
- tvnode.ID=Convert.ToString(hifid);
- tvnode.ImageUrl="images/folder.gif";
- tvnode.ExpandedImageUrl="images/folderopen.gif";
- tvnode.NavigateUrl="SecurityFMPage.aspx?fid="+hifid+"&id="+id+"&type=-4";
- tvnode.Target="frmEditor";
- node.Nodes.Add(tvnode);
- LoadSubFolder(tvnode,id);
- }
- }
- }
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- }
- }