Added code to make Summary of Changes report the same as the 16-bit Summary of Changes Report

This commit is contained in:
Rich 2013-09-12 19:24:59 +00:00
parent cfb8e68c9f
commit 54db0e1e81

View File

@ -1007,7 +1007,7 @@ namespace Volian.Print.Library
ContentAuditInfo firstCAI = null; ContentAuditInfo firstCAI = null;
ContentAuditInfo nextCAI = null; ContentAuditInfo nextCAI = null;
ContentAuditInfo lastCAI = null; ContentAuditInfo lastCAI = null;
List<ContentAuditInfo> auditList = new List<ContentAuditInfo>(); List<ContentAuditInfo> auditList1 = new List<ContentAuditInfo>();
foreach (ContentAuditInfo cai in AuditList) foreach (ContentAuditInfo cai in AuditList)
{ {
if (MyProc.MyLookup == null || MyProc.MyLookup.ContainsKey(cai.ItemID)) if (MyProc.MyLookup == null || MyProc.MyLookup.ContainsKey(cai.ItemID))
@ -1018,7 +1018,7 @@ namespace Volian.Print.Library
{ {
if (lastCAI == null) if (lastCAI == null)
{ {
auditList.Add(firstCAI); auditList1.Add(firstCAI);
firstCAI = null; firstCAI = null;
} }
else else
@ -1032,15 +1032,15 @@ namespace Volian.Print.Library
//this step was originally commented out, then jcb un commented it, but we saw a summary report that had 2 added rows //this step was originally commented out, then jcb un commented it, but we saw a summary report that had 2 added rows
//for the same step which is highly undesirable, so we commented it out again 1/17/2012 //for the same step which is highly undesirable, so we commented it out again 1/17/2012
//for example we added 2 steps, then make a change to 1st step added //for example we added 2 steps, then make a change to 1st step added
//auditList.Add(firstCAI); //jcb uncommented auditList1.Add(firstCAI); //jcb uncommented
auditList.Add(lastCAI); auditList1.Add(lastCAI);
firstCAI = null; firstCAI = null;
lastCAI = null; lastCAI = null;
} }
else if (firstCAI.ActionWhat == lastCAI.ActionWhat) else if (firstCAI.ActionWhat == lastCAI.ActionWhat)
{ {
auditList.Add(firstCAI); auditList1.Add(firstCAI);
auditList.Add(lastCAI); auditList1.Add(lastCAI);
firstCAI = null; firstCAI = null;
lastCAI = null; lastCAI = null;
} }
@ -1059,7 +1059,7 @@ namespace Volian.Print.Library
else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Changed" && firstCAI.DTS > MyProc.ChangeBarDate) else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Changed" && firstCAI.DTS > MyProc.ChangeBarDate)
{ {
lastCAI.ActionWhat = firstCAI.ActionWhat; lastCAI.ActionWhat = firstCAI.ActionWhat;
auditList.Add(lastCAI); auditList1.Add(lastCAI);
firstCAI = null; firstCAI = null;
lastCAI = null; lastCAI = null;
} }
@ -1084,7 +1084,7 @@ namespace Volian.Print.Library
if (lastCAI == null) if (lastCAI == null)
{ {
if (firstCAI != null) if (firstCAI != null)
auditList.Add(firstCAI); auditList1.Add(firstCAI);
firstCAI = null; firstCAI = null;
} }
else else
@ -1095,15 +1095,15 @@ namespace Volian.Print.Library
{ {
if (firstCAI.DTS > MyProc.ChangeBarDate) if (firstCAI.DTS > MyProc.ChangeBarDate)
lastCAI.ActionWhat = firstCAI.ActionWhat; lastCAI.ActionWhat = firstCAI.ActionWhat;
//auditList.Add(firstCAI); auditList1.Add(firstCAI);
auditList.Add(lastCAI); auditList1.Add(lastCAI);
firstCAI = null; firstCAI = null;
lastCAI = null; lastCAI = null;
} }
else if (firstCAI.ActionWhat == lastCAI.ActionWhat) else if (firstCAI.ActionWhat == lastCAI.ActionWhat)
{ {
auditList.Add(firstCAI); auditList1.Add(firstCAI);
auditList.Add(lastCAI); auditList1.Add(lastCAI);
firstCAI = null; firstCAI = null;
lastCAI = null; lastCAI = null;
} }
@ -1124,7 +1124,7 @@ namespace Volian.Print.Library
else if (lastCAI.ActionWhat != "Deleted") else if (lastCAI.ActionWhat != "Deleted")
{ {
lastCAI.ActionWhat = firstCAI.ActionWhat; lastCAI.ActionWhat = firstCAI.ActionWhat;
auditList.Add(lastCAI); auditList1.Add(lastCAI);
lastCAI = null; lastCAI = null;
} }
@ -1223,6 +1223,28 @@ namespace Volian.Print.Library
//if (lastAAI != null) //if (lastAAI != null)
// annotationList.Add(lastAAI); // annotationList.Add(lastAAI);
#endregion #endregion
//new final cleanup
List<ContentAuditInfo> auditList2 = new List<ContentAuditInfo>();
ContentAuditInfo caiFirst = null;
foreach (ContentAuditInfo cai in auditList1)
{
if (caiFirst == null)
caiFirst = cai;
else
{
if (cai.ContentID == caiFirst.ContentID && cai.Text != caiFirst.Text)
{
if (caiFirst.ActionWhat == "Added" && (cai.ActionWhat == "Added" || cai.ActionWhat == "Restored"))
auditList2.Add(cai);
else
{
auditList2.Add(caiFirst);
auditList2.Add(cai);
}
}
caiFirst = null;
}
}
int cols = 5; int cols = 5;
int borders = 0; int borders = 0;
int paddingBottom = 6; int paddingBottom = 6;
@ -1264,7 +1286,7 @@ namespace Volian.Print.Library
string oldTypeName = string.Empty; string oldTypeName = string.Empty;
// Dictionary<long, AnnotationAuditInfo> processedAAI = new Dictionary<long, AnnotationAuditInfo>(); // Dictionary<long, AnnotationAuditInfo> processedAAI = new Dictionary<long, AnnotationAuditInfo>();
Dictionary<AnnotationAuditInfo, AnnotationAuditInfo> processedAAI = new Dictionary<AnnotationAuditInfo, AnnotationAuditInfo>(); Dictionary<AnnotationAuditInfo, AnnotationAuditInfo> processedAAI = new Dictionary<AnnotationAuditInfo, AnnotationAuditInfo>();
foreach (ContentAuditInfo cai in auditList) foreach (ContentAuditInfo cai in auditList2)
{ {
//raw path //raw path
string[] NewPath = SplitPath(cai.Path); string[] NewPath = SplitPath(cai.Path);