public int Compare(object x, object y) { ITUser first = (ITUser)x; ITUser second = (ITUser)y; return(first.RoleName.CompareTo(second.RoleName)); }
//********************************************************************* // // Retrieves a list of projects based on the user's role // //********************************************************************* public static ProjectsCollection GetProjects(int userID, string role) { string firstName = string.Empty; string lastName = string.Empty; DataSet ds = SqlHelper.ExecuteDataset( ConfigurationSettings.AppSettings[Web.Global.CfgKeyConnString], "TT_ListProjects", userID, Convert.ToInt32(role)); ProjectsCollection projects = new ProjectsCollection(); foreach (DataRow r in ds.Tables[0].Rows) { Project prj = new Project(); prj.ProjectID = Convert.ToInt32(r["ProjectID"]); prj.Name = r["ProjectName"].ToString(); prj.Description = r["Description"].ToString(); prj.ManagerUserID = Convert.ToInt32(r["ManagerUserID"]); prj.ManagerUserName = ITUser.GetDisplayName(Convert.ToString(r["UserName"]), ref firstName, ref lastName); prj.EstCompletionDate = Convert.ToDateTime(r["EstCompletionDate"]); prj.EstDuration = Convert.ToDecimal(r["EstDuration"]); projects.Add(prj); } return(projects); }
//********************************************************************* // // GetUsers Static Method // Retrieves a list of users based on the specified userID and role. // The list returned is restricted by role. For instance, users with // the role of Administrator can see all users, while users with the // role of Consultant can only see themselves. // //********************************************************************* public static UsersCollection GetUsers(int userID, string role) { string firstName = string.Empty; string lastName = string.Empty; DataSet ds = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings[Web.Global.CfgKeyConnString], "User_GetAllUsers" /*, userID, Convert.ToInt32(role)*/); UsersCollection users = new UsersCollection(); // Separate Data into a collection of Users. foreach (DataRow r in ds.Tables[0].Rows) { ITUser usr = new ITUser(); usr.UserName = r["UserName"].ToString(); usr.Role = r["RoleID"].ToString(); usr.RoleName = r["RoleName"].ToString(); usr.UserID = Convert.ToInt32(r["UserID"]); usr.Name = GetDisplayName(usr.UserName, ref firstName, ref lastName); usr.FirstName = firstName; usr.LastName = lastName; users.Add(usr); } return(users); }
public void Insert(int index, ITUser value) { List.Insert(index, value); }
public int IndexOf(ITUser value) { return(List.IndexOf(value)); }
public int Add(ITUser value) { return(List.Add(value)); }
public bool Contains(ITUser value) { // If value is not of type ITUser, this will return false. return(List.Contains(value)); }
public void Remove(ITUser value) { List.Remove(value); }