protected void UserViewGrid_ManualRebind() { UserViewGrid.DataSource = null; UserViewGrid.Rebind(); return; }
protected void InitializeGetWorkPage() { GetWorkViewSelection.Items.Clear(); UserViewWorkQueueViewSelection.Items.Clear(); GetWorkViewSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem("** System Default", "0")); UserViewWorkQueueViewSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem("** System Default", "0")); foreach (Client.Core.Work.WorkQueueView currentWorkQueueView in MercuryApplication.WorkQueueViewsAvailable(false)) { if (currentWorkQueueView.Enabled) { GetWorkViewSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentWorkQueueView.Name, currentWorkQueueView.Id.ToString())); UserViewWorkQueueViewSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentWorkQueueView.Name, currentWorkQueueView.Id.ToString())); } } GetWorkViewSelection.SelectedValue = workQueue.GetWorkViewId.ToString(); UserViewWorkQueueViewSelection.SelectedValue = "0"; GetWorkUseGrouping.Checked = workQueue.GetWorkUseGrouping; UserViewGrid.DataSource = null; UserViewGrid.Rebind(); Dictionary <String, String> availableUsers = new Dictionary <String, String> (); Dictionary <String, String> deniedUsers = new Dictionary <String, String> (); // FOR EACH TEAM ASSOCIATED WITH THE WORK QUEUE foreach (Mercury.Server.Application.WorkQueueTeam currentWorkQueueTeam in workQueue.WorkTeams) { // GET ACTUAL TEAM OBJECT Client.Core.Work.WorkTeam workTeam = MercuryApplication.WorkTeamGet(currentWorkQueueTeam.WorkTeamId, true); // FOR EACH USER IN THE WORK TEAM foreach (Mercury.Server.Application.WorkTeamMembership currentMembership in workTeam.Membership) { String membershipKey = currentMembership.SecurityAuthorityId + "|" + currentMembership.UserAccountId + "|" + currentMembership.UserAccountName; String membershipName = currentMembership.SecurityAuthorityName + ": " + currentMembership.UserDisplayName; // CHECK THE PERMISSION TO ADD TO THE AVAILABLE OR DENIED switch (currentWorkQueueTeam.Permission) { case Mercury.Server.Application.WorkQueueTeamPermission.Denied: // DENIED USER CANNOT BE ADDED BY ANY TEAM if (!deniedUsers.ContainsKey(membershipKey)) { deniedUsers.Add(membershipKey, membershipName); } break; case Mercury.Server.Application.WorkQueueTeamPermission.View: // DO NOTHING, CANNOT ADD VIEW ONLY TO USER VIEWS (BUT THIS DOES NOT DENY THE USER FROM OTHER TEAMS) break; default: if (!availableUsers.ContainsKey(membershipKey)) { availableUsers.Add(membershipKey, membershipName); } break; } } } // REMOVE ALL DENIED USERS FROM THE AVAILABLE USERS LIST foreach (String currentDeniedUserKey in deniedUsers.Keys) { if (availableUsers.ContainsKey(currentDeniedUserKey)) { availableUsers.Remove(currentDeniedUserKey); } } // REMOVE EXISTING USERS VIEWS FROM AVAILABLE foreach (Mercury.Server.Application.WorkQueueGetWorkUserView currentUserView in workQueue.GetWorkUserViews) { String currentUserViewKey = currentUserView.SecurityAuthorityId + "|" + currentUserView.UserAccountId + "|" + currentUserView.UserAccountName; if (availableUsers.ContainsKey(currentUserViewKey)) { availableUsers.Remove(currentUserViewKey); } } UserViewAccountSelection.DataSource = availableUsers; UserViewAccountSelection.DataTextField = "Value"; UserViewAccountSelection.DataValueField = "Key"; UserViewAccountSelection.Sort = Telerik.Web.UI.RadComboBoxSort.Ascending; UserViewAccountSelection.DataBind(); return; }