public BugListViewModel FromBug(Bug bug) { var context = new ProjectManagementService(); var isAssigned = false; var user = context.GetProjectsOfUser(WebSecurity.CurrentUserId).Count(e => e.ProjectId == bug.ProjectId && e.UserId == WebSecurity.CurrentUserId); if (user != 0) { isAssigned = true; } return(new BugListViewModel { Id = bug.Id, Steps = bug.Steps, Symptom = GetSymptomName(bug.SymptomId), ProjectId = bug.ProjectId, ReporterName = context.GetCreatorName(bug.ReporterId), ReportingDate = bug.ReportingDate.ToShortDateString(), Summary = string.Format("<a href=\"{0}\">{1}</a>", Url.Action("BugDetails", "BTS", new { id = bug.Id }), bug.Summary), Severity = GetSeverityName(bug.SeverityId), Status = GetStatusName(bug.StatusId), StatusId = bug.StatusId, Project = GetProjectTitle(bug.ProjectId), ModifyingDate = bug.ModifyingDate.ToShortDateString(), AssignedDeveloperName = (bug.AssignedDeveloperId == 0) ? "отсутствует" : context.GetCreatorName(bug.AssignedDeveloperId), IsAssigned = isAssigned }); }
public IList <SelectListItem> GetDeveloperNames() { var _context = new UsersManagementService(); var context = new ProjectManagementService(); var projectUsers = context.GetProjectUsers(ProjectId).ToList().Where(e => e.ProjectRoleId == 1); var users = new List <User>(); var currProjectUser = context.GetProjectUsers(ProjectId).Single(e => e.UserId == WebSecurity.CurrentUserId); if (currProjectUser.ProjectRoleId == 1) { users.Add(_context.GetUser(currProjectUser.UserId)); } else { foreach (var user in projectUsers) { users.Add(_context.GetUser(user.UserId)); } } return(users.Select(e => new SelectListItem { Text = context.GetCreatorName(e.Id), Value = e.Id.ToString(CultureInfo.InvariantCulture) }).ToList()); }
public ProjectListViewModel FromProject(Project project) { var context = new LmPlatformModelsContext(); var isAssigned = false; foreach (var user in context.ProjectUsers) { if (user.ProjectId == project.Id && user.UserId == WebSecurity.CurrentUserId) { isAssigned = true; } } var _context = new ProjectManagementService(); var creatorId = project.Creator.Id; return(new ProjectListViewModel { Id = project.Id, Title = string.Format("<a href=\"{0}\">{1}</a>", Url.Action("ProjectManagement", "BTS", new { id = project.Id }), project.Title), CreatorName = _context.GetCreatorName(creatorId), CreationDate = project.DateOfChange.ToShortDateString(), UserQuentity = _context.GetProjectUsers(project.Id).Count, IsAssigned = isAssigned }); }
public static string GetProjectCreatorName(int projectId) { var context = new LmPlatformModelsContext(); var _context = new ProjectManagementService(); var project = context.Projects.Find(projectId); var creator = context.Users.Find(project.CreatorId); return(_context.GetCreatorName(creator.Id)); }
public void SetParams(Bug model) { var context = new ProjectManagementService(); Steps = model.Steps; ExpectedResult = model.ExpectedResult; Symptom = GetSymptomName(model.SymptomId); EditorName = context.GetCreatorName(model.EditorId); ReporterName = context.GetCreatorName(model.ReporterId); Summary = model.Summary; Description = model.Description; Severity = GetSeverityName(model.SeverityId); Status = GetStatusName(model.StatusId); Project = GetProjectTitle(model.ProjectId); ProjectId = model.ProjectId; ModifyingDate = model.ModifyingDate.ToShortDateString(); ReportingDate = model.ReportingDate.ToShortDateString(); AssignedDeveloperId = model.AssignedDeveloperId; AssignedDeveloperName = (AssignedDeveloperId == 0) ? "-" : context.GetCreatorName(AssignedDeveloperId); }
public ProjectUserListViewModel FromProjectUser(ProjectUser projectUser) { var context = new ProjectManagementService(); return(new ProjectUserListViewModel { Id = projectUser.Id, UserName = context.GetCreatorName(projectUser.User.Id), RoleName = GetRoleName(projectUser.ProjectRoleId), ProjectId = projectUser.ProjectId }); }
public List <string> GetProjectCreatorNameList(int studentId) { var context = new ProjectManagementService(); var projectUserList = context.GetProjectsOfUser(studentId).ToList(); var projectCreatorNameList = new List <string>(); foreach (var project in projectUserList) { var creator = new LmPlatformRepositoriesContainer().UsersRepository.GetBy( new Query <User>(e => e.Id == project.Project.CreatorId)); projectCreatorNameList.Add(context.GetCreatorName(creator.Id)); } return(projectCreatorNameList); }
public ActionResult SaveBug(AddOrEditBugViewModel model) { model.Save(WebSecurity.CurrentUserId, _currentProjectId); var bugLog = new BugLog { BugId = model.BugId, UserId = WebSecurity.CurrentUserId, UserName = ProjectManagementService.GetCreatorName(WebSecurity.CurrentUserId), PrevStatusId = _prevBugStatus, CurrStatusId = model.StatusId, LogDate = DateTime.Now }; if (model.BugId != 0) { model.SaveBugLog(bugLog); } return(null); }
public void GetCreatorName(int id) { CreatorName = ProjectManagementService.GetCreatorName(id); }