예제 #1
0
        private static void OnTimedEvent(Object source, ElapsedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("ll");

            if (DateTime.Now.ToShortTimeString() == "14:25")
            {
                LogicProjects.CheckDeadLine();
            }
        }
        /// <summary>
        /// Gets projects of teamLeader
        /// </summary>
        /// <param name="id">teamLeaderId</param>
        /// <returns></returns>
        public static List <Project> GetProjectsManager(int tamLeaderId)
        {
            string query = $"SELECT * FROM managertasks.project  WHERE managerId ={tamLeaderId}";

            Func <MySqlDataReader, List <Project> > func = (reader) =>
            {
                List <Project> projectsList = new List <Project>();
                while (reader.Read())
                {
                    projectsList.Add(ConvertProject.convertDBtoProjects(reader));
                }
                return(projectsList);
            };

            List <Project> managerProjects = DBAccess.RunReader(query, func);

            managerProjects.ForEach(p =>
            {
                p.HoursForDepartment = LogicProjects.GetHoursDepartmentsProject(p.ProjectId);
            });
            return(managerProjects);
        }
예제 #3
0
        public static List <Project> GetProjectsUser(int id)
        {
            string         query    = $"SELECT * FROM task.projectworker WHERE workerId={id} ;";
            List <Project> projects = new List <Project>();
            Func <MySqlDataReader, List <PresentDay> > func = (reader) =>
            {
                List <PresentDay> projectsWorker = new List <PresentDay>();
                while (reader.Read())
                {
                    projectsWorker.Add(ConvertorPresentDay.convertDBtoProjectWorker(reader));
                }
                return(projectsWorker);
            };

            List <PresentDay> ProjectWorker = DBAccess.RunReader(query, func);

            foreach (var item in ProjectWorker)
            {
                projects.Add(LogicProjects.GetProjectDetails(item.ProjectId));
            }

            return(projects);
        }