Ejemplo n.º 1
0
        /// <summary>
        /// Gets Worker projects
        /// </summary>
        /// <param name="id">workerId</param>
        /// <returns>List<ProjectWorker>- worker projects</returns>
        public static List <ProjectWorker> GetProjectsUser(int id)
        {
            string query = $"SELECT *,(select sum(sumHours) from presentday pd where pd.id=pw.id and pd.projectId=p.projectId group by id) as sumHoursDone FROM managertasks.projectworker pw join project p on  pw.projectId = p.projectId where pw.id = {id} and p.isFinish=false ";
            Func <MySqlDataReader, List <ProjectWorker> > func = (reader) =>
            {
                List <ProjectWorker> projectsList = new List <ProjectWorker>();
                while (reader.Read())
                {
                    projectsList.Add(ConvertProjectWorker.convertDBtoProjectWorkersWithProject(reader));
                }
                return(projectsList);
            };

            return(DBAccess.RunReader(query, func));
        }
Ejemplo n.º 2
0
        public static List <ProjectWorker> GetProjectsUser(int id)
        {
            string query = $"SELECT* FROM managertasks.projectworker pw join project p on  pw.projectId = p.projectId where pw.id ={id } ";

            Func <MySqlDataReader, List <ProjectWorker> > func = (reader) =>
            {
                List <ProjectWorker> projectsList = new List <ProjectWorker>();
                while (reader.Read())
                {
                    projectsList.Add(ConvertProjectWorker.convertDBtoProjectWorkersWithProject(reader));
                }
                return(projectsList);
            };

            return(DBAccess.RunReader(query, func));
        }