Ejemplo n.º 1
0
            public int Compare(object x, object y)
            {
                ITUser first  = (ITUser)x;
                ITUser second = (ITUser)y;

                return(first.RoleName.CompareTo(second.RoleName));
            }
Ejemplo n.º 2
0
        //*********************************************************************
        //
        // 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);
        }
Ejemplo n.º 3
0
        //*********************************************************************
        //
        // 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);
        }
Ejemplo n.º 4
0
 public void Insert(int index, ITUser value)
 {
     List.Insert(index, value);
 }
Ejemplo n.º 5
0
 public int IndexOf(ITUser value)
 {
     return(List.IndexOf(value));
 }
Ejemplo n.º 6
0
 public int Add(ITUser value)
 {
     return(List.Add(value));
 }
Ejemplo n.º 7
0
 public bool Contains(ITUser value)
 {
     // If value is not of type ITUser, this will return false.
     return(List.Contains(value));
 }
Ejemplo n.º 8
0
 public void Remove(ITUser value)
 {
     List.Remove(value);
 }