public static void CheckDeadLine() { List <Project> deadProjects = new List <Project>(); deadProjects = GetAllProjectsByDeadLine(); foreach (Project proj in deadProjects) { User teamHead = new User(); teamHead = LogicManager.GetUserDetails(proj.IdManager); List <User> workers = new List <User>(); workers = LogicManager.GetAllWorkersByTeamId(proj.IdManager); LogicManager.sendMessage(teamHead, $"Hi {teamHead.UserName}, <br/>Project: {proj.ProjectName} is about to reach the deadline tomorrow. This project is under your responsibility, please hurry up!!!", "ATTENTION"); foreach (User worker in workers) { LogicManager.sendMessage(worker, $"Hi {worker.UserName}, <br/>Project: {proj.ProjectName} is about to reach the deadline tomorrow. you are subscribed to this project, please hurry up!!!", "ATTENTION"); } } }
public static bool AddProject(Project project) { //TODO:איזה דפרטמנט string dateBegin = project.DateBegin.ToString("yyy-MM-dd"); string dateEnd = project.DateEnd.ToString("yyy-MM-dd"); string query = $"INSERT INTO `task`.`project`(`name`,`startdate`,`Enddate`,`isFinished`,`customerName`,`DevHours`,`QAHours`,`UIUXHours`,`teamheadId`) VALUES('{project.ProjectName}','{dateBegin}','{dateEnd}',{project.IsFinish},'{project.CustomerName}',{project.DevHours},{project.QAHours},{project.UIUXHours},{project.IdManager}); "; if (DBAccess.RunNonQuery(query) == 1) { Project currentProject = GetProjectDetails(project.ProjectName); List <User> workers = new List <User>(); workers = LogicManager.GetAllWorkersByTeamId(project.IdManager); workers.AddRange(project.workers); foreach (var item in workers) { query = $"INSERT INTO `task`.`task`(`reservingHours`,`givenHours`,`idProject`,`idUser`)VALUES(0,0,{currentProject.ProjectId},{item.UserId });"; DBAccess.RunNonQuery(query); } return(true); } return(false); }