public static void LogEvent(Project project, User user, int actionConst, Bug bug) { var action = new BugActionRepository().GetAll().Where(p => p.Id == actionConst).SingleOrDefault(); var proj = new ProjectRepository().GetAll().Where(p => p.Id == project.Id).SingleOrDefault(); new BugActionLogRepository().Create(new BugActionLog { Project = proj, Action = action, BugName = bug.Name, UserName = user.FirstName.Substring(0, 1) + "." + user.Surname }); }
public Project Update(Project project) { using (var ctx = new WcfEntityContext()) { ctx.AttachModify("Projects", project); ctx.SaveChanges(); return project; } }
public Project Create(Project project) { using (var ctx = new WcfEntityContext()) { ctx.Projects.AddObject(project); ctx.SaveChanges(); return project; } }
public void Delete(Project project) { using (var ctx = new WcfEntityContext()) { var proj = Context.Projects.Where(p => p.Id == project.Id).SingleOrDefault(); ctx.AttachTo("Projects", proj); ctx.Projects.DeleteObject(proj); ctx.SaveChanges(); } }
public void AcceptUserOnProject(User user, Project project, String rolename) { UserProjectSignupRepository signUpRepo = new UserProjectSignupRepository(); Role acceptedRole = new RoleRepository().GetAll().Where(p => p.RoleName == rolename).SingleOrDefault(); UserProjectSignup request = signUpRepo.GetAll() .Where(p => p.UserId == user.Id && p.ProjectId == project.Id).SingleOrDefault(); new ProjectRoleRepository().Create (new ProjectRole { UserId = request.UserId, ProjectId = request.ProjectId, RoleId = acceptedRole.Id }); signUpRepo.Delete(request); }
public Project AddProject(Project project) { ProjectRepository projRepo = new ProjectRepository(); ProjectRoleRepository projRoleRepo = new ProjectRoleRepository(); RoleRepository roleRepo = new RoleRepository(); Project addedProj = projRepo.Create(project); int ManagerId = roleRepo.GetAll().Where(x => x.RoleName == "Project Manager").Select(c => c.Id).SingleOrDefault(); int CurrentUserId = GetMyUser().Id; // Make the user who added the project, a project manager projRoleRepo.Create(new ProjectRole { ProjectId = addedProj.Id, RoleId = ManagerId, UserId = CurrentUserId }); return addedProj; }
public int CountBugsInProject(Project project) { return new BugRepository().GetAll().Where(p => p.Project.Id == project.Id).Count(); }
public IList<Bug> SearchAllProjectBugsAttributes(Project project, string searchText) { searchText = searchText.Trim(); // if (searchText == null || searchText == "") // return GetBugsByProject(project); IList<int> associatedUserIds = new UserRepository().GetAll().FullTextSearch(searchText, true).Select(p => p.Id).ToList(); IList<int> fullTextSearch = new BugRepository() .GetAll().FullTextSearch(searchText, true).Select(p => p.Id).ToList(); if (associatedUserIds.Count == 0 && fullTextSearch.Count == 0) return new List<Bug>(); int id = 0; DateTime date = DateTime.MinValue; try { id = Int32.Parse(searchText); } catch (Exception e) { Console.WriteLine(e.Message); } try { date = DateTime.Parse(searchText); } catch (Exception e) { Console.WriteLine(e.Message); } return new BugRepository().GetAll() .Where(p => associatedUserIds.Contains(p.AssignedUser.Id) || associatedUserIds.Contains(p.CreatedBy.Id) || p.Id == id || (p.DateFound.Year == date.Year && p.DateFound.Month == date.Month && p.DateFound.Day == date.Day) || (p.LastModified.Year == date.Year && p.LastModified.Month == date.Month && p.LastModified.Day == date.Day) || fullTextSearch.Contains(p.Id)).Where(p => p.Project.Id == project.Id).ToList(); }
public void RejectUserFromProject(User user, Project project) { UserProjectSignupRepository signUpRepo = new UserProjectSignupRepository(); UserProjectSignup request = signUpRepo.GetAll() .Where(p => p.UserId == user.Id && p.ProjectId == project.Id).SingleOrDefault(); signUpRepo.Delete(request); }
public Project SaveProject(Project project) { ProjectRepository projRepo = new ProjectRepository(); return projRepo.Update(project); }
public List<Bug> GetBugsByProject(Project project) { BugRepository bugRepo = new BugRepository(); List<Bug> bugList = bugRepo.GetAll().Where(x => x.Project.Id == project.Id).ToList(); return bugList; }
public bool ProjectCodeExistsExcludingProject(Project proj) { return (new ProjectRepository().GetAll().Where(p => p.Id != proj.Id && p.Code == proj.Code).SingleOrDefault() != null); }
public IList<User> GetUsersPendingProjectJoin(Project project) { return new UserProjectSignupRepository().GetAll() .Where(p => p.ProjectId == project.Id).Select(p => p.User).Distinct().ToList(); }
public string GetUsersRequestedRoleForProject(User user, Project project) { return new UserProjectSignupRepository().GetAll() .Where(p => p.ProjectId == project.Id && user.Id == p.UserId).Select(p => p.Role.RoleName).SingleOrDefault(); }
public List<User> GetUsersByProject(Project proj) { ProjectRoleRepository projRoleRepo = new ProjectRoleRepository(); List<User> userList = new List<User>(); List<ProjectRole> projRoleList = projRoleRepo.GetAll().Where(p => p.Project.Id == proj.Id).ToList(); foreach (ProjectRole projRole in projRoleList) { if (!userList.Contains(projRole.User)) userList.Add(projRole.User); } return userList; }
public IList<User> GetAssignedUsersByProject(Project proj) { ProjectRoleRepository projRoleRepo = new ProjectRoleRepository(); RoleRepository roleRepo = new RoleRepository(); Role projMgr = roleRepo.GetAll().Where(p => p.RoleName == "Project Manager").SingleOrDefault(); return projRoleRepo.GetAll().Where(p => p.Project.Id == proj.Id && p.Role.Id != projMgr.Id) .Select(p => p.User).Distinct().ToList(); }
public IList<Bug> GetOpenBugsInProject(Project project) { return new BugRepository().GetAll().Where(p => p.Project.Id == project.Id && p.Status == "Open").ToList(); }
public int GetNumberOfBugsAssignedToUserInProject(Project project, User user) { return new BugRepository().GetAll().Where(p => p.Project.Id == project.Id && p.AssignedUser.Id == user.Id).Count(); }
public IList<User> GetManagerUsersByProject(Project proj) { Role projMgr = new RoleRepository().GetAll().Where(p => p.RoleName == "Project Manager").SingleOrDefault(); return new ProjectRoleRepository().GetAll() .Where(p => p.ProjectId == proj.Id && p.RoleId == projMgr.Id).Select(p => p.User).Distinct().ToList(); }
public void DeleteProject(Project project) { ProjectRepository projRepo = new ProjectRepository(); projRepo.Delete(project); }
public void LeaveProject(Project project, User user) { ProjectRoleRepository projRoleRepo = new ProjectRoleRepository(); var associations = projRoleRepo.GetAll().Where(p => p.User.Id == user.Id && p.Project.Id == project.Id); foreach (var ass in associations) { projRoleRepo.Delete(ass); } }
public IList<BugActionLog> GetAllBugActionLogsInProject(Project project) { return new BugActionLogRepository().GetAll().Where(p => p.Project.Id == project.Id).OrderByDescending(p => p.Date).ToList(); }
public IList<Bug> GetBugsAssignedToProjectAndUser(Project project, User user) { return new BugRepository().GetAll().Where(p => p.Project.Id == project.Id && p.AssignedUser.Id == user.Id).ToList(); }