private void CreateFolder_Closed(object sender, EventArgs e) { NameForm nameForm = (NameForm)sender; if (nameForm.DialogResult != DialogResult.OK) { return; } try { int selectedResource = GetSelectedTreeResource(); if (selectedResource <= 0) { MessageBox.Show("选择的父目录不存在", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _currentUser.CreateFolder(selectedResource, nameForm.NewName); DirTree selTree = GetActiveTree(); selTree.ReloadTreeNode(selTree.MainTreeView.SelectedNode); } catch (Exception ex) { MessageBox.Show("创建目录失败:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void menuCreateFolder_Click(object sender, EventArgs e) { /* int selectedResource = GetSelectedTreeResource(); * if (selectedResource <= 0) * { * MessageBox.Show("请选择一个目录", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); * return; * } */ try { int selectedResource = GetSelectedTreeResource(); CACLEntity acl = new CACLEntity(MidLayerSettings.ConnectionString); acl.Acl_Resource = selectedResource; acl.Acl_Operation = (int)ACLOPERATION.WRITE; if (!_currentUser.CheckPrivilege(acl)) { MessageBox.Show("没有写权限!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } NameForm nameForm = new NameForm(); nameForm.Text = "创建目录"; nameForm.Closed += new EventHandler(CreateFolder_Closed); nameForm.ShowDialog(); } catch (Exception ex) { MessageBox.Show("创建目录失败:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }