private void DeleteFolder_Closed(object sender, EventArgs e) { if (((Form)sender).DialogResult != DialogResult.Yes) { return; } try { TreeNode node = GetSelectedTreeNode(); if (node == null || (int)node.Tag <= 0) { MessageBox.Show("选择的目录不存在", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } CResourceEntity res = new CResourceEntity(MidLayerSettings.ConnectionString).Load((int)node.Tag); String dirPath = res.MakeFullPath(); _currentUser.DeleteResource((int)node.Tag); System.IO.Directory.Delete(dirPath, true); node = node.Parent; if (node != null) { DirTree selTree = GetActiveTree(); selTree.ReloadTreeNode(node); } } catch (Exception ex) { MessageBox.Show("删除目录失败:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void SearchFullText(String text, int resource) { CResourceEntity res = new CResourceEntity().Load(resource); String s = res.MakeFullPath(); SearchFullText(text, s); }
private void DeleteFileHandler(object sender, EventArgs e) { if (((Form)sender).DialogResult != DialogResult.Yes) { return; } FileList currentList = GetActiveFileList(); if (currentList == null) { MessageBox.Show("请选择文件", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { foreach (ListViewItem item in currentList.FileListView.Items) { if (item.Checked) { CResourceEntity res = new CResourceEntity(MidLayerSettings.ConnectionString).Load((int)item.Tag); String filePath = res.MakeFullPath(); _currentUser.DeleteResource((int)item.Tag); System.IO.File.Delete(filePath); } } DirTree selTree = GetActiveTree(); selTree.ReloadFileList(); } catch (Exception ex) { MessageBox.Show("系统错误: " + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnStart_Click(object sender, EventArgs e) { try { COrganizeEntity currentOrg = new COrganizeEntity().Load(_currentUser.GetUserOrganize().Org_Id); CResourceEntity orgRes = new CResourceEntity().Load(currentOrg.Org_Resource); //string rootDir = Context.Server.MapPath("~/App_data"); string rootDir = ConfigurationManager.AppSettings["UserData"]; _temperoryFolder = rootDir + DateTime.Now.ToString("yyyy-MM-dd") + currentOrg.Org_Name; DirectoryInfo di = Directory.CreateDirectory(_temperoryFolder); Context.Session["temperoryFolder"] = _temperoryFolder; string outputPath = _temperoryFolder + @"\"; outputPath += currentOrg.Org_Name; outputPath += ".zip"; string orignPath = orgRes.MakeFullPath(); ZipFiles(orignPath, outputPath); LinkParameters objlinkParameters = new LinkParameters(); objlinkParameters.Target = "_self"; Link.Open(new Gizmox.WebGUI.Common.Gateways.GatewayReference(this, "Download"), objlinkParameters); //System.IO.File.Delete(outputPath); //di.Delete(); } catch (Exception ex) { MessageBox.Show("系统错误:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
public virtual void DeleteFile(CUserEntity user, int resource) { CResourceEntity res = new CResourceEntity(user.ConnString).Load(resource); String filePath = res.MakeFullPath(); user.DeleteResource(resource); System.IO.File.Delete(filePath); }
public virtual void DeleteFolder(CUserEntity user, int resource) { CACLEntity acl = new CACLEntity(user.ConnString); acl.Acl_Resource = resource; acl.Acl_Operation = (int)ACLOPERATION.WRITE; if (!user.CheckPrivilege(acl)) { throw new Exception("没有写权限!"); } CResourceEntity res = new CResourceEntity(user.ConnString).Load(resource); String dirPath = res.MakeFullPath(); user.DeleteResource(resource); System.IO.Directory.Delete(dirPath, true); }
IGatewayHandler IGatewayControl.GetGatewayHandler(IContext objContext, string strAction) { if (strAction == "Download") { //objContext.HttpContext.Response.ContentType = "image/jpeg"; int res = (int)fileListView.SelectedItems[0].Tag; CACLEntity acl = new CACLEntity(_currentUser.ConnString); acl.Acl_Operation = (int)ACLOPERATION.READ; acl.Acl_Resource = res; acl.Acl_Role = _currentUser.Usr_Id; acl.Acl_RType = (int)ACLROLETYPE.USERROLE; if (!_currentUser.CheckPrivilege(acl)) { return(null); } CResourceEntity resource = new CResourceEntity(_currentUser.ConnString).Load(res); String fileName = "attachment; filename=\"" + resource.Res_Name + "\""; String fullPath = resource.MakeFullPath(); objContext.HttpContext.Response.AddHeader("content-disposition", fileName); objContext.HttpContext.Response.WriteFile(fullPath); } return(null); }
private void OKBtn_Click(object sender, EventArgs e) { String targetText = targetBox.Text; if (targetText.Length <= 0) { MessageBox.Show("请填写检索内容!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } List <String> searchScopes = new List <string>(); if (currentDirBox.Checked) { CResourceEntity res = new CResourceEntity().Load(_resource); String curDir = res.MakeFullPath(); searchScopes.Add(curDir); } if (myDirBox.Checked) { int myDirId = _currentUser.Usr_Resource; CResourceEntity res = new CResourceEntity().Load(myDirId); String myDir = res.MakeFullPath(); searchScopes.Add(myDir); } if (archiveDirBox.Checked) { int archiveId = _currentUser.GetUserOrganize().Org_ArchiveRes; CACLEntity acl1 = new CACLEntity(); acl1.Acl_Resource = archiveId; acl1.Acl_Operation = (int)ACLOPERATION.READ; if (_currentUser.CheckPrivilege(acl1)) { CResourceEntity res = new CResourceEntity().Load(archiveId); String archiveDir = res.MakeFullPath(); searchScopes.Add(archiveDir); } else { List <CResourceEntity> ress = _currentUser.ListDescendants(archiveId); foreach (CResourceEntity res in ress) { searchScopes.Add(res.MakeFullPath()); } } } if (shareDirBox.Checked) { List <CResourceEntity> ress = _currentUser.ListShareResources(); foreach (CResourceEntity res in ress) { searchScopes.Add(res.MakeFullPath()); } } _result.Clear(); foreach (String s in searchScopes) { SearchFullText(targetText, s); } this.DialogResult = DialogResult.OK; Close(); }