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"); }
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); } } }
//********************************************************************* // // The BindProjects method retrieves the list of projects the current user // can view based on their role and then databinds them to the ProjectsGrid // //********************************************************************* private void BindUsers() { ITUserCollection userList = ITUser.GetAllUsers(); // Call method to sort the data before databinding SortGridData(userList, SortField, SortAscending); UsersGrid.DataSource = userList; UsersGrid.DataBind(); }
protected CollectionBase GenerateITUserCollectionFromReader(IDataReader returnData) { ITUserCollection userCollection = new ITUserCollection(); while (returnData.Read()) { ITUser newUser = new ITUser((int)returnData["UserId"], (string)returnData["Username"], (string)returnData["RoleName"], (string)returnData["Email"], (string)returnData["DisplayName"], (string)returnData["UserPassword"]); userCollection.Add(newUser); } return(userCollection); }
//******************************************************* // // SortGridData methods sorts the Issues Grid based on which // sort field is being selected. Also does reverse sorting based on the boolean. // //******************************************************* private void SortGridData(ITUserCollection list, string sortField, bool asc) { ITUserCollection.UserFields sortCol = ITUserCollection.UserFields.InitValue; switch (sortField) { case "Username": sortCol = ITUserCollection.UserFields.Username; break; case "DisplayName": sortCol = ITUserCollection.UserFields.DisplayName; break; case "RoleName": sortCol = ITUserCollection.UserFields.RoleName; break; } list.Sort(sortCol, asc); }