Пример #1
0
 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);
 }
Пример #2
0
        public JsonResult GetDeveloperNames()
        {
            var _context = new UsersManagementService();
            var context = new ProjectManagementService();
            var projectUsers = context.GetProjectUsers(_currentProjectId).ToList().Where(e => e.ProjectRoleId == 1);

            var users = new List<User>();

             var currProjectUser =
                context.GetProjectUsers(_currentProjectId).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));
                }
            }

            var userList = users.Select(e => new SelectListItem
            {
                Text = context.GetCreatorName(e.Id),
                Value = e.Id.ToString(CultureInfo.InvariantCulture)
            }).ToList();

            return Json(new SelectList(userList, "Value", "Text"));
        }
Пример #3
0
        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
            };
        }
Пример #4
0
        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
            };
        }
Пример #5
0
        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 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;
        }
Пример #7
0
        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);
        }