void btn_Templete_Click(object sender, EventArgs e) { 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; this.Pub3.AddTable(); this.Pub3.AddCaptionLeft("节点与资料树访问权限"); string[] dirs = System.IO.Directory.GetDirectories(root); int idx = 0; foreach (string dir in dirs) { idx++; DirectoryInfo dirInfo = new DirectoryInfo(dir); FileInfo[] fls = dirInfo.GetFiles(); foreach (FileInfo fl in fls) { idx++; NodeAccess rl = new NodeAccess(); rl = new NodeAccess(); rl.FileFullName = fl.FullName; rl.FileName = fl.Name; rl.FK_Node = this.FK_Node; rl.FK_Prj = this.FK_Prj; rl.IsView = this.Pub3.GetCBByID("CB_" + NodeAccessAttr.IsView + "_" + idx).Checked; rl.IsDown = this.Pub3.GetCBByID("CB_" + NodeAccessAttr.IsDown + "_" + idx).Checked; rl.IsUpload = this.Pub3.GetCBByID("CB_" + NodeAccessAttr.IsUpload + "_" + idx).Checked; rl.IsDelete = this.Pub3.GetCBByID("CB_" + NodeAccessAttr.IsDelete + "_" + idx).Checked; rl.MyPK = DataType.ParseStringToPinyin(rl.FileName) + "_" + this.FK_Node + "_" + this.FK_Prj; rl.Save(); } } this.WinCloseWithMsg("Save OK."); }
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(); }
public void BindNodeRule() { 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; this.Pub3.AddTable("width=100%"); this.Pub3.AddCaptionLeft("节点与资料树访问权限 - <a href=\"javascript:AddDir('" + this.FK_Flow + "','" + this.FK_Node + "')\" >增加文件夹</a>"); string[] dirs = System.IO.Directory.GetDirectories(root); int idx = 0; foreach (string dir in dirs) { idx++; DirectoryInfo dirInfo = new DirectoryInfo(dir); this.Pub3.AddTR(); this.Pub3.AddTDIdx(idx); this.Pub3.AddTD("colspan=5", "<img src='./../Images/Btn/open.gif'>" + dirInfo.Name); this.Pub3.AddTD("<a href=\"javascript:AddFile('" + idx + "','" + this.FK_Flow + "','" + this.FK_Node + "')\" >增加模板</a>"); this.Pub3.AddTREnd(); FileInfo[] fls = dirInfo.GetFiles(); foreach (FileInfo fl in fls) { idx++; this.Pub3.AddTR(); this.Pub3.AddTDIdx(idx); this.Pub3.AddTD("<img src='./../Images/FileType/" + fl.Extension.Replace(".", "") + ".gif'>" + fl.Name); NodeAccess rl = nrs.GetEntityByKey(NodeAccessAttr.FileFullName, fl.FullName) as NodeAccess; if (rl == null) { rl = new NodeAccess(); rl.FileFullName = fl.FullName; rl.FileName = fl.Name; rl.FK_Node = this.FK_Node; } CheckBox cb = new CheckBox(); cb.ID = "CB_" + NodeAccessAttr.IsView + "_" + idx; cb.Text = "可见"; cb.Checked = rl.IsView; this.Pub3.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_" + NodeAccessAttr.IsDown + "_" + idx; cb.Text = "可下载"; cb.Checked = rl.IsDown; this.Pub3.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_" + NodeAccessAttr.IsUpload + "_" + idx; cb.Text = "可上传"; cb.Checked = rl.IsUpload; this.Pub3.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_" + NodeAccessAttr.IsDelete + "_" + idx; cb.Text = "可删除"; cb.Checked = rl.IsDelete; this.Pub3.AddTD(cb); this.Pub3.AddTD("<a href=\"javascript:DelFile('" + idx + "','" + this.FK_Flow + "','" + this.FK_Node + "')\" >删除</a>"); this.Pub3.AddTREnd(); } } this.Pub3.AddTableEnd(); this.Pub3.AddHR(); Button btn = new Button(); btn.Text = " Save "; btn.ID = "Btn_Save"; btn.Click += new EventHandler(btn_Templete_Click); this.Pub3.Add(btn); }