Modified Manage Security dialog box based on internal testing by Jessica

This commit is contained in:
Rich
2013-11-21 21:17:02 +00:00
parent de656340f6
commit 297b89304e
3 changed files with 88 additions and 37 deletions

View File

@@ -135,6 +135,7 @@ namespace VEPROMS
private void lstGroups_SelectedIndexChanged(object sender, EventArgs e)
{
pnlCGU.BringToFront();
myMembershipInfoList = new List<MembershipInfo>();
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();
}
}
}
}