コード例 #1
0
        public Bug SaveBug(Bug bug)
        {
            using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
            {
                repositoriesContainer.BugsRepository.Save(bug);
                repositoriesContainer.ApplyChanges();
            }

            return bug;
        }
コード例 #2
0
ファイル: BTSController.cs プロジェクト: slaq777/lmsystem
        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
            };
        }
コード例 #3
0
ファイル: BTSController.cs プロジェクト: slaq777/lmsystem
        public BugListViewModel FromBug(Bug bug, string htmlLinks)
        {
            var model = FromBug(bug);
            model.Action = new HtmlString(htmlLinks);

            return model;
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: BugsViewModel.cs プロジェクト: slaq777/lmsystem
        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);
        }