Exemplo n.º 1
0
        public void GetValue(Guid id, Template templateDetails, IReportsData reportDetails)
        {
            var callForServiceSummary = _callForServiceSummaryQueryService.FindCallForServiceSummary(id);
            var caseNumber            = callForServiceSummary.Case != null ? callForServiceSummary.Case.Number : string.Empty;

            if (templateDetails != null) //Added check for null before being dereferenced
            {
                _reportHeaderBuilder.GenerateReportHeader(ModuleType.CallForService.GetDescription(),
                                                          RelatedToType.Summary.GetDescription(), caseNumber,
                                                          callForServiceSummary.Number, callForServiceSummary.Agency.AgencyId, reportDetails,
                                                          templateDetails.CaseNumberReportDisplayType, templateDetails.ReportNumberReportDisplayType);

                #region Render fields section wise
                if (templateDetails.Sections.Any())
                {
                    foreach (var section in templateDetails.Sections)
                    {
                        PrepareCallForServiceSummarySectionsForReport(section, section.Name, callForServiceSummary,
                                                                      reportDetails);
                    }
                }

                #endregion
            }
            _attachmentBuilder.ReadAttachments(callForServiceSummary.Attachments, reportDetails);
        }
Exemplo n.º 2
0
        public void GetValue(Guid id, Template templateDetails, IReportsData reportDetails)
        {
            var    otherEventSummary = _otherEventSummaryQueryService.FindOtherEventSummary(id);
            string headerDesc        = otherEventSummary.Event.EventCategory.Description;
            var    caseNumber        = otherEventSummary.Case != null ? otherEventSummary.Case.Number : string.Empty;

            if (string.IsNullOrEmpty(headerDesc))
            {
                headerDesc = ModuleType.OtherEvent.GetDescription();
            }
            if (templateDetails != null)
            {
                _reportHeaderBuilder.GenerateReportHeader(headerDesc, "", caseNumber,
                                                          otherEventSummary.Number,
                                                          otherEventSummary.Agency.AgencyId, reportDetails, templateDetails.CaseNumberReportDisplayType,
                                                          templateDetails.ReportNumberReportDisplayType);

                #region Render fields section wise
                if (templateDetails.Sections.Any())
                {
                    foreach (var section in templateDetails.Sections)
                    {
                        PrepareOtherEventSummarySectionsForReport(id, section, section.Name, otherEventSummary,
                                                                  reportDetails);
                    }
                }
                #endregion
            }
            _attachmentBuilder.ReadAttachments(otherEventSummary.Attachments, reportDetails);
        }
        public void GetValue(Guid id, Template templateDetails, IReportsData reportDetails)
        {
            var arrestSummary = _arrestSummaryQueryService.FindArrestSummary(id);
            var caseNumber    = arrestSummary.Case != null ? arrestSummary.Case.Number : string.Empty;

            if (templateDetails != null)
            {
                _reportHeaderBuilder.GenerateReportHeader(ModuleType.Arrest.GetDescription(),
                                                          RelatedToType.Summary.GetDescription(), caseNumber,
                                                          arrestSummary.Number, arrestSummary.Agency.AgencyId, reportDetails,
                                                          templateDetails.CaseNumberReportDisplayType, templateDetails.ReportNumberReportDisplayType);

                #region Render fields section wise

                if (templateDetails.Sections.Any())
                {
                    foreach (var section in templateDetails.Sections)
                    {
                        PrepareArrestSummarySectionsForReport(section, section.Name, arrestSummary, reportDetails);
                    }
                }

                #endregion
            }
            _attachmentBuilder.ReadAttachments(arrestSummary.Attachments, reportDetails);
        }
Exemplo n.º 4
0
        private static void GetCodeValuePropertyValue(object section, string sectionHeader, int index,
                                                      PropertyInfo property,
                                                      string specialType, IReportsData reportDetails, string nodeLabel, string fieldPath, Field templateField)
        {
            string nodeValue;
            var    codeValueObject = ((CodeValue)(property.GetValue(section, null)));

            if (property.Name.ToLower() == OfficerName.ToLower())
            {
                nodeValue = (property.GetValue(section, null) != null
                    ? (String.IsNullOrWhiteSpace(codeValueObject.Code)? codeValueObject.Description: codeValueObject.Description.Replace(codeValueObject.Code, "") + " (" + codeValueObject.Code + ")")
                    : string.Empty);
            }
            else
            {
                nodeValue = (property.GetValue(section, null) != null
                    ? codeValueObject.Description
                    : string.Empty);
            }
            reportDetails.Datas.AddField(templateField, new Data
            {
                Label           = nodeLabel,
                SectionCount    = index + 1,
                SectionGroup    = sectionHeader,
                SectionSubGroup = specialType,
                FieldPath       = GetFieldPrefix(fieldPath),
                Value           = nodeValue
            });
        }
Exemplo n.º 5
0
        private void AddEmptySection(Section templateSection, string sectionHeader, string sectionSubGroup,
                                     IReportsData reportDetails)
        {
            foreach (var templateField in templateSection.Fields)
            {
                reportDetails.Datas.AddField(templateField, new Data
                {
                    Label           = templateField.Label,
                    SectionCount    = 0,
                    SectionGroup    = sectionHeader,
                    SectionSubGroup = sectionSubGroup,
                    FieldPath       = templateField.Path,
                    Value           = string.Empty
                });
            }

            foreach (var subSection in templateSection.SubSections)
            {
                foreach (var templateField in subSection.Fields)
                {
                    reportDetails.Datas.AddField(templateField, new Data
                    {
                        Label           = templateField.Label,
                        SectionCount    = 0,
                        SectionGroup    = sectionHeader,
                        SectionSubGroup = sectionSubGroup,
                        FieldPath       = templateField.Path,
                        Value           = string.Empty
                    });
                }
            }
        }
Exemplo n.º 6
0
        public void GetValue(Guid id, string reportType, Template templateDetails, IReportsData reportDetails)
        {
            var fieldInterviewReportDetails =
                _fieldInterviewReportQueryService.FindFieldInterviewReport(id);

            if (templateDetails != null)
            {
                _reportHeaderBuilder.GenerateReportHeader(ModuleType.FieldInterview.GetDescription(),
                                                          reportType, fieldInterviewReportDetails.CaseNumber,
                                                          fieldInterviewReportDetails.Number, fieldInterviewReportDetails.Agency.AgencyId, reportDetails,
                                                          templateDetails.CaseNumberReportDisplayType, templateDetails.ReportNumberReportDisplayType);

                #region Render fields section wise
                if (templateDetails.Sections.Any())
                {
                    foreach (var section in templateDetails.Sections)
                    {
                        PrepareFieldInterviewReportSectionsForReport(section, section.Name, fieldInterviewReportDetails,
                                                                     reportDetails);
                    }
                }
                #endregion
            }

            _attachmentBuilder.ReadAttachments(fieldInterviewReportDetails.Attachments, reportDetails);
        }
Exemplo n.º 7
0
        private int ResolveExtendedData(object section, string sectionHeader, int index, PropertyInfo property,
                                        ControlType controlType, string specialType, IReportsData reportDetails,
                                        string nodeLabel,
                                        string fieldPath, Mask dateTimeMask, Field templateField)
        {
            var    propertyList = (Dictionary <string, string>)property.GetValue(section, null);
            string nodeValue;
            var    dataItem = new Data
            {
                Label           = nodeLabel,
                SectionCount    = index + 1,
                SectionGroup    = sectionHeader,
                SectionSubGroup = specialType,
                FieldPath       = GetFieldPrefix(fieldPath),
                Value           = string.Empty
            };

            if (propertyList.TryGetValue(fieldPath, out nodeValue) && !string.IsNullOrEmpty(nodeValue))
            {
                switch (controlType)
                {
                case ControlType.Code:
                    var item = JObject.Parse(nodeValue);
                    dataItem.Value = item["description"].ToString();
                    break;

                case ControlType.Multiselect:
                    var data  = JArray.Parse(nodeValue);
                    var items = data.Select(j => j["description"].ToString()).ToList();
                    dataItem.Value = string.Join(", ", items);
                    break;

                case ControlType.Date:
                    DateTime date;
                    if (DateTime.TryParse(nodeValue.Replace("\"", ""), out date))
                    {
                        dataItem.Value = ResolveDateTimeValue(date, dateTimeMask, templateField);
                    }
                    break;

                default:
                    dataItem.Value = nodeValue.TrimStart('"').TrimEnd('"');
                    break;
                }
            }
            reportDetails.Datas.AddField(templateField, dataItem);

            //always only 1 field will be added here
            return(1);
        }
Exemplo n.º 8
0
        private void GetValue(IReportsData reportDetails, IEnumerable <Attachment> photosToRender, string sectionGroup)
        {
            var counter = 1;

            foreach (var item in photosToRender)
            {
                if (item.Source.Equals(AttachmentDescription.Web.GetDescription()))
                {
                    string itemDesc = item.Description;
                    if (!string.IsNullOrEmpty(item.CategoryType))
                    {
                        itemDesc += System.Environment.NewLine + item.CategoryType;
                    }
                    if (item.AttachmentRelationships.Count > 0)
                    {
                        itemDesc += System.Environment.NewLine + item.AttachmentRelationships[0].Description;
                    }

                    if (sectionGroup.Equals("Photos"))
                    {
                        reportDetails.Datas.Add(new Data
                        {
                            Label           = itemDesc,
                            SectionCount    = counter,
                            SectionGroup    = sectionGroup,
                            SectionSubGroup = item.ContentType + "/" + item.ContentSubType,
                            FieldPath       = string.Empty,
                            Value           = item.MediaId.ToString()
                        });
                        counter++;
                    }

                    else
                    {
                        reportDetails.Datas.Add(new Data
                        {
                            Label           = itemDesc,
                            SectionCount    = counter,
                            SectionGroup    = sectionGroup,
                            SectionSubGroup = item.ContentType + "/" + item.ContentSubType,
                            FieldPath       = string.Empty,
                            Value           = item.FileName.ToString() + "." + item.Extension
                        });
                        counter++;
                    }
                }
            }
        }
Exemplo n.º 9
0
        private int GetSectionLastIndex(string sectionGroup, string sectionSubGroup, IReportsData reportDetails)
        {
            var nodeItems =
                reportDetails.Datas.FindAll(x => x.SectionGroup == sectionGroup && x.SectionSubGroup == sectionSubGroup)
                .OrderByDescending(x => x.SectionCount);

            if (nodeItems.Any())
            {
                var firstOrDefault = nodeItems.FirstOrDefault();
                if (firstOrDefault != null)
                {
                    return(firstOrDefault.SectionCount);
                }
            }
            return(0);
        }
Exemplo n.º 10
0
        private int CreateNode(object section, string sectionHeader, int index,
                               PropertyInfo property, IList <Field> templateFields, string sectionSuffix, string specialType,
                               IReportsData reportDetails, Field templateField)
        {
            //when there are subsection fields, the internal propery reading will render all of those fields here only
            //thus this variable will be used to indicate howmany iterations to be skipped on the main template fields collection
            var indexToBeSkipped = 1;

            if (!property.CanRead)
            {
                return(indexToBeSkipped);
            }

            indexToBeSkipped = ReadProperty(section, sectionHeader, index, property, sectionSuffix, templateFields,
                                            specialType, reportDetails, templateField);

            return(indexToBeSkipped);
        }
Exemplo n.º 11
0
        private static void GetNullableDateTimePropertyValue(object section, string sectionHeader, int index,
                                                             PropertyInfo property,
                                                             string specialType, IReportsData reportDetails, string nodeLabel, string fieldPath, Mask dateTimeMask, Field templateField)
        {
            var nullableProperty = property.GetValue(section, null);
            var nodeValue        = (nullableProperty != null ? Convert.ToDateTime(property.GetValue(section, null).ToString()) : new DateTime());

            //if (nodeValue.ToString() != "TriTech.InformRMS.Domain.Core.ComplexTypes.CodeValue")
            reportDetails.Datas.AddField(templateField, new Data
            {
                Label           = nodeLabel,
                SectionCount    = index + 1,
                SectionGroup    = sectionHeader,
                SectionSubGroup = specialType,
                FieldPath       = GetFieldPrefix(fieldPath),
                Value           = ResolveDateTimeValue(nodeValue, dateTimeMask, templateField)
            });
        }
Exemplo n.º 12
0
        private static void GetNullablePropertyValue(object section, string sectionHeader, int index,
                                                     PropertyInfo property,
                                                     string specialType, IReportsData reportDetails, string nodeLabel, string fieldPath, Field templateField)
        {
            var nullableProperty = property.GetValue(section, null);
            var nodeValue        = (nullableProperty != null ? property.GetValue(section, null).ToString() : string.Empty);

            if (nodeValue != DomainCoreComplexTypeCodeValueReference)
            {
                reportDetails.Datas.AddField(templateField, new Data
                {
                    Label           = nodeLabel,
                    SectionCount    = index + 1,
                    SectionGroup    = sectionHeader,
                    SectionSubGroup = specialType,
                    FieldPath       = GetFieldPrefix(fieldPath),
                    Value           = nodeValue
                });
            }
        }
Exemplo n.º 13
0
        public void GetValue(Guid id, string reportType, Template templateDetails, IReportsData reportDetails)
        {
            var arrestReportDetails = _arrestReportQueryService.FindArrestReport(id);

            if (templateDetails != null)
            {
                _reportHeaderBuilder.GenerateReportHeader(ModuleType.Arrest.GetDescription(), reportType,
                                                          arrestReportDetails.CaseNumber, arrestReportDetails.Number,
                                                          arrestReportDetails.Agency.AgencyId, reportDetails, templateDetails.CaseNumberReportDisplayType,
                                                          templateDetails.ReportNumberReportDisplayType);
                if (templateDetails.Sections.Any())
                {
                    foreach (var section in templateDetails.Sections)
                    {
                        PrepareArrestReportSectionsForReport(section, section.Name, arrestReportDetails, reportDetails);
                    }
                }
            }
            _attachmentBuilder.ReadAttachments(arrestReportDetails.Attachments, reportDetails);
        }
Exemplo n.º 14
0
        private void GetViolationCodeReferenceDetailValue(object section, string sectionHeader, int index, PropertyInfo property, string nodeLabel,
                                                          string specialType, IReportsData reportDetails, Field templateField)
        {
            var nodeValue      = string.Empty;
            var propertyDetail = ((ViolationCodeReference)property.GetValue(section, null));

            if (propertyDetail != null)
            {
                nodeValue = propertyDetail.Description;
            }

            reportDetails.Datas.AddField(templateField, new Data
            {
                Label           = nodeLabel,
                SectionCount    = index + 1,
                SectionGroup    = sectionHeader,
                SectionSubGroup = specialType,
                FieldPath       = string.Empty,
                Value           = nodeValue
            });
        }
Exemplo n.º 15
0
        protected virtual void PreparePublicSafetyEntityForReport(Section templateSection,
                                                                  IList <IPublicSafetyEntityDetails> reportSectionSpecificNodes, string sectionHeader, string sectionSubGroup,
                                                                  IReportsData reportDetails, string specialType = "", int runningIndex = 0)
        {
            //If section node is greater then 0 then add to report data
            if (reportSectionSpecificNodes.Count > 0)
            {
                for (int index = 0; index < reportSectionSpecificNodes.Count; index++)
                {
                    if (reportSectionSpecificNodes[index] != null)
                    {
                        PreparePropertyByTemplateFieldForReport(templateSection.Fields,
                                                                reportSectionSpecificNodes[index], sectionHeader, (runningIndex > 0 ? runningIndex + index : index), sectionSubGroup, specialType,
                                                                reportDetails);

                        if (templateSection.SubSections.Count <= 0)
                        {
                            continue;
                        }
                        foreach (SubSection subSection in templateSection.SubSections)
                        {
                            PreparePropertyByTemplateFieldForReport(subSection.Fields,
                                                                    reportSectionSpecificNodes[index], sectionHeader, (runningIndex > 0 ? runningIndex + index : index), sectionSubGroup, specialType,
                                                                    reportDetails);
                        }
                    }
                    else
                    {
                        AddEmptySection(templateSection, sectionHeader, sectionSubGroup, reportDetails);
                    }
                }
            }
            else
            {
                //identify all fields in template based on the empty section & add empty fields for a single node
                //we might later remove the fields to help reduce the size of data
                AddEmptySection(templateSection, sectionHeader, sectionSubGroup, reportDetails);
            }
        }
Exemplo n.º 16
0
        public void ReadAttachments(List <Attachment> attachments, IReportsData reportDetails)
        {
            var contentSubType = new List <string> {
                "jpeg", "png", "gif", "tiff"
            };

            if (attachments.Count <= 0)
            {
                return;
            }

            //Photos setion
            var attachToRender = attachments.Where(
                item => contentSubType.Contains(item.ContentSubType));

            GetValue(reportDetails, attachToRender, "Photos");

            //Other attachments section
            attachToRender = attachments.Where(
                item => !contentSubType.Contains(item.ContentSubType));
            GetValue(reportDetails, attachToRender, "Attachments");
        }
Exemplo n.º 17
0
        private void GetScarMarkTattooDetailValue(object section, string sectionHeader, int index, PropertyInfo property, string nodeLabel,
                                                  string specialType, IReportsData reportDetails, Field templateField)
        {
            var nodeValue = string.Empty;
            ScarMarkTattooCollection propertyDetail = (ScarMarkTattooCollection)property.GetValue(section);

            foreach (var scarMarkTatoo in propertyDetail)
            {
                if (scarMarkTatoo.Active == "True")
                {
                    reportDetails.Datas.AddField(templateField, new Data
                    {
                        Label           = nodeLabel,
                        SectionCount    = index + 1,
                        SectionGroup    = sectionHeader,
                        SectionSubGroup = specialType,
                        FieldPath       = string.Empty,
                        Value           = scarMarkTatoo.SMT.Description + " - " + scarMarkTatoo.Description + " - " + scarMarkTatoo.TypeSMT.Description + " - " + scarMarkTatoo.NCICSMT.Description
                    });
                }
            }
        }
Exemplo n.º 18
0
        public void ArrestReportBuilder_GenerateReportsDataForArrestReport()
        {
            Exception expectedExcetpion = null;

            reportId = Utils.GetReportIdForArrest(false);
            IReportsData reportsData = Utils.GenerateReportsData(reportId, RelatedToType.InitialReport, ModuleType.Arrest);

            Assert.IsTrue(reportsData.Datas.Any());
            var template            = Utils.GetDefaultTemplate(ModuleType.Arrest);
            var arrestReportBuilder = GetDependency <IArrestReportBuilder>();

            Assert.IsInstanceOfType(arrestReportBuilder, typeof(IArrestReportBuilder));
            try
            {
                arrestReportBuilder.GetValue(reportId, "Initial", template, reportsData);
            }
            catch (Exception excetpion)
            {
                expectedExcetpion = excetpion;
            }

            Assert.IsNull(expectedExcetpion);
        }
Exemplo n.º 19
0
 public ReportService(
     IReportQueryService reportQueryService,
     ISummaryQueryService summaryQueryService,
     ITemplateQueryService templateQueryService,
     IIncidentSummaryBuilder incidentSummaryBuilder,
     IArrestSummaryReportBuilder arrestSummaryReportBuilder,
     IFieldInterViewSummaryBuilder fieldInterViewSummaryBuilder,
     ICallForServiceSummaryReportBuilder callforserviceSummaryBuilder,
     IOtherEventSummaryBuilder otherEventSummaryBuilder,
     IIncidentBuilder incidentReportBuilder,
     IArrestReportBuilder arrestReportBuilder,
     IFieldInterviewBuilder fieldInterviewReportBuilder,
     ICallForServiceReportBuilder callforserviceReportBuilder,
     IOtherEventBuilder otherEventBuilder,
     IReportsData reportDetails,
     ICitationReportBuilder citationReportBuilder,
     ICitationSummaryReportBuilder citationSummaryReportBuilder
     )
 {
     _reportQueryService           = reportQueryService;
     _summaryQueryService          = summaryQueryService;
     _templateQueryService         = templateQueryService;
     _incidentSummaryBuilder       = incidentSummaryBuilder;
     _arrestSummaryReportBuilder   = arrestSummaryReportBuilder;
     _fieldInterViewSummaryBuilder = fieldInterViewSummaryBuilder;
     _callforserviceSummaryBuilder = callforserviceSummaryBuilder;
     _otherEventSummaryBuilder     = otherEventSummaryBuilder;
     _incidentReportBuilder        = incidentReportBuilder;
     _arrestReportBuilder          = arrestReportBuilder;
     _fieldInterviewReportBuilder  = fieldInterviewReportBuilder;
     _callforserviceReportBuilder  = callforserviceReportBuilder;
     _otherEventBuilder            = otherEventBuilder;
     _citationReportBuilder        = citationReportBuilder;
     _citationSummaryReportBuilder = citationSummaryReportBuilder;
     _reportDetails = reportDetails;
 }
Exemplo n.º 20
0
        private int ReadProperty(object section, string sectionHeader, int index,
                                 PropertyInfo property, string sectionSuffix, IList <Field> templateFields, string specialType,
                                 IReportsData reportDetails, Field templateField)
        {
            var nodeLabel        = string.Empty;
            var fieldPath        = string.Empty;
            var indexToBeSkipped = 0;
            //the specified item is not a field but refers to a subsection
            var subSectionName = property.Name;

            if (templateField == null)
            {
                if (!sectionSuffix.ToLower().Contains(property.Name.ToLower()))
                {
                    subSectionName = sectionSuffix + "." + subSectionName;
                }

                templateFields =
                    templateFields.Where(item => item.Path.ToLower().StartsWith(subSectionName.ToLower())).ToList();

                //if the specified item is neither a field nor a subsection then return.
                if (!templateFields.Any())
                {
                    return(indexToBeSkipped);
                }
            }
            else
            {
                nodeLabel = templateField.Label;
                fieldPath = templateField.Path;
            }

            indexToBeSkipped = ConvertPropertyToNode(section, sectionHeader, index, property, specialType, reportDetails, nodeLabel, fieldPath, templateField);

            return(indexToBeSkipped);
        }
Exemplo n.º 21
0
        public void GetValue(Guid id, string reportType, Template templateDetails, IReportsData reportDetails)
        {
            var citationReportDetails = _citationReportQueryService.FindCitationReport(id);

            if (templateDetails != null) //Added check for null before being dereferenced
            {
                _reportHeaderBuilder.GenerateReportHeader(ModuleType.Citation.GetDescription(),
                                                          reportType,
                                                          citationReportDetails.CaseNumber,
                                                          citationReportDetails.Number,
                                                          citationReportDetails.Agency.AgencyId,
                                                          reportDetails, templateDetails.CaseNumberReportDisplayType,
                                                          templateDetails.ReportNumberReportDisplayType);
                if (templateDetails.Sections.Any())
                {
                    foreach (var section in templateDetails.Sections)
                    {
                        PrepareCitationReportSectionsForReport(section, section.Name, citationReportDetails,
                                                               reportDetails);
                    }
                }
            }
            _attachmentBuilder.ReadAttachments(citationReportDetails.Attachments, reportDetails);
        }
Exemplo n.º 22
0
        private int ConvertPropertyToNode(object section, string sectionHeader, int index, PropertyInfo property,
                                          string specialType, IReportsData reportDetails,
                                          string nodeLabel,
                                          string fieldPath, Field templateField)
        {
            var indexToBeSkipped = 0;

            #region Create node for each property

            if (((property.GetMethod).ReturnParameter != null) && (Array.IndexOf(_coreTypes, (property.GetMethod).ReturnParameter.ToString().Trim()) >= 0))
            {
                GetNullablePropertyValue(section, sectionHeader, index, property, specialType, reportDetails, nodeLabel,
                                         fieldPath, templateField);
            }
            else if (((property.GetMethod).ReturnParameter != null) && (DateTimeTypes.Equals((property.GetMethod).ReturnParameter.ToString().Trim())) && templateField != null)
            {
                GetNullableDateTimePropertyValue(section, sectionHeader, index, property, specialType, reportDetails, nodeLabel,
                                                 fieldPath, templateField.DefaultMask, templateField);
            }
            else if (
                property.PropertyType.FullName.Equals(
                    "TriTech.InformRMS.Application.Contracts.Core.ComplexTypes.CodeValue") ||
                property.PropertyType.FullName.Equals(
                    "TriTech.InformRMS.Infrastructure.CodeValues.CodeValue"))
            {
                GetCodeValuePropertyValue(section, sectionHeader, index, property, specialType, reportDetails,
                                          nodeLabel,
                                          fieldPath, templateField);
            }
            else if (
                property.PropertyType.FullName.Equals(
                    "TriTech.InformRMS.Application.Contracts.Core.ComplexTypes.CodeValueCollection"))
            {
                GetCodevalueCollectionPropertyValue(section, sectionHeader, index, property, specialType,
                                                    reportDetails,
                                                    nodeLabel, fieldPath, templateField);
            }
            else if (
                property.PropertyType.FullName.Equals(
                    "TriTech.InformRMS.Application.Contracts.Core.ComplexTypes.ScarMarkTattooCollection"))
            {
                GetScarMarkTattooDetailValue(section, sectionHeader, index, property, nodeLabel, specialType, reportDetails, templateField);
            }
            else if (
                property.PropertyType.FullName.Equals(
                    "TriTech.InformRMS.Application.Contracts.Core.References.ViolationCodeReference"))
            {
                GetViolationCodeReferenceDetailValue(section, sectionHeader, index, property, nodeLabel, specialType, reportDetails, templateField);
                //Only 1 field is to be considered for offense related fields
                indexToBeSkipped = 1;
            }
            else if (
                property.PropertyType.FullName.Equals(
                    "TriTech.InformRMS.Application.Contracts.Core.ComplexTypes.RelatedName"))
            {
                var item = ((RelatedName)property.GetValue(section, null));
                var name = ((item.LastName ?? string.Empty).Trim().Length > 0 ? item.LastName + " " : string.Empty)
                           + ((item.FirstName ?? string.Empty).Trim().Length > 0 ? item.FirstName + " " : string.Empty)
                           + ((item.MiddleName ?? string.Empty).Trim().Length > 0 ? item.MiddleName : string.Empty);

                name += (item.OrganizationName ?? string.Empty);

                reportDetails.Datas.AddField(templateField, new Data
                {
                    Label           = nodeLabel,
                    SectionCount    = index + 1,
                    SectionGroup    = sectionHeader,
                    SectionSubGroup = specialType,
                    FieldPath       = GetFieldPrefix(fieldPath),
                    Value           = name
                });
            }
            else
            {
                var nodeValue = string.Empty;
                if (property.PropertyType.FullName.Contains(
                        "System.Collections.Generic.List`1[[TriTech.InformRMS.Application.Contracts.DataEntry.DTO.ExtendedField"))
                {
                    var extendedFieldProperty =
                        ((
                             List
                             <
                                 ExtendedField>)
                         property.GetValue(section, null));
                    if (extendedFieldProperty.Count > 0)
                    {
                        //TO DO - LIST OF EXTENDED FIELDS ARE NOT YET INCLUDED
                        //nodeValue = property.GetValue(section, null).ToString();
                    }
                }
                else if (property.PropertyType.FullName.Contains(
                             "System.Collections.Generic.List`1[[TriTech.InformRMS.Application.Contracts.Core.References.ViolationCodeReference"))
                {
                    var listFieldProperty = ((
                                                 List
                                                 <
                                                     ViolationCodeReference>)property.GetValue(section, null));

                    if (listFieldProperty.Count > 0)
                    {
                        foreach (var item in listFieldProperty)
                        {
                            nodeValue = (nodeValue != string.Empty ? nodeValue + "; " + item.Description : item.Description);
                        }
                    }
                }
                else if (((property.GetMethod).ReturnParameter != null) && (property.GetMethod).ReturnParameter.ToString().Trim().Contains(
                             "System.Collections.Generic.List`1[TriTech.InformRMS.Application.Contracts.Core.ComplexTypes.RelatedName"))
                {
                    var listFieldProperty = ((
                                                 List
                                                 <
                                                     RelatedName>)property.GetValue(section, null));

                    if (listFieldProperty.Count > 0)
                    {
                        foreach (var item in listFieldProperty)
                        {
                            var name = ((item.LastName ?? string.Empty).Trim().Length > 0 ? item.LastName + " " : string.Empty)
                                       + ((item.FirstName ?? string.Empty).Trim().Length > 0 ? item.FirstName + " " : string.Empty)
                                       + ((item.MiddleName ?? string.Empty).Trim().Length > 0 ? item.MiddleName : string.Empty);

                            name += ((item.Relationship.Description ?? string.Empty).Trim().Length > 0 ? ", " + item.Relationship.Description : string.Empty);
                            name += (item.OrganizationName ?? string.Empty);

                            nodeValue = (nodeValue != string.Empty ? nodeValue + "; " + name : name);
                        }
                    }
                }
                indexToBeSkipped = 1;

                reportDetails.Datas.AddField(templateField, new Data
                {
                    Label           = nodeLabel,
                    SectionCount    = index + 1,
                    SectionGroup    = sectionHeader,
                    SectionSubGroup = specialType,
                    FieldPath       = GetFieldPrefix(fieldPath),
                    Value           = nodeValue
                });
                return(indexToBeSkipped);
            }

            #endregion

            return(indexToBeSkipped);
        }
Exemplo n.º 23
0
        private void PrepareArrestSummarySectionsForReport(Section templateSection, string sectionHeader,
                                                           ArrestSummary arrestSummary, IReportsData reportDetails)
        {
            //All Public Safety type items
            var itemList = new List <IPublicSafetyEntityDetails>();

            switch (templateSection.SectionType)
            {
            case SectionType.Event:
                itemList.Add(arrestSummary.Event);
                sectionHeader = GenericSectionName.EVENT;
                PreparePublicSafetyEntityForReport(templateSection, itemList, sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Person:
                if (templateSection.Name == GenericSectionName.ARRESTEE)
                {
                    itemList.Add(arrestSummary.Arrestee);
                }
                PreparePublicSafetyEntityForReport(templateSection, itemList, sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Generic:
                if (templateSection.Name == GenericSectionName.ALCOHOL_DRUG_TESTS)
                {
                    PreparePublicSafetyEntityForReport(templateSection,
                                                       arrestSummary.AlcoholDrugTests.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                       string.Empty, reportDetails);
                }
                break;

            case SectionType.Offense:
                if (templateSection.Name == GenericSectionName.ARREST_CHARGES)
                {
                    sectionHeader = GenericSectionName.OFFENSES;
                    PreparePublicSafetyEntityForReport(templateSection,
                                                       arrestSummary.ArrestCharges.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                       string.Empty, reportDetails);
                }
                break;

            case SectionType.Drug:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   arrestSummary.Drugs.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Gun:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   arrestSummary.Guns.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Narrative:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   arrestSummary.Narratives.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                   string.Empty, reportDetails);
                break;

            case SectionType.Officer:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   arrestSummary.Officers.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Property:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   arrestSummary.Property.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Vehicle:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   arrestSummary.Vehicles.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader, string.Empty,
                                                   reportDetails);
                break;
            }
        }
Exemplo n.º 24
0
        protected virtual void PrepareFieldInterviewSourceEntityForReport(Section templateSection,
                                                                          IList <FieldInterviewSource> fiSources, string sectionHeader, IReportsData reportDetails)
        {
            var involvementTypeList = new Dictionary <string, string>();

            if (fiSources.Count <= 0)
            {
                return;
            }

            foreach (var source in fiSources)
            {
                if (source.InvolvementType.Code != null && !involvementTypeList.ContainsKey(source.InvolvementType.Code))
                {
                    involvementTypeList.Add(source.InvolvementType.Code, source.InvolvementType.Description);
                }
            }

            foreach (var involvementType in involvementTypeList)
            {
                PreparePublicSafetyEntityForReport(templateSection,
                                                   fiSources.Where(x => x.InvolvementType.Code == involvementType.Key)
                                                   .ToList <IPublicSafetyEntityDetails>(), sectionHeader, String.Empty, reportDetails,
                                                   involvementType.Value);
            }
        }
Exemplo n.º 25
0
        private void ResolvePropertyByPathRoot(IList <Field> templateFields, object section, string sectionHeader, int index,
                                               string sectionSubGroup, string specialType, IReportsData reportDetails, PropertyInfo property,
                                               string pathRoot, string fieldPrefix, Field templateField)
        {
            if (property != null)
            {
                var propertyDetail = (property.GetValue(section, null));

                if (propertyDetail != null)
                {
                    var propertyType = propertyDetail.GetType();
                    var arrInfos     = propertyType.GetProperties();

                    if (pathRoot != fieldPrefix)
                    {
                        var fieldPrefixNext = fieldPrefix.Replace(pathRoot + ".", "");
                        var pathRootNext    = GetPathRoot(fieldPrefixNext);
                        var propertyNext    = arrInfos.SingleOrDefault(x => x.Name.ToLower().Equals(pathRootNext.ToLower()));

                        ResolvePropertyByPathRoot(templateFields, propertyDetail, sectionHeader, index, sectionSubGroup, specialType, reportDetails, propertyNext, pathRootNext, fieldPrefixNext, templateField);
                    }
                    else
                    {
                        //read single property
                        var matchedItem = arrInfos.SingleOrDefault(x => x.Name.ToLower().Equals(templateField.Name.ToLower()));
                        CreateNode(propertyDetail, sectionHeader, index, matchedItem, templateFields,
                                   sectionSubGroup, specialType, reportDetails, templateField);
                    }
                }
            }
            else
            {
                //empty rows for missing fields in record
                reportDetails.Datas.AddEmptyField(templateField, sectionHeader, 0, sectionSubGroup,
                                                  specialType, templateField.Label);
            }
        }
Exemplo n.º 26
0
        protected virtual void PrepareCallForServiceOrganizationEntityForReport(Section templateSection,
                                                                                IList <CallForServiceOrganization> organizations, string sectionHeader, IReportsData reportDetails)
        {
            if (organizations.Count <= 0)
            {
                return;
            }

            PreparePublicSafetyEntityForReport(templateSection,
                                               organizations.ToList <IPublicSafetyEntityDetails>(), sectionHeader, string.Empty, reportDetails,
                                               string.Empty);
        }
Exemplo n.º 27
0
        private static void GetCodevalueCollectionPropertyValue(object section, string sectionHeader, int index,
                                                                PropertyInfo property, string specialType, IReportsData reportDetails, string nodeLabel,
                                                                string fieldPath, Field templateField)
        {
            var nodeValue          = string.Empty;
            var collectionProperty = ((CodeValueCollection)property.GetValue(section, null));

            if (collectionProperty.Count > 0)
            {
                foreach (var item in collectionProperty)
                {
                    nodeValue = (!String.IsNullOrEmpty(nodeValue) ? nodeValue + ", " : nodeValue) + item.Description;
                }
            }

            reportDetails.Datas.AddField(templateField, new Data
            {
                Label           = nodeLabel,
                SectionCount    = index + 1,
                SectionGroup    = sectionHeader,
                SectionSubGroup = specialType,
                FieldPath       = GetFieldPrefix(fieldPath),
                Value           = nodeValue
            });
        }
Exemplo n.º 28
0
        private void PrepareFieldInterviewReportSectionsForReport(Section templateSection, string sectionHeader,
                                                                  FieldInterviewReport fieldInterviewReport, IReportsData reportDetails)
        {
            //All Public Safety type items
            var itemList = new List <IPublicSafetyEntityDetails>();

            switch (templateSection.SectionType)
            {
            case SectionType.Event:
                itemList.Add(fieldInterviewReport.Event);
                sectionHeader = GenericSectionName.EVENT;
                PreparePublicSafetyEntityForReport(templateSection, itemList, sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Narrative:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   fieldInterviewReport.Narratives.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                   string.Empty, reportDetails);
                break;

            case SectionType.Officer:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   fieldInterviewReport.Officers.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                   string.Empty, reportDetails);
                break;

            case SectionType.Person:
                if (templateSection.Name == GenericSectionName.PEOPLE)
                {
                    PrepareFieldInterviewSourceEntityForReport(templateSection,
                                                               fieldInterviewReport.People.ToList(), sectionHeader,
                                                               reportDetails);
                }
                break;

            case SectionType.Vehicle:
                PreparePublicSafetyEntityForReport(templateSection,
                                                   fieldInterviewReport.Vehicles.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader,
                                                   string.Empty, reportDetails);
                break;
            }
        }
Exemplo n.º 29
0
        private void PrepareCallForServiceReportSectionsForReport(Section templateSection, string sectionHeader,
                                                                  CallForServiceReport callForServiceReport, IReportsData reportDetails)
        {
            var itemList = new List <IPublicSafetyEntityDetails>();

            switch (templateSection.SectionType)
            {
            case SectionType.Event:
                itemList.Add(callForServiceReport.CallForServiceEvent);
                sectionHeader = GenericSectionName.EVENT;
                PreparePublicSafetyEntityForReport(
                    templateSection,
                    itemList,
                    sectionHeader,
                    string.Empty,
                    reportDetails);
                break;

            case SectionType.Person:
                PrepareCallForServicePersonEntityForReport(
                    templateSection,
                    callForServiceReport.CallForServicePersons.ToList(),
                    sectionHeader,
                    reportDetails);
                break;

            case SectionType.Property:
                sectionHeader = GenericSectionName.PROPERTY;
                PreparePublicSafetyEntityForReport(templateSection,
                                                   callForServiceReport.CallForServiceProperty.Cast <IPublicSafetyEntityDetails>().ToList(), sectionHeader, string.Empty,
                                                   reportDetails);
                break;

            case SectionType.Organization:
                PrepareCallForServiceOrganizationEntityForReport(
                    templateSection,
                    callForServiceReport.CallForServiceOrganizations.ToList(),
                    sectionHeader,
                    reportDetails);
                break;

            case SectionType.Vehicle:
                PreparePublicSafetyEntityForReport(
                    templateSection,
                    callForServiceReport.CallForServiceVehicles.Cast <IPublicSafetyEntityDetails>().ToList(),
                    sectionHeader,
                    string.Empty,
                    reportDetails);
                break;

            case SectionType.CFSResponse:
                PreparePublicSafetyEntityForReport(
                    templateSection,
                    callForServiceReport.CallForServiceResponses.Cast <IPublicSafetyEntityDetails>().ToList(),
                    sectionHeader,
                    string.Empty,
                    reportDetails);
                break;

            case SectionType.Narrative:
                PreparePublicSafetyEntityForReport(
                    templateSection,
                    callForServiceReport.CallForServiceNarratives.Cast <IPublicSafetyEntityDetails>().ToList(),
                    sectionHeader,
                    string.Empty,
                    reportDetails);
                break;

            case SectionType.CFS911:
                PreparePublicSafetyEntityForReport(
                    templateSection,
                    callForServiceReport.CallForServiceE911s.Cast <IPublicSafetyEntityDetails>().ToList(),
                    sectionHeader,
                    string.Empty,
                    reportDetails);
                break;
                //Not implemented in 4.8
                //case SectionType.CFSCaseReceived:
                //    PreparePublicSafetyEntityForReport(
                //        templateSection,
                //        callForServiceReport.CallForServiceCasesReceived.Cast<IPublicSafetyEntityDetails>().ToList(),
                //        sectionHeader,
                //        string.Empty,
                //        reportDetails);
                //    break;
            }
        }
Exemplo n.º 30
0
        protected virtual void PrepareCitationOrganizationEntityForReport(Section templateSection,
                                                                          IList <CitationOrganization> others, string sectionHeader, IReportsData reportDetails)
        {
            var involvementTypeList = new Dictionary <string, string>();

            if (others.Count <= 0)
            {
                return;
            }

            foreach (var source in others)
            {
                if (source.InvolvementType.Code != null && !involvementTypeList.ContainsKey(source.InvolvementType.Code))
                {
                    involvementTypeList.Add(source.InvolvementType.Code, source.InvolvementType.Description);
                }
            }

            foreach (var involvementType in involvementTypeList)
            {
                var sectionLastIndex = GetSectionLastIndex(sectionHeader, involvementType.Value, reportDetails);

                PreparePublicSafetyEntityForReport(templateSection,
                                                   others.Where(x => x.InvolvementType.Code == involvementType.Key)
                                                   .ToList <IPublicSafetyEntityDetails>(), sectionHeader, String.Empty, reportDetails,
                                                   involvementType.Value, sectionLastIndex);
            }
        }