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
This commit is contained in:
Rich 2017-04-12 14:48:11 +00:00
parent 499c09b9c0
commit ff47bd858b
2 changed files with 46 additions and 35 deletions

View File

@ -2193,14 +2193,19 @@ namespace Volian.Controls.Library
ICollection<ItemInfo> myList = lbSrchResults.DataSource as ICollection<ItemInfo>; ICollection<ItemInfo> myList = lbSrchResults.DataSource as ICollection<ItemInfo>;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append("\"Location\"\t\"Type\"\t\"Text\"\t\"High-Level\"\t\"Annotations\""); sb.Append("\"Location\"\t\"Type\"\t\"Text\"\t\"High-Level\"\t\"Annotations\"");
List<int> ItemsProcessed = new List<int>();
foreach (ItemInfo myItem in myList) foreach (ItemInfo myItem in myList)
{ {
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, 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) : "")); myItem.DisplayText, !myItem.IsSection && !myItem.IsHigh ? (myItem.MyHLS == null ? "" : myItem.MyHLS.DisplayText) : ""));
if (myItem.ItemAnnotationCount > 0) if (myItem.ItemAnnotationCount > 0)
foreach (AnnotationInfo myAnnotation in myItem.ItemAnnotations) foreach (AnnotationInfo myAnnotation in myItem.ItemAnnotations)
sb.Append(string.Format("\t\"{0}\"", myAnnotation.SearchText)); sb.Append(string.Format("\t\"{0}\"", myAnnotation.SearchText));
} }
}
Clipboard.Clear(); Clipboard.Clear();
Clipboard.SetText(sb.ToString()); Clipboard.SetText(sb.ToString());
MessageBox.Show("Results Copied to Clipboard", "Copy Results", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Results Copied to Clipboard", "Copy Results", MessageBoxButtons.OK, MessageBoxIcon.Information);

View File

@ -404,6 +404,7 @@ namespace Volian.Print.Library
{ {
if (document.IsOpen()) if (document.IsOpen())
{ {
document.Add(new Phrase("End of Search Results",FontFactory.GetFont("Arial",4)));
document.Close(); document.Close();
System.Diagnostics.Process.Start(_FileName); System.Diagnostics.Process.Start(_FileName);
} }
@ -520,8 +521,12 @@ namespace Volian.Print.Library
PdfPTable subTable = new PdfPTable(headerwidths); PdfPTable subTable = new PdfPTable(headerwidths);
string lastProcNum = ""; string lastProcNum = "";
string lastDVPath = ""; string lastDVPath = "";
List<int> processedItems = new List<int>();
foreach (ItemInfo item in _ResultList) foreach (ItemInfo item in _ResultList)
{ {
if (!processedItems.Contains(item.ItemID))
{
processedItems.Add(item.ItemID);
if (lastDVPath != item.SearchDVPath) if (lastDVPath != item.SearchDVPath)
{ {
datatable.AddCell(subTable); datatable.AddCell(subTable);
@ -532,11 +537,11 @@ namespace Volian.Print.Library
} }
lastDVPath = item.SearchDVPath; lastDVPath = item.SearchDVPath;
string curProcNum = GetCurProcNum(item.SearchPath); string curProcNum = GetCurProcNum(item.SearchPath);
if (lastProcNum != "" && curProcNum != lastProcNum) //if (lastProcNum != "" && curProcNum != lastProcNum)
{ //{
datatable.AddCell(subTable); datatable.AddCell(subTable);
subTable = new PdfPTable(headerwidths); subTable = new PdfPTable(headerwidths);
} //}
lastProcNum = curProcNum; lastProcNum = curProcNum;
string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, true, new Color(0xC0, 0xFF, 0xC0), true); string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, true, new Color(0xC0, 0xFF, 0xC0), true);
lastPath = item.SearchPath ?? item.ShortPath; lastPath = item.SearchPath ?? item.ShortPath;
@ -557,6 +562,7 @@ namespace Volian.Print.Library
} }
} }
} }
}
datatable.AddCell(subTable); datatable.AddCell(subTable);
document.Add(datatable); document.Add(datatable);
} }