Beispiel #1
0
        public AddOrEditBugViewModel(int bugId)
        {
            BugId = bugId;
            SavedAssignedDeveloperId = AssignedDeveloperId;

            if (bugId != 0)
            {
                var bug = BugManagementService.GetBug(bugId);
                BugId                    = bugId;
                CreatorId                = bug.ReporterId;
                ProjectId                = bug.ProjectId;
                SeverityId               = bug.SeverityId;
                StatusId                 = bug.StatusId;
                SymptomId                = bug.SymptomId;
                Steps                    = bug.Steps;
                ExpectedResult           = bug.ExpectedResult;
                Description              = bug.Description;
                Summary                  = bug.Summary;
                ReportingDate            = bug.ReportingDate;
                ModifyingDate            = bug.ModifyingDate;
                AssignedDeveloperId      = bug.AssignedDeveloperId;
                SavedAssignedDeveloperId = bug.AssignedDeveloperId;
                EditorId                 = bug.EditorId;
            }
        }
Beispiel #2
0
        public void Save(int reporterId, int projectId)
        {
            if (projectId != 0)
            {
                ProjectId = projectId;
            }

            var bug = new Bug
            {
                Id                  = BugId,
                ReporterId          = CreatorId,
                ProjectId           = ProjectId,
                SeverityId          = SeverityId,
                StatusId            = StatusId,
                SymptomId           = SymptomId,
                Steps               = Steps,
                ExpectedResult      = ExpectedResult,
                Description         = Description,
                Summary             = Summary,
                ModifyingDate       = DateTime.Today,
                EditorId            = reporterId,
                AssignedDeveloperId = AssignedDeveloperId
            };

            if (BugId == 0)
            {
                bug.ReportingDate       = DateTime.Today;
                bug.StatusId            = 1;
                bug.AssignedDeveloperId = 0;
                bug.ReporterId          = WebSecurity.CurrentUserId;
            }
            else
            {
                bug.ReportingDate = BugManagementService.GetBug(BugId).ReportingDate;
                if (StatusId != 2 && SavedAssignedDeveloperId != AssignedDeveloperId)
                {
                    bug.AssignedDeveloperId = SavedAssignedDeveloperId;
                }
            }

            if (bug.StatusId == 1 || bug.StatusId == 8)
            {
                bug.AssignedDeveloperId = 0;
            }

            BugManagementService.SaveBug(bug);
        }
Beispiel #3
0
        public ActionResult EditBug(int id)
        {
            var bug = BugManagementService.GetBug(id);

            _currentProjectId = bug.ProjectId;

            var bugViewModel = new AddOrEditBugViewModel(id);

            _prevBugStatus = bugViewModel.StatusId;
            var projectUser =
                new ProjectManagementService().GetProjectUsers(bug.ProjectId).Single(e => e.UserId == WebSecurity.CurrentUserId);

            if ((projectUser.ProjectRoleId == 1 && bug.StatusId == 2) ||
                (projectUser.ProjectRoleId == 3 && bug.StatusId == 1))
            {
                return(PartialView("_EditBugFormWithAssignment", bugViewModel));
            }

            return(PartialView("_EditBugFormWithAssignment", bugViewModel));
        }