Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        switch (this.DoType)
        {
        case "Upload":
            this.BindUpload();
            return;

        case "DoDown":
            this.DoDown();
            return;

        case "DoDelete":
            this.DoDelete();
            return;

        default:
            break;
        }

        NodeAccesss nrs = new NodeAccesss();

        nrs.Retrieve(NodeAccessAttr.FK_Node, this.FK_Node, NodeAccessAttr.FK_Prj, this.FK_Prj);

        string root     = BP.SystemConfig.PathOfDataUser + "\\PrjData\\Templete\\" + this.FK_Prj;
        string rootData = BP.SystemConfig.PathOfDataUser + "\\PrjData\\Data\\" + this.FK_Prj;
        Prj    prj      = new Prj(this.FK_Prj);

        this.Pub1.AddTable();
        this.Pub1.AddCaptionLeft("项目目录树:" + prj.Name);
        this.Pub1.AddTR();
        this.Pub1.AddTDTitle("IDX");
        this.Pub1.AddTDTitle("目录");
        this.Pub1.AddTDTitle("文件");
        this.Pub1.AddTDTitle("操作");
        this.Pub1.AddTREnd();

        string MyFiles = "";
        int    idx     = 1;

        string[] strs = System.IO.Directory.GetDirectories(root);
        foreach (string str in strs)
        {
            DirectoryInfo dir  = new DirectoryInfo(str);
            FileInfo[]    fils = dir.GetFiles();
            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("<img src='./../Images/Btn/open.gif'>" + dir.Name);
            this.Pub1.AddTD("文件:" + fils.Length);
            this.Pub1.AddTD();
            this.Pub1.AddTREnd();
            foreach (FileInfo info in fils)
            {
                NodeAccess nr = nrs.GetEntityByKey(NodeAccessAttr.FileFullName, info.FullName) as NodeAccess;
                if (nr == null)
                {
                    nr = new NodeAccess();
                }

                if (nr.IsView == false)
                {
                    idx++;
                    continue;
                }


                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(idx++);
                this.Pub1.AddTD();
                this.Pub1.AddTDB("<img src='./../Images/FileType/" + info.Extension.Replace(".", "") + ".gif'>" + info.Name);

                string relFile = rootData + "\\" + dir.Name + "\\" + info.Name;
                MyFiles += "@" + idx + "=" + relFile;

                if (File.Exists(relFile) == true)
                {
                    string msg = "";
                    if (nr.IsDown)
                    {
                        msg += "[<a href=\"javascript:DoDown('" + this.FK_Prj + "','" + idx + "');\" ><img src='../Images/Btn/Save.gif' border=0/>下载</a>]";
                    }

                    if (nr.IsDelete)
                    {
                        msg += "[<a href=\"javascript:DoDelete('" + this.FK_Prj + "','" + idx + "');\" ><img src='../Images/Btn/Delete.gif' border=0/>删除</a>]";
                    }

                    if (nr.IsUpload)
                    {
                        msg += "[<a href=\"javascript:Upload('" + this.FK_Prj + "','" + idx + "');\" ><img src='../Images/Btn/ApplyTask.gif' border=0/>重新上传</a>]";
                    }
                    this.Pub1.AddTD(msg);
                }
                else
                {
                    if (nr.IsUpload)
                    {
                        this.Pub1.AddTD("<a href=\"javascript:Upload('" + this.FK_Prj + "','" + idx + "')\"><img src='../Images/Btn/ApplyTask.gif' border=0/>上传</a>");
                    }
                    else
                    {
                        this.Pub1.AddTD();
                    }
                }
                this.Pub1.AddTREnd();
            }
        }
        this.Pub1.AddTableEnd();

        prj.Files = MyFiles;
        prj.Update();
    }