public static List <UserWithoutPassword> GetWorkerNotInProject(int projectId)
        {
            string query = $"SELECT * FROM managertasks.user WHERE id not in(SELECT id FROM projectworker WHERE projectId={projectId} GROUP BY id)";
            Func <MySqlDataReader, List <UserWithoutPassword> > func = (reader) =>
            {
                List <UserWithoutPassword> userNotInProject = new List <UserWithoutPassword>();
                while (reader.Read())
                {
                    userNotInProject.Add(ConvertorUser.convertDBtoUser1(reader));
                }
                return(userNotInProject);
            };

            return(DBAccess.RunReader(query, func));
        }
Esempio n. 2
0
        public static List <UserWithoutPassword> getUsersOfTeamLeader(int teamleaderId)
        {
            string query = $"SELECT * FROM managertasks.user WHERE managerId={teamleaderId}";

            Func <MySqlDataReader, List <UserWithoutPassword> > func = (reader) =>
            {
                List <UserWithoutPassword> users = new List <UserWithoutPassword>();
                while (reader.Read())
                {
                    users.Add(ConvertorUser.convertDBtoUser1(reader));
                }
                return(users);
            };

            return(DBAccess.RunReader(query, func));
        }
Esempio n. 3
0
        public static UserWithoutPassword GetUserManager(int idUser)
        {
            string query = $" select uu.* from user u join user uu on u.managerId=uu.id where u.id={idUser}";

            Func <MySqlDataReader, List <UserWithoutPassword> > func = (reader) =>
            {
                List <UserWithoutPassword> users = new List <UserWithoutPassword>();
                while (reader.Read())
                {
                    users.Add(ConvertorUser.convertDBtoUser1(reader));
                }
                return(users);
            };

            List <UserWithoutPassword> manager = DBAccess.RunReader(query, func);

            if (manager != null && manager.Count > 0)
            {
                return(manager[0]);
            }
            return(null);
        }