/// <summary> /// Processes the coverage. /// </summary> /// <param name="xiapSectionDetail">The xiap section detail.</param> /// <param name="externalCoverage">The external coverage.</param> private void ProcessCoverage(SectionDetail xiapSectionDetail, IUWCoverage externalCoverage) { Coverage coverage = null; CoverageVersion coverageVersion = (CoverageVersion)this.GetCoverageForExternalRef(xiapSectionDetail, externalCoverage.ExternalReference); if (coverageVersion == null) { // No Coverage already exists on the GeniusX policy that matches the External Reference so we create one, via the Product definition. ProductCoverage productCoverage = ObjectFactory.Resolve<IMetadataQuery>().GetProductCoverage(xiapSectionDetail.ProductSectionDetailID.Value, externalCoverage.CoverageTypeCode); if (productCoverage != null) { coverage = xiapSectionDetail.AddNewCoverage(productCoverage.ProductCoverageID); this.UpdateCoverage(coverage, externalCoverage); } } }
/// <summary> /// Gets the coverage mnatching the external Genius reference. /// </summary> /// <param name="xiapSectionDetail">The xiap section detail.</param> /// <param name="externalReference">The external reference.</param> /// <returns>The coverage version or null</returns> private IUWCoverage GetCoverageForExternalRef(SectionDetail xiapSectionDetail, string externalReference) { CoverageVersion cv = null; Coverage coverage = xiapSectionDetail.Coverages.Where(c => c.ExternalReference == externalReference).FirstOrDefault(); if (coverage != null) { cv = (CoverageVersion)coverage.GetLatestVersion(); } return cv; }
/// <summary> /// Updates the section detail passed in with the title from the external Genius policy section detail. /// </summary> /// <param name="xiapSectiondetail">The xiap sectiondetail.</param> /// <param name="externalSectionDetail">The external section detail.</param> private void UpdateSectionDetail(SectionDetail xiapSectiondetail, IUWSectionDetail externalSectionDetail) { xiapSectiondetail.ExternalReference = externalSectionDetail.ExternalReference; SectionDetailVersion secdetailVersion = (SectionDetailVersion)xiapSectiondetail.GetLatestVersion(); if (secdetailVersion != null) { secdetailVersion.SectionDetailTitle = externalSectionDetail.SectionDetailTitle; } }
private void SetSectionData(DocumentType docType) { DocumentTemplateTableAdapters.DocumentSectionTableAdapter sectionTA = new DocumentTemplateTableAdapters.DocumentSectionTableAdapter(); DocumentTemplateTableAdapters.DocumentItemEntityTableAdapter itemTA = new DocumentTemplateTableAdapters.DocumentItemEntityTableAdapter(); DocumentTemplateTableAdapters.DocumentSectionDetailsTableAdapter secDetailTA = new DocumentTemplateTableAdapters.DocumentSectionDetailsTableAdapter(); IEnumerator ieSection = sectionTA.GetByDocType(docType.CoId, docType.DeptId, docType.Id).GetEnumerator(); while (ieSection.MoveNext()) { DocumentTemplate.DocumentSectionEntityRow sectionDataRow = (DocumentTemplate.DocumentSectionEntityRow)ieSection.Current; Section section = new Section(); section.Heading = sectionDataRow.section_desc; section.Type = sectionDataRow.section_type; section.SectionId = sectionDataRow.section_id; if (sectionDataRow.Isrepeat_columnsNull() == false) { section.RepeatColumns = sectionDataRow.repeat_columns; } DataTable dtItems = itemTA.GetBySecId(docType.CoId, docType.DeptId, docType.DocId, section.SectionId); if (section.Type == WebConstants.SectionTypes.MULTIPLE_SELECT_LIST) { IEnumerator ieSecDetail = secDetailTA.GetBySecId(docType.CoId, docType.DeptId, section.SectionId).GetEnumerator(); while (ieSecDetail.MoveNext()) { DocumentTemplate.DocumentSectionDetailsEntityRow secDetailDataRow = (DocumentTemplate.DocumentSectionDetailsEntityRow)ieSecDetail.Current; SectionDetail sectionDetail = new SectionDetail(secDetailDataRow.section_detail_id, secDetailDataRow.section_detail_desc, false); foreach (DataRow itemRow in dtItems.Rows) { if (secDetailDataRow.section_detail_id == (int)itemRow["section_detail_id"]) { sectionDetail.Selected = true; break; } } section.Details.Add(sectionDetail); } } if (section.Type == WebConstants.SectionTypes.FREE_TEXT) { foreach(DataRow itemRow in dtItems.Rows) { section.Text += (string)itemRow["item_name"] + "\n"; } } sectionList.Add(section); } }