From 297b89304e8115637d8f0e84e74c5d89a34574d9 Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 21 Nov 2013 21:17:02 +0000 Subject: [PATCH] Modified Manage Security dialog box based on internal testing by Jessica --- .../dlgManageSecurity.Designer.cs | 85 ++++++++++++------- .../dlgManageSecurity.cs | 37 ++++++-- .../dlgManageSecurity.resx | 3 - 3 files changed, 88 insertions(+), 37 deletions(-) diff --git a/PROMS/VEPROMS User Interface/dlgManageSecurity.Designer.cs b/PROMS/VEPROMS User Interface/dlgManageSecurity.Designer.cs index 62dd9f2e..b53241e8 100644 --- a/PROMS/VEPROMS User Interface/dlgManageSecurity.Designer.cs +++ b/PROMS/VEPROMS User Interface/dlgManageSecurity.Designer.cs @@ -57,8 +57,10 @@ namespace VEPROMS this.label8 = new System.Windows.Forms.Label(); this.pnlGroups = new System.Windows.Forms.Panel(); this.cmGroups = new System.Windows.Forms.ContextMenuStrip(this.components); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.deleteGroupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pnlCGU = new System.Windows.Forms.Panel(); + this.pnlCUG = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); this.tcSecurity.SuspendLayout(); this.tpGroupUsers.SuspendLayout(); this.cmGroupMembers.SuspendLayout(); @@ -66,6 +68,9 @@ namespace VEPROMS this.cmUsers.SuspendLayout(); this.tpDefault.SuspendLayout(); this.cmGroups.SuspendLayout(); + this.pnlCGU.SuspendLayout(); + this.pnlCUG.SuspendLayout(); + this.panel2.SuspendLayout(); this.SuspendLayout(); // // tcSecurity @@ -82,14 +87,11 @@ namespace VEPROMS // tpGroupUsers // this.tpGroupUsers.BackColor = System.Drawing.SystemColors.ButtonFace; - this.tpGroupUsers.Controls.Add(this.lstUserGroups); - this.tpGroupUsers.Controls.Add(this.label7); + this.tpGroupUsers.Controls.Add(this.panel2); this.tpGroupUsers.Controls.Add(this.label6); this.tpGroupUsers.Controls.Add(this.tvFolders); this.tpGroupUsers.Controls.Add(this.lstUsers); this.tpGroupUsers.Controls.Add(this.label5); - this.tpGroupUsers.Controls.Add(this.lstGroupUsers); - this.tpGroupUsers.Controls.Add(this.label4); this.tpGroupUsers.Controls.Add(this.label3); this.tpGroupUsers.Controls.Add(this.lstGroups); this.tpGroupUsers.Location = new System.Drawing.Point(4, 22); @@ -101,14 +103,13 @@ namespace VEPROMS // // lstUserGroups // - this.lstUserGroups.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); this.lstUserGroups.ContextMenuStrip = this.cmGroupMembers; + this.lstUserGroups.Dock = System.Windows.Forms.DockStyle.Fill; this.lstUserGroups.FormattingEnabled = true; - this.lstUserGroups.Location = new System.Drawing.Point(530, 318); + this.lstUserGroups.Location = new System.Drawing.Point(0, 19); this.lstUserGroups.Name = "lstUserGroups"; this.lstUserGroups.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; - this.lstUserGroups.Size = new System.Drawing.Size(238, 212); + this.lstUserGroups.Size = new System.Drawing.Size(386, 212); this.lstUserGroups.TabIndex = 9; // // cmGroupMembers @@ -135,10 +136,10 @@ namespace VEPROMS // // label7 // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(527, 302); + this.label7.Dock = System.Windows.Forms.DockStyle.Top; + this.label7.Location = new System.Drawing.Point(0, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(103, 13); + this.label7.Size = new System.Drawing.Size(386, 19); this.label7.TabIndex = 8; this.label7.Text = "Current User Groups"; // @@ -253,22 +254,21 @@ namespace VEPROMS // // lstGroupUsers // - this.lstGroupUsers.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); this.lstGroupUsers.ContextMenuStrip = this.cmGroupMembers; + this.lstGroupUsers.Dock = System.Windows.Forms.DockStyle.Fill; this.lstGroupUsers.FormattingEnabled = true; - this.lstGroupUsers.Location = new System.Drawing.Point(384, 318); + this.lstGroupUsers.Location = new System.Drawing.Point(0, 19); this.lstGroupUsers.Name = "lstGroupUsers"; this.lstGroupUsers.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; - this.lstGroupUsers.Size = new System.Drawing.Size(140, 212); + this.lstGroupUsers.Size = new System.Drawing.Size(386, 212); this.lstGroupUsers.TabIndex = 3; // // label4 // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(384, 302); + this.label4.Dock = System.Windows.Forms.DockStyle.Top; + this.label4.Location = new System.Drawing.Point(0, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(103, 13); + this.label4.Size = new System.Drawing.Size(386, 19); this.label4.TabIndex = 2; this.label4.Text = "Current Group Users"; // @@ -308,9 +308,9 @@ namespace VEPROMS // // label8 // - this.label8.Location = new System.Drawing.Point(234, 6); + this.label8.Location = new System.Drawing.Point(308, 6); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(534, 172); + this.label8.Size = new System.Drawing.Size(460, 172); this.label8.TabIndex = 5; this.label8.Text = "label8"; // @@ -319,7 +319,7 @@ namespace VEPROMS this.pnlGroups.AutoScroll = true; this.pnlGroups.Location = new System.Drawing.Point(3, 6); this.pnlGroups.Name = "pnlGroups"; - this.pnlGroups.Size = new System.Drawing.Size(227, 526); + this.pnlGroups.Size = new System.Drawing.Size(299, 526); this.pnlGroups.TabIndex = 4; // // cmGroups @@ -329,18 +329,40 @@ namespace VEPROMS this.cmGroups.Name = "cmGroups"; this.cmGroups.Size = new System.Drawing.Size(144, 26); // - // contextMenuStrip1 - // - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); - // // deleteGroupToolStripMenuItem // this.deleteGroupToolStripMenuItem.Name = "deleteGroupToolStripMenuItem"; - this.deleteGroupToolStripMenuItem.Size = new System.Drawing.Size(191, 22); + this.deleteGroupToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.deleteGroupToolStripMenuItem.Text = "Delete Group"; this.deleteGroupToolStripMenuItem.Click += new System.EventHandler(this.deleteGroupToolStripMenuItem_Click); // + // pnlCGU + // + this.pnlCGU.Controls.Add(this.lstGroupUsers); + this.pnlCGU.Controls.Add(this.label4); + this.pnlCGU.Location = new System.Drawing.Point(0, 0); + this.pnlCGU.Name = "pnlCGU"; + this.pnlCGU.Size = new System.Drawing.Size(386, 232); + this.pnlCGU.TabIndex = 10; + // + // pnlCUG + // + this.pnlCUG.Controls.Add(this.lstUserGroups); + this.pnlCUG.Controls.Add(this.label7); + this.pnlCUG.Location = new System.Drawing.Point(0, 0); + this.pnlCUG.Name = "pnlCUG"; + this.pnlCUG.Size = new System.Drawing.Size(386, 232); + this.pnlCUG.TabIndex = 11; + // + // panel2 + // + this.panel2.Controls.Add(this.pnlCUG); + this.panel2.Controls.Add(this.pnlCGU); + this.panel2.Location = new System.Drawing.Point(384, 304); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(386, 232); + this.panel2.TabIndex = 12; + // // dlgManageSecurity // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -361,6 +383,9 @@ namespace VEPROMS this.cmUsers.ResumeLayout(false); this.tpDefault.ResumeLayout(false); this.cmGroups.ResumeLayout(false); + this.pnlCGU.ResumeLayout(false); + this.pnlCUG.ResumeLayout(false); + this.panel2.ResumeLayout(false); this.ResumeLayout(false); } @@ -396,6 +421,8 @@ namespace VEPROMS private System.Windows.Forms.Panel pnlGroups; private System.Windows.Forms.Label label8; private System.Windows.Forms.ToolStripMenuItem deleteGroupToolStripMenuItem; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.Panel pnlCGU; + private System.Windows.Forms.Panel pnlCUG; + private System.Windows.Forms.Panel panel2; } } \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/dlgManageSecurity.cs b/PROMS/VEPROMS User Interface/dlgManageSecurity.cs index fb19c163..5a924764 100644 --- a/PROMS/VEPROMS User Interface/dlgManageSecurity.cs +++ b/PROMS/VEPROMS User Interface/dlgManageSecurity.cs @@ -135,6 +135,7 @@ namespace VEPROMS private void lstGroups_SelectedIndexChanged(object sender, EventArgs e) { + pnlCGU.BringToFront(); myMembershipInfoList = new List(); lstGroupUsers.Items.Clear(); if (lstGroups.SelectedIndex > -1) @@ -287,17 +288,20 @@ namespace VEPROMS SessionInfoList sil = SessionInfoList.Get(); foreach (SessionInfo si in sil) { - if (si.UserID == ui.UserID) + if (si.UserID == ui.UserID && (si.DTSEnd == null)) { MessageBox.Show("The user selected has an active session. You may not delete the user at this time.", "User Active Session", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } int k = 0; - foreach (MembershipInfo mi in ui.UserMemberships) + if (ui.UserMembershipCount > 0) { - if (mi.EndDate == null || mi.EndDate == string.Empty) - k++; + foreach (MembershipInfo mi in ui.UserMemberships) + { + if (mi.EndDate == null || mi.EndDate == string.Empty) + k++; + } } if (k > 0) { @@ -376,6 +380,7 @@ namespace VEPROMS } } */ + pnlCUG.BringToFront(); lstUserGroups.Items.Clear(); if(lstUsers.SelectedIndex > -1){ UserInfo ui = myUserInfoList[lstUsers.SelectedIndex]; @@ -399,7 +404,29 @@ namespace VEPROMS private void deleteGroupToolStripMenuItem_Click(object sender, EventArgs e) { - MessageBox.Show("here"); + GroupInfo gi = myGroupInfoList[lstGroups.SelectedIndex]; + bool deleteOK = true; + if(gi.GroupMembershipCount > 0) + { + foreach (MembershipInfo mi in gi.GroupMemberships) + { + if (mi.EndDate == null || mi.EndDate == string.Empty) + { + deleteOK = false; + break; + } + } + } + if (!deleteOK) + { + MessageBox.Show("There are still users who are members of this group. You need to delete all members in order to delete this group.", "Group Has Members", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + if (MessageBox.Show("Are you sure you want to delete this group?", "Confirm Deleting Group", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) + { + Group.Delete(gi.GID); + SetupSecurity(); + } } } } \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/dlgManageSecurity.resx b/PROMS/VEPROMS User Interface/dlgManageSecurity.resx index 1ea0bb69..3035c385 100644 --- a/PROMS/VEPROMS User Interface/dlgManageSecurity.resx +++ b/PROMS/VEPROMS User Interface/dlgManageSecurity.resx @@ -129,7 +129,4 @@ 17, 17 - - 483, 17 - \ No newline at end of file