Beispiel #1
0
        private Inspection ToInspection(AccelaSDKModels.Inspection inspectionRecord)
        {
            var inspection = new Inspection
            {
                Id        = inspectionRecord.id.ToString(),
                Inspector = inspectionRecord.inspectorFullName,
                PermitNum = inspectionRecord.recordId.customId,

                // TODO verify this
                ScheduledDate = inspectionRecord.scheduledDate,
                DesiredDate   = inspectionRecord.scheduleDate,
                RequestDate   = inspectionRecord.requestDate,
                InspectedDate = inspectionRecord.completedDate,
            };

            if (inspectionRecord.type != null)
            {
                inspection.InspType = inspectionRecord.type.text;
            }

            if (this.config.InspectionType != null)
            {
                var mapping = this.config.InspectionType.SingleOrDefault <InspectionTypeMapping>(m => m.InspectionType == inspection.InspType);
                inspection.InspTypeMapped = mapping.InspectionTypeMapped;
            }

            if (inspectionRecord.status != null)
            {
                inspection.Result = inspectionRecord.status.text;
            }

            if (this.config.InspectionResult != null)
            {
                var mapping = this.config.InspectionResult.SingleOrDefault <InspectionResultMapping>(m => m.Result == inspection.Result);
                inspection.ResultMapped = mapping.ResultMapped;
            }

            if (inspectionRecord.resultComment != null && inspectionRecord.commentDisplay == "Y")
            {
                // TODO How to deal correctly with comment permission via inspectionRecord.commentPublicVisible?
                inspection.InspectionNotes = inspectionRecord.resultComment;
            }

            return(inspection);
        }
Beispiel #2
0
 public Inspection GetInspection(string permitNumber, string inspectionId)
 {
     AccelaSDKModels.Inspection inspectionRecord = this.inspectionApi.GetInspection(inspectionId, this.BackgroundToken);
     return(this.ToInspection(inspectionRecord));
 }