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,13 +2193,18 @@ namespace Volian.Controls.Library
ICollection<ItemInfo> myList = lbSrchResults.DataSource as ICollection<ItemInfo>;
StringBuilder sb = new StringBuilder();
sb.Append("\"Location\"\t\"Type\"\t\"Text\"\t\"High-Level\"\t\"Annotations\"");
List<int> ItemsProcessed = new List<int>();
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());

View File

@ -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<int> processedItems = new List<int>();
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);
}
}
}
}