public void Initialize() { // Clear existing items lstAllUsers.Items.Clear(); lstSelectedUsers.Items.Clear(); // Get all users for All Users List Box lstAllUsers.DataSource = ITUser.GetAllUsers(); lstAllUsers.DataTextField = "DisplayName"; lstAllUsers.DataValueField = "Id"; lstAllUsers.DataBind(); // Copy selected users into Selected Users List Box ITUserCollection projectUsers = ITUser.GetUsersByProjectId(ProjectId); foreach (ITUser currentUser in projectUsers) { ListItem matchItem = lstAllUsers.Items.FindByValue(currentUser.Id.ToString()); if (matchItem != null) { lstSelectedUsers.Items.Add(matchItem); lstAllUsers.Items.Remove(matchItem); } } }
void BindOptions() { CategoryTree objCats = new CategoryTree(); dropCats.DataSource = objCats.GetCategoryTreeByProjectId(ProjectId); dropCats.DataBind(); ITUserCollection colUsers = ITUser.GetUsersByProjectId(ProjectId); dropAssigned.DataSource = colUsers; dropAssigned.DataBind(); dropOwned.DataSource = colUsers; dropOwned.DataBind(); dropStatus.DataSource = Status.GetStatusByProjectId(ProjectId); dropStatus.DataBind(); dropPriority.DataSource = Priority.GetPrioritiesByProjectId(ProjectId); dropPriority.DataBind(); dropMilestone.DataSource = Milestone.GetMilestoneByProjectId(ProjectId); dropMilestone.DataBind(); lblDateCreated.Text = DateTime.Now.ToString("f"); }
//********************************************************************* // // dropFieldSelectedIndexChanged Method // // When the user changes the selected field type, show the corresponding list // of possible values. // //********************************************************************* protected void dropFieldSelectedIndexChanged(Object s, EventArgs e) { dropValue.Items.Clear(); switch (dropField.SelectedValue) { case "IssuePriorityId": dropValue.Visible = true; txtValue.Visible = false; dropValue.DataSource = Priority.GetPrioritiesByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueMilestoneId": dropValue.Visible = true; txtValue.Visible = false; dropValue.DataSource = Milestone.GetMilestoneByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueCategoryId": dropValue.Visible = true; txtValue.Visible = false; CategoryTree objCats = new CategoryTree(); dropValue.DataSource = objCats.GetCategoryTreeByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueStatusId": dropValue.Visible = true; txtValue.Visible = false; dropValue.DataSource = Status.GetStatusByProjectId(ProjectId); dropValue.DataTextField = "Name"; dropValue.DataValueField = "Id"; break; case "IssueAssignedId": dropValue.Visible = true; txtValue.Visible = false; dropValue.DataSource = ITUser.GetUsersByProjectId(ProjectId); dropValue.DataTextField = "DisplayName"; dropValue.DataValueField = "Id"; break; case "IssueOwnerId": dropValue.Visible = true; txtValue.Visible = false; dropValue.DataSource = ITUser.GetUsersByProjectId(ProjectId); dropValue.DataTextField = "DisplayName"; dropValue.DataValueField = "Id"; break; case "IssueCreatorId": dropValue.Visible = true; txtValue.Visible = false; dropValue.DataSource = ITUser.GetUsersByProjectId(ProjectId); dropValue.DataTextField = "DisplayName"; dropValue.DataValueField = "Id"; break; default: dropValue.Visible = false; txtValue.Visible = true; break; } dropValue.DataBind(); }