//get dictionary of users and hours that worked public static Dictionary <UserProject, double> GetUsersAndHoursThatWorkedOnProject(int idProject) { List <User> UsersOfProject = LogicUsers.GetUsersOfProject(idProject); Dictionary <UserProject, double> UsersAndHoursWorkedOnProject = new Dictionary <UserProject, double>(); foreach (User user in UsersOfProject) { UserProject userProject = LogicUserProject.GetSpesipicUserProject(user.IdUser, idProject); UsersAndHoursWorkedOnProject.Add(userProject, GetDictionaryOfHoursThatUserWorkedOnProjectInPrecent(user.IdUser)[userProject]); } return(UsersAndHoursWorkedOnProject); }
//add project public static bool AddProject(Project project) { bool isWorked = false; string query = $"INSERT INTO truth_time_ct.projects VALUES (0,'{project.ProjectName}','{project.ClientName}',{project.IdTeamLeader},'{project.StartDate}','{project.EndDate}',{project.HoursForDevelopers},{project.HoursForQA},{project.HoursForUI_UX},{project.Active})"; isWorked = DBUse.RunNonQuery(query) == 1; if (isWorked) { int idProject = int.Parse(GetProjectId(project.ProjectName)); LogicUserProject.CreateUsersProjectList(idProject, project.IdTeamLeader); } return(isWorked); }