public FrmProuctRole(DEFolder2 Folder, DEFolder2 Product) { this.plRole = new PLRole(); this.hsTable = new Hashtable(); this.hsOldTable = new Hashtable(); this.selusers = new ArrayList(); this.InitializeComponent(); this.folder = Folder; this.product = Product; if (this.folder != null) { try { this.tvwRole.ImageList = ClientData.MyImageList.imageList; this.lvwTeam.SmallImageList = ClientData.MyImageList.imageList; ClientData.MyImageList.GetIconIndex("ICO_RSP_ROLE"); this.allRoleList = this.plRole.GetAllRoles(); this.allRoleGroupList = this.plRole.GetAllRoleGroups(); this.hsTable = (PLProductFolder.RemotingAgent as IProductFolder).GetProductRolesAndMembers(this.folder.Oid); this.roles = (PLProductFolder.RemotingAgent as IProductFolder).GetAllProductRolesInclueParents(this.folder.Oid, Guid.Empty); foreach (Guid guid in this.hsTable.Keys) { ArrayList list = new ArrayList(); foreach (Guid guid2 in this.hsTable[guid] as ArrayList) { list.Add(guid2); } this.hsOldTable.Add(guid, list); } this.RefreshRoleNode(); } catch { base.Close(); throw; } } }
private bool LocationChdFolderNode(TreeNode tvMain, Guid folderOid) { if (tvMain.Nodes.Count > 0) { foreach (TreeNode node in tvMain.Nodes) { if (!string.IsNullOrEmpty(node.Text)) { this.dropDownFolderTree.treeView.SelectedNode = node; DEFolder2 tag = node.Tag as DEFolder2; if (tag.Oid == folderOid) { this.dropDownFolderTree.TextValue = node.Text; return(true); } if (this.LocationChdFolderNode(node, folderOid)) { node.Expand(); return(true); } } } } return(false); }
public frmUserOrgProduct(DEFolder2 folder, DEFolder2 product) { this.SelUser = true; this.dt = new DataTable(); this.InitializeComponent(); if (folder.Oid != Guid.Empty) { this.ctluser = new UCUsers(); this.ctluser.showSysAdmin = false; this.ctluser.Dock = DockStyle.Fill; this.ctluser.lvwUser.MultiSelect = true; this.tabPage2.Controls.Add(this.ctluser); this.lvwTeam.MultiSelect = true; ArrayList productTeamMembers = (PLProductFolder.RemotingAgent as IProductFolder).GetProductTeamMembers(product.Oid); if (productTeamMembers.Count > 0) { this.tabControl1.SelectedTab = this.tabPage1; foreach (DEUser user in productTeamMembers) { ListViewItem item = this.lvwTeam.Items.Add(user.LogId, ClientData.MyImageList.GetIconIndex("ICO_RSP_USER")); item.SubItems.Add(user.Name); item.Tag = user; } } else { this.tabControl1.SelectedTab = this.tabPage2; } this.Text = "选择用户"; this.splitContainer.Panel2MinSize = 0; this.splitContainer.Panel2Collapsed = true; base.Width = 400; } }
public string GetValue() { string str = "SearchInFolder("; if (string.IsNullOrEmpty(this.dropDownFolderTree.TextValue)) { MessageBoxPLM.Show("文件夹路径没有定义", "在文件夹中查询对象函数", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(""); } if (this.dropDownFolderTree.treeView.SelectedNode.Parent == null) { if (this.dropDownFolderTree.treeView.SelectedNode.FullPath == "公共文件夹") { str = str + Guid.Empty.ToString("N"); } else { str = str + ClientData.LogonUser.Oid.ToString("N"); } } else { DEFolder2 tag = this.dropDownFolderTree.treeView.SelectedNode.Tag as DEFolder2; str = str + tag.Oid.ToString("N"); } if (this.chContainSubFolder.Checked) { str = str + ",true"; } else { str = str + ",false"; } if (this.iFolderType == 0) { str = str + ",private,"; } else { str = str + ",public,"; } if (this.dropDownFolderTree.treeView.SelectedNode.Parent == null) { if (this.dropDownFolderTree.treeView.SelectedNode.FullPath == "公共文件夹") { str = str + "C"; } else { str = str + "P"; } } else { DEFolder2 folder2 = this.dropDownFolderTree.treeView.SelectedNode.Tag as DEFolder2; str = str + folder2.Status.ToString(); } return((str + "," + ClientData.LogonUser.Oid.ToString("N")) + ")"); }
private void PLMFolderTree_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node != null) { try { this.currentNode = e.Node; if (this.currentNode.Tag is DEFolder2) { if (this.NodesExpanded[this.currentNode] == null) { this.NodesExpanded.Add(this.currentNode, true); } this.DisPlaySubFolder(this.currentNode); DEFolder2 tag = this.currentNode.Tag as DEFolder2; switch (tag.FolderType) { case 'A': this.iFolderType = 1; return; case 'B': this.iFolderType = 0; return; case 'C': this.iFolderType = 1; return; case 'P': this.iFolderType = 0; return; } } else if (this.currentNode.Tag is string) { if (this.NodesExpanded[this.currentNode] == null) { this.NodesExpanded.Add(this.currentNode, true); } if (this.currentNode == this.PubRoot) { this.DisPlayPubvFolder(this.currentNode); this.iFolderType = 1; } else if (this.currentNode == this.PrvRoot) { this.DisPlayPrivFolder(this.currentNode); this.iFolderType = 0; } } } catch (PLMException exception) { PrintException.Print(exception); } } }
private DEFolder2 GetFolderParent(DEFolder2 Folder) { if (Folder.FolderType == 'F') { return(Folder); } if (Folder.FolderType == 'G') { Guid parent = Folder.Parent; DEFolder2 folderByOid = PLFolder.RemotingAgent.GetFolderByOid(parent); return(this.GetFolderParent(folderByOid)); } return(null); }
private void DisPlaySubFolder(TreeNode pNode) { if (((pNode != null) && !(pNode.Tag is string)) && (pNode.Tag is DEFolder2)) { Cursor.Current = Cursors.WaitCursor; DEFolder2 tag = (DEFolder2)pNode.Tag; pNode.Nodes.Clear(); try { ArrayList subFolders = PLFolder.RemotingAgent.GetSubFolders(ClientData.LogonUser.Oid, tag.Oid); string sortType = ClientData.GetSortType("SORT_FOLDER"); IComparer comparer = null; if (sortType != "") { comparer = new SortArraylist(sortType, "SORT_FOLDER"); } else { comparer = new SortArraylist("NAME", "SORT_FOLDER"); } subFolders.Sort(comparer); foreach (DEFolder2 folder2 in subFolders) { TreeNode node = new TreeNode(folder2.Name, this.folderImage.GetObjectImage("folder", "close"), this.folderImage.GetObjectImage("folder", "open")) { Tag = folder2 }; pNode.Nodes.Add(node); if (folder2.CanExpand) { node.Nodes.Add(new TreeNode()); } } } catch (PLMException exception) { PrintException.Print(exception); } catch (Exception exception2) { PrintException.Print(exception2); } finally { Cursor.Current = Cursors.Default; } } }
private void FolderDelete(object sender, EventArgs e) { if (MessageBox.Show("你确定要删除文件夹“" + this.tvwFolder.SelectedNode.Text + "”吗?", "文件夹定制", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) { DEFolder2 tag = (DEFolder2)this.tvwFolder.SelectedNode.Tag; try { Hashtable result = null; PLFolder.RemotingAgent.DeleteFolder(ClientData.LogonUser.Oid, tag.Oid, true, false, out result); this.tvwFolder.SelectedNode.Remove(); } catch (Exception exception) { PrintException.Print(exception); } } }
private void LocationFolderNode(TreeView tvMain, Guid folderOid) { if (tvMain.Nodes.Count > 0) { foreach (TreeNode node in tvMain.Nodes) { this.dropDownFolderTree.treeView.SelectedNode = node; bool flag = false; if (node.Text == "个人文件夹") { if (ClientData.LogonUser.Oid == folderOid) { this.dropDownFolderTree.TextValue = node.Text; break; } flag = true; } if (node.Text == "公共文件夹") { if (Guid.Empty == folderOid) { this.dropDownFolderTree.TextValue = node.Text; break; } flag = true; } if (!flag) { DEFolder2 tag = node.Tag as DEFolder2; if (tag.Oid == folderOid) { tvMain.SelectedNode = node; this.dropDownFolderTree.TextValue = node.Text; break; } } if (this.LocationChdFolderNode(node, folderOid)) { node.Expand(); break; } } } }
private void DisPlayFolder(Guid folderOid) { try { DEFolder2 folder = PLFolder.RemotingAgent.GetFolder(folderOid); string resName = "ICO_FDL_PUBLIC_CLOSE"; string str2 = "ICO_FDL_PUBLIC_OPEN"; if (folder.FolderEffway == RevisionEffectivityWay.PreciseIter) { resName = "ICO_FDL_PRECISEITER_CLOSE"; str2 = "ICO_FDL_PRECISEITER_OPEN"; } else if (folder.FolderEffway == RevisionEffectivityWay.LastReleasedRev) { resName = "ICO_FDL_LASTRELEASEREV_CLOSE"; str2 = "ICO_FDL_LASTRELEASEREV_OPEN"; } TreeNode node = new TreeNode(folder.Name, this.folderImage.GetIconIndex(resName), this.folderImage.GetIconIndex(str2)) { Tag = folder }; if (folder.CanExpand) { node.Nodes.Add(new TreeNode()); } this.dropDownFolderTree.Nodes.Add(node); this.SelectedNode = null; this.SelectedNode = node; node.Expand(); } catch (PLMException exception) { PrintException.Print(exception); } catch (Exception exception2) { PrintException.Print(exception2); } }
public FrmProductTeam(DEFolder2 Folder) { this.Teams = new ArrayList(); this.OldTeams = new ArrayList(); this.InitializeComponent(); this.folder = Folder; if (this.folder != null) { this.ctluser = new UCUsers(); this.ctluser.showSysAdmin = false; this.ctluser.Dock = DockStyle.Fill; this.ctluser.PrinSelected += new SelectPrinHandler(this.ctluser_PrinSelected); this.ctluser.lvwUser.MultiSelect = true; this.splitContainer.Panel1.Controls.Add(this.ctluser); foreach (DEUser user in (PLProductFolder.RemotingAgent as IProductFolder).GetProductTeamMembers(this.folder.Oid)) { ListViewItem item = this.lvwTeam.Items.Add(user.LogId, ClientData.MyImageList.GetIconIndex("ICO_RSP_USER")); item.SubItems.Add(user.Name); item.Tag = user.Oid; this.Teams.Add(user.Oid); this.OldTeams.Add(user.Oid); } } }
private void btnOk_Click(object sender, EventArgs e) { Hashtable deletedRolesMembers = new Hashtable(); Hashtable addedRolesMembers = new Hashtable(); foreach (Guid guid in this.hsTable.Keys) { if (!this.hsOldTable.Contains(guid)) { this.hsOldTable.Add(guid, null); } foreach (Guid guid2 in this.hsOldTable.Keys) { if (guid == guid2) { ArrayList list = this.hsTable[guid] as ArrayList; ArrayList list2 = this.hsOldTable[guid] as ArrayList; if ((list == null) && (list2 != null)) { deletedRolesMembers.Add(guid, list2); } else if ((list != null) && (list2 == null)) { addedRolesMembers.Add(guid, list); } else if ((list != null) && (list2 != null)) { foreach (Guid guid3 in list) { if (!list2.Contains(guid3)) { if (addedRolesMembers.ContainsKey(guid)) { (addedRolesMembers[guid] as ArrayList).Add(guid3); } else { ArrayList list3 = new ArrayList { guid3 }; addedRolesMembers.Add(guid, list3); } } } foreach (Guid guid4 in list2) { if (!list.Contains(guid4)) { if (deletedRolesMembers.ContainsKey(guid)) { (deletedRolesMembers[guid] as ArrayList).Add(guid4); } else { ArrayList list4 = new ArrayList { guid4 }; deletedRolesMembers.Add(guid, list4); } } } } break; } } } (PLProductFolder.RemotingAgent as IProductFolder).SaveProudctRoleMembers(this.folder.Oid, deletedRolesMembers, addedRolesMembers, ClientData.LogonUser.Name); if (addedRolesMembers.Count > 0) { DEFolder2 folderParent = this.GetFolderParent(this.folder); ArrayList productTeamMembers = (PLProductFolder.RemotingAgent as IProductFolder).GetProductTeamMembers(folderParent.Oid); List <Guid> list6 = new List <Guid>(); foreach (DEUser user in productTeamMembers) { list6.Add(user.Oid); } ArrayList addedUserOids = new ArrayList(); ArrayList deleteUserOids = new ArrayList(); foreach (Guid guid5 in addedRolesMembers.Keys) { ArrayList list9 = addedRolesMembers[guid5] as ArrayList; if (list9 != null) { foreach (Guid guid6 in list9) { if (!list6.Contains(guid6)) { addedUserOids.Add(guid6); } } } } if (addedUserOids.Count > 0) { (PLProductFolder.RemotingAgent as IProductFolder).SaveProductTeamMembers(folderParent.Oid, deleteUserOids, addedUserOids); } } base.DialogResult = DialogResult.OK; }
private void tvwFolder_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { if (e.Node.Tag is string) { e.CancelEdit = true; this.tvwFolder.LabelEdit = false; return; } if (this.tvwFolder.SelectedNode == null) { return; } string label = e.Label; if ((e.Node.Tag == null) && (label == null)) { label = e.Node.Text.Trim(); } else { if (label == null) { return; } label = label.Trim(); if (!this.isNewFolder && label.Equals(e.Node.Text.Trim())) { e.CancelEdit = true; e.Node.Text = label; return; } } if (label == "") { MessageBox.Show("文件夹的名称不允许为空!", "文件夹", MessageBoxButtons.OK, MessageBoxIcon.Hand); e.CancelEdit = true; if (this.tvwFolder.SelectedNode.Tag == null) { this.tvwFolder.SelectedNode = e.Node.Parent; e.Node.Remove(); } return; } if (label == this.tvwFolder.Nodes[0].Text) { MessageBox.Show("文件夹的名称不允许和根文件夹相同!", "文件夹", MessageBoxButtons.OK, MessageBoxIcon.Hand); e.CancelEdit = true; if (this.tvwFolder.SelectedNode.Tag == null) { this.tvwFolder.SelectedNode = e.Node.Parent; e.Node.Remove(); } return; } if (label.Length > 0x40) { MessageBox.Show("文件夹名字的长度不能超过64!", "文件夹", MessageBoxButtons.OK, MessageBoxIcon.Hand); e.CancelEdit = true; if (this.tvwFolder.SelectedNode.Tag == null) { this.tvwFolder.SelectedNode = e.Node.Parent; e.Node.Remove(); } return; } Cursor.Current = Cursors.WaitCursor; if (e.Node.Tag == null) { DEFolder2 folder = new DEFolder2 { Name = label, Creator = ClientData.LogonUser.LogId }; if (this.tvwFolder.SelectedNode.Parent.Tag is string) { folder.Parent = Guid.Empty; folder.FolderType = 'C'; } else { folder.Parent = ((DEFolder2)this.tvwFolder.SelectedNode.Parent.Tag).Oid; folder.FolderType = 'A'; } folder.Owner = Guid.Empty; try { folder = PLFolder.CreateFolder(folder, ClientData.LogonUser.Oid); e.CancelEdit = true; e.Node.Text = folder.Name; e.Node.Tag = folder; goto Label_0382; } catch (ResponsibilityException exception) { MessageBox.Show(exception.Message, "文件夹", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.tvwFolder.SelectedNode = e.Node.Parent; e.Node.Remove(); return; } catch (Exception exception2) { MessageBox.Show(exception2.Message, "文件夹", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.tvwFolder.SelectedNode = e.Node.Parent; e.Node.Remove(); return; } } this.tvwFolder.SelectedNode.EndEdit(false); DEFolder2 tag = (DEFolder2)e.Node.Tag; tag.Name = label; try { PLFolder.RemotingAgent.RenameFolder(ClientData.LogonUser.Oid, tag.Oid, tag.Name); e.CancelEdit = false; } catch (Exception exception3) { PrintException.Print(exception3); e.CancelEdit = true; this.tvwFolder.LabelEdit = false; return; } Label_0382: this.tvwFolder.LabelEdit = false; Cursor.Current = Cursors.Default; }