From ff47bd858ba8d7db5fde75c1030335f5e5f1c4a0 Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 12 Apr 2017 14:48:11 +0000 Subject: [PATCH] Fixed logic to Copy Search Results to eliminate duplicate steps in the results Fixed logic to Print Search Results to eliminate duplicate steps in the results Fixed logic to prooperly output the procedure number and title --- .../Volian.Controls.Library/DisplaySearch.cs | 15 +++-- PROMS/Volian.Print.Library/PDFReport.cs | 66 ++++++++++--------- 2 files changed, 46 insertions(+), 35 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 375ca0ed..ebc2255d 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -2193,13 +2193,18 @@ namespace Volian.Controls.Library ICollection myList = lbSrchResults.DataSource as ICollection; StringBuilder sb = new StringBuilder(); sb.Append("\"Location\"\t\"Type\"\t\"Text\"\t\"High-Level\"\t\"Annotations\""); + List ItemsProcessed = new List(); foreach (ItemInfo myItem in myList) { - sb.Append(string.Format("\r\n\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"", myItem.ShortPath, myItem.ToolTip, - myItem.DisplayText, !myItem.IsSection && !myItem.IsHigh ? (myItem.MyHLS == null ? "" : myItem.MyHLS.DisplayText) : "")); - if (myItem.ItemAnnotationCount > 0) - foreach (AnnotationInfo myAnnotation in myItem.ItemAnnotations) - sb.Append(string.Format("\t\"{0}\"", myAnnotation.SearchText)); + if (!ItemsProcessed.Contains(myItem.ItemID)) + { + ItemsProcessed.Add(myItem.ItemID); + sb.Append(string.Format("\r\n\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"", myItem.ShortPath, myItem.ToolTip, + myItem.DisplayText, !myItem.IsSection && !myItem.IsHigh ? (myItem.MyHLS == null ? "" : myItem.MyHLS.DisplayText) : "")); + if (myItem.ItemAnnotationCount > 0) + foreach (AnnotationInfo myAnnotation in myItem.ItemAnnotations) + sb.Append(string.Format("\t\"{0}\"", myAnnotation.SearchText)); + } } Clipboard.Clear(); Clipboard.SetText(sb.ToString()); diff --git a/PROMS/Volian.Print.Library/PDFReport.cs b/PROMS/Volian.Print.Library/PDFReport.cs index e7f30f2c..697908b8 100644 --- a/PROMS/Volian.Print.Library/PDFReport.cs +++ b/PROMS/Volian.Print.Library/PDFReport.cs @@ -404,6 +404,7 @@ namespace Volian.Print.Library { if (document.IsOpen()) { + document.Add(new Phrase("End of Search Results",FontFactory.GetFont("Arial",4))); document.Close(); System.Diagnostics.Process.Start(_FileName); } @@ -520,40 +521,45 @@ namespace Volian.Print.Library PdfPTable subTable = new PdfPTable(headerwidths); string lastProcNum = ""; string lastDVPath = ""; + List processedItems = new List(); foreach (ItemInfo item in _ResultList) { - if (lastDVPath != item.SearchDVPath) + if (!processedItems.Contains(item.ItemID)) { - datatable.AddCell(subTable); - subTable = new PdfPTable(headerwidths); - AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); - datatable.AddCell(colHeader); - lastProcNum = ""; - } - lastDVPath = item.SearchDVPath; - string curProcNum = GetCurProcNum(item.SearchPath); - if (lastProcNum != "" && curProcNum != lastProcNum) - { - datatable.AddCell(subTable); - subTable = new PdfPTable(headerwidths); - } - lastProcNum = curProcNum; - string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, true, new Color(0xC0, 0xFF, 0xC0), true); - lastPath = item.SearchPath ?? item.ShortPath; - stepPath = BuildStepTab(item); - AddCell(subTable, stepPath, f2, (item.IsSection ? SectColor : TextColor)); - // This was for the old 16-bit style of table - jsj 7/7/2011 - //if (item.DisplayText.Contains("|")) // Need a better way to determine if it is a table. - // AddCell(datatable, item.DisplayText, f3, TextColor); - //else - //AddCell(datatable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor)); - AddCell(subTable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor)); - if (ShowAnnotations && item.ItemAnnotationCount > 0) - { - foreach (AnnotationInfo ai in item.ItemAnnotations) + processedItems.Add(item.ItemID); + if (lastDVPath != item.SearchDVPath) { - AddCell(subTable, ai.MyAnnotationType.Name, f2, AnnoColor); - AddCell(subTable, ai.SearchText, f2, AnnoColor); + datatable.AddCell(subTable); + subTable = new PdfPTable(headerwidths); + AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); + datatable.AddCell(colHeader); + lastProcNum = ""; + } + lastDVPath = item.SearchDVPath; + string curProcNum = GetCurProcNum(item.SearchPath); + //if (lastProcNum != "" && curProcNum != lastProcNum) + //{ + datatable.AddCell(subTable); + subTable = new PdfPTable(headerwidths); + //} + lastProcNum = curProcNum; + string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, true, new Color(0xC0, 0xFF, 0xC0), true); + lastPath = item.SearchPath ?? item.ShortPath; + stepPath = BuildStepTab(item); + AddCell(subTable, stepPath, f2, (item.IsSection ? SectColor : TextColor)); + // This was for the old 16-bit style of table - jsj 7/7/2011 + //if (item.DisplayText.Contains("|")) // Need a better way to determine if it is a table. + // AddCell(datatable, item.DisplayText, f3, TextColor); + //else + //AddCell(datatable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor)); + AddCell(subTable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor)); + if (ShowAnnotations && item.ItemAnnotationCount > 0) + { + foreach (AnnotationInfo ai in item.ItemAnnotations) + { + AddCell(subTable, ai.MyAnnotationType.Name, f2, AnnoColor); + AddCell(subTable, ai.SearchText, f2, AnnoColor); + } } } }