Fixed an Argument Exception error in the Chronology of Changes Report. Also cleaned up the output of the Chronology and Summary of changes reports.

This commit is contained in:
John Jenko 2015-08-03 15:52:46 +00:00
parent 0e255bc3d8
commit 8f379f0b9b

View File

@ -273,6 +273,12 @@ namespace Volian.Print.Library
stepnum = NewPath[1]; stepnum = NewPath[1];
string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2");
stepnum2 = stepnum2.Replace("RNO.", "RNO"); stepnum2 = stepnum2.Replace("RNO.", "RNO");
// check to see if we have step number to output
// if not just put in a blank cell.
// this cleans up the report so that we don't have "Step" without anything after it.
// This was happening when we were reporting change information of a section number/title
if (stepnum2 != "")
{
h = new Phrase(); h = new Phrase();
h.Font = f3; h.Font = f3;
h.Add(string.Format("Step {0}", stepnum2)); h.Add(string.Format("Step {0}", stepnum2));
@ -286,6 +292,9 @@ namespace Volian.Print.Library
} }
else else
t.AddCell(BlankCell(1)); t.AddCell(BlankCell(1));
}
else
t.AddCell(BlankCell(1));
//what //what
if (cai.ContentID != lastID) maxDTS = DateTime.MinValue; if (cai.ContentID != lastID) maxDTS = DateTime.MinValue;
h = new Phrase(); h = new Phrase();
@ -415,6 +424,7 @@ namespace Volian.Print.Library
} }
h.Add(txt); h.Add(txt);
} }
oldCAI = cai;
oldText = cai.Text; oldText = cai.Text;
oldTypeName = cai.TypeName; oldTypeName = cai.TypeName;
c = new PdfPCell(h); c = new PdfPCell(h);
@ -441,6 +451,7 @@ namespace Volian.Print.Library
{ {
//add annotation to minilist //add annotation to minilist
// processedAAI.Add(aai.AnnotationID, aai); // processedAAI.Add(aai.AnnotationID, aai);
if (!processedAAI.ContainsKey(aai)) // bug fix, only add to the processed list if it is not already in the list
processedAAI.Add(aai, aai); processedAAI.Add(aai, aai);
//write row to table //write row to table
t.AddCell(BlankCell(1)); t.AddCell(BlankCell(1));
@ -1260,6 +1271,8 @@ namespace Volian.Print.Library
} }
} }
} }
if (caiFirst != null) //ciaFirst could end up being null at the end of the above foreach loop
auditList2.Add(caiFirst);
int cols = 5; int cols = 5;
int borders = 0; int borders = 0;
int paddingBottom = 6; int paddingBottom = 6;
@ -1383,6 +1396,12 @@ namespace Volian.Print.Library
stepnum = NewPath[1]; stepnum = NewPath[1];
string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2");
stepnum2 = stepnum2.Replace("RNO.", "RNO"); stepnum2 = stepnum2.Replace("RNO.", "RNO");
// check to see if we have step number to output
// if not just put in a blank cell.
// this cleans up the report so that we don't have "Step" without anything after it.
// This was happening when we were reporting change information of a section number/title
if (stepnum2 != "")
{
h = new Phrase(); h = new Phrase();
h.Font = f3; h.Font = f3;
h.Add(string.Format("Step {0}", stepnum2)); h.Add(string.Format("Step {0}", stepnum2));
@ -1394,6 +1413,9 @@ namespace Volian.Print.Library
//c.Border = borders; //c.Border = borders;
t.AddCell(c); t.AddCell(c);
} }
else
t.AddCell(BlankCell(1));
}
else else
{ {
t.AddCell(BlankCell(1)); t.AddCell(BlankCell(1));
@ -1478,7 +1500,47 @@ namespace Volian.Print.Library
else if (cai.Text == oldText && cai.TypeName != oldTypeName) else if (cai.Text == oldText && cai.TypeName != oldTypeName)
h.Add(oldTypeName + " to " + cai.TypeName); h.Add(oldTypeName + " to " + cai.TypeName);
else else
h.Add(ItemInfo.ConvertToDisplayText(cai.Text)); {
string txt = ItemInfo.ConvertToDisplayText(cai.Text);
// Add Parent/Child information if applicable
// We were doing this for the Chronology report so I added the same logic here for the Summary report
if (MyProc.MyDocVersion.MultiUnitCount > 1)
{
System.Xml.XmlNode nd;
if (cai.Config == string.Empty)
nd = null;
else
{
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
xd.LoadXml(cai.Config);
nd = xd.SelectSingleNode("//MasterSlave");
}
if (nd == null)
txt += "\r\n\r\nApplicable to all units";
else
{
nd = nd.Attributes.GetNamedItem("Applicability");
if (nd.InnerText == "0")
txt += "\r\n\r\nApplicable to no units";
else
{
int k = MyProc.MyDocVersion.DocVersionConfig.SelectedSlave;
string[] myss = nd.InnerText.Split(",".ToCharArray());
string un = "\r\n\r\nApplicable to ";
string sep = string.Empty;
foreach (string ss in myss)
{
MyProc.MyDocVersion.DocVersionConfig.SelectedSlave = int.Parse(ss);
un += sep + MyProc.MyDocVersion.DocVersionConfig.Unit_Name;
sep = ",";
}
txt += un;
MyProc.MyDocVersion.DocVersionConfig.SelectedSlave = k;
}
}
}
h.Add(txt);
}
oldText = cai.Text; oldText = cai.Text;
oldTypeName = cai.TypeName; oldTypeName = cai.TypeName;
// h.Add(ItemInfo.ConvertToDisplayText(cai.Text) + " " + cai.TypeName); // h.Add(ItemInfo.ConvertToDisplayText(cai.Text) + " " + cai.TypeName);