示例#1
0
        public HttpResponseMessage CancelFinding(DefectChangeLogsTableRowDto defectChangeLog)
        {
            Defect defect = _defectService.FindById(new Guid(defectChangeLog.DefectId));

            if (defect != null)
            {
                if (defect.IsDeleted == true)
                {
                    defect.IsDeleted = false;
                }

                else
                {
                    defect.Severity = (Severity)Int32.Parse(defectChangeLog.OriginalSeverity);
                    defect.Name     = defectChangeLog.OriginalType;
                    defect.Layer    = (DefectLayer)Enum.Parse(typeof(DefectLayer), defectChangeLog.OriginalLayer, true);
                }

                var result = _defectService.Update(defect);

                return(result.Succeeded
                               ? Request.CreateResponse(HttpStatusCode.OK)
                               : Request.CreateErrorResponse(HttpStatusCode.BadRequest, result.Message));
            }
            return(Request.CreateResponse(HttpStatusCode.BadRequest, "Cannot find finding"));
        }
示例#2
0
        public async Task GetRepairReport(List <Guid> selectedFindingIds, Guid taskId, NodeType nodeType, Guid nodeId)
        {
            var findings = new List <Defect>();

            foreach (var findingId in selectedFindingIds)
            {
                var finding = _defectService.FindById(findingId);
                findings.Add(finding);
            }

            if (!findings.Any())
            {
                throw new Exception($@"There is no report for the selected findings!");
            }

            string bladeMapImagePath           = HttpContext.Current.Server.MapPath("~/App_Data/blade_outline_abc.png");
            string bladeMapImageHorizontalPath = HttpContext.Current.Server.MapPath("~/App_Data/blade_outline_horizontal.png");
            string reportTemplate = HttpContext.Current.Server.MapPath("~/App_Data/RepairReport.docx");


            await _reportGeneratorManagerService.GenerateRepairReport(
                findings.ToList(),
                bladeMapImagePath,
                bladeMapImageHorizontalPath,
                reportTemplate,
                taskId,
                nodeType,
                nodeId);
        }
        public FindingsTableDto <FindingsTableRowDto> GetDefectsForGroupAction(FindingsActionsDataTableFilterModelDto findingsDataTableFilter)
        {
            Defect defect = _defectService.FindById(findingsDataTableFilter.Id);
            FindingsActionsQuery findingsQuery = _mapper.Map <FindingsActionsQuery>(findingsDataTableFilter);

            findingsQuery.RootDefect = defect;

            IPagedList <DefectRowDto>  findings             = _defectService.GetDefectsForNodePaged(NodeType.Blade, defect.Sequence.BladeId, findingsQuery);
            List <FindingsTableRowDto> findingsTableRowDtos = _mapper.Map <IEnumerable <DefectRowDto>, IEnumerable <FindingsTableRowDto> >(findings).ToList();

            return(new FindingsTableDto <FindingsTableRowDto>
            {
                FindingsTableRows = findingsTableRowDtos,
                TotalRecords = findings.TotalCount
            });
        }
        public string GetDeepZoomLinkIdByFindingId(Guid findingId)
        {
            var defect = _defectService.FindById(findingId);

            if (defect == null)
            {
                return(String.Empty);
            }

            var deepZoomLink = _deepZoomLinkService.GetByUniqueKeys(defect.Sequence.BladeId, defect.Sequence.InspectionId, defect.Surface);

            if (deepZoomLink == null)
            {
                return(String.Empty);
            }

            return(deepZoomLink.Id.ToString());
        }
示例#5
0
        public BreadcrumbDto GetFindingBreadcrumb(Guid findingId)
        {
            Defect finding = _defectService.FindById(findingId);

            return(_mapper.Map <DefectBreadcrumbDto>(finding));
        }
示例#6
0
 public Guid GetBladeIdByFindingId(Guid findingId)
 {
     return(_defectApiService.FindById(findingId).Sequence.BladeId);
 }
 public DefectDto GetDefect(Guid defectId)
 {
     return(_mapper.Map <DefectDto>(_defectService.FindById(defectId)));
 }