From d8f76dcbd3e20a515362eb8ac12ed47d494c5727 Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 2 Aug 2011 19:40:35 +0000 Subject: [PATCH] Make the change list the default selected tab If WalkProcedure or Update History is called with a null, reset the contents and return Fix the section title --- .../Volian.Controls.Library/DisplayHistory.cs | 13 ++++++++++- .../PDFChronologyReport.cs | 22 +++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplayHistory.cs b/PROMS/Volian.Controls.Library/DisplayHistory.cs index 90789941..9bae76fc 100644 --- a/PROMS/Volian.Controls.Library/DisplayHistory.cs +++ b/PROMS/Volian.Controls.Library/DisplayHistory.cs @@ -98,6 +98,7 @@ namespace Volian.Controls.Library { InitializeComponent(); myRTB.FormatFont = null; + tabControl1.SelectedTab = tabItem1;// Start with Change List } private void lbChanges_SelectedIndexChanged(object sender, EventArgs e) @@ -126,7 +127,11 @@ namespace Volian.Controls.Library myRTB.Clear(); myVFG.Clear(); tvAudits.Nodes.Clear(); - if (MyItemInfo == null) return; + if (MyItemInfo == null) + { + this.Cursor = Cursors.Default; + return; + } MyItemInfo.RefreshItemAnnotations(); #endregion //if (AnnotationOnly) @@ -385,6 +390,12 @@ namespace Volian.Controls.Library DateTime start = DateTime.Now; Console.WriteLine(start); lbChanges.Items.Clear(); + if (MyProcedureInfo == null) + { + this.Cursor = Cursors.Default; + btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = lbChanges.Items.Count > 0; + return; + } ContentAuditInfoList cail2 = ContentAuditInfoList.GetChronology(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID, false); Console.WriteLine("WalkProcedure cail2: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds); _ChronologyAuditList = cail2; diff --git a/PROMS/Volian.Print.Library/PDFChronologyReport.cs b/PROMS/Volian.Print.Library/PDFChronologyReport.cs index b50c739b..f26b54f0 100644 --- a/PROMS/Volian.Print.Library/PDFChronologyReport.cs +++ b/PROMS/Volian.Print.Library/PDFChronologyReport.cs @@ -205,7 +205,7 @@ namespace Volian.Print.Library foreach (ContentAuditInfo cai in AuditList) { //raw path - string[] NewPath = Regex.Replace(cai.Path + "\x7\x7\x7", "^..+?\\u0007.", "").Split("\x7".ToCharArray()); + string[] NewPath = SplitPath(cai.Path); if (NewPath[0] != section) { section = NewPath[0]; @@ -530,18 +530,26 @@ namespace Volian.Print.Library } doc.Add(t); } + private static string[] SplitPath(string path) + { + // Remove Procedure Number and Title + string sectionAndStep = Regex.Replace(path + "\x7\x7\x7", "^.+?\\u0007", ""); + sectionAndStep = sectionAndStep.Replace("\x11", sectionAndStep[0] == '\x11' ? "" : " - "); + // Split Section frrom Steps + return sectionAndStep.Split("\x7".ToCharArray()); + } private string[] GetNewPath(ContentAuditInfoList AuditList, int contentID) { foreach (ContentAuditInfo cai in AuditList) { if(cai.ContentID == contentID) - return Regex.Replace(cai.Path + "\x7\x7\x7", "^..+?\\u0007.", "").Split("\x7".ToCharArray()); + return SplitPath(cai.Path); } ItemInfoList iil = ItemInfoList.GetByContentID(contentID); if (iil.Count > 0) { - return Regex.Replace(iil[0].SearchPath + "\x7\x7\x7", "^..+?\\u0007.", "").Split("\x7".ToCharArray()); + return SplitPath(iil[0].SearchPath); } return "Section\x7Step".Split("\x7".ToCharArray()); } @@ -555,7 +563,7 @@ namespace Volian.Print.Library List auditList = new List(); foreach (ContentAuditInfo cai in AuditList) { - string[] NewPath = Regex.Replace(cai.Path + "\x7\x7\x7", "^..+?\\u0007.", "").Split("\x7".ToCharArray()); + string[] NewPath = SplitPath(cai.Path); if (NewPath[1] != stepnum) { stepnum = NewPath[1]; @@ -680,7 +688,7 @@ namespace Volian.Print.Library foreach (ContentAuditInfo cai in auditList) { //raw path - string[] NewPath = Regex.Replace(cai.Path + "\x7\x7\x7", "^..+?\\u0007.", "").Split("\x7".ToCharArray()); + string[] NewPath = SplitPath(cai.Path); if (NewPath[0] != section) { section = NewPath[0]; @@ -787,7 +795,7 @@ namespace Volian.Print.Library { if (cai.ContentID == aai.IContentID) { - string[] NewPath = Regex.Replace(cai.Path + "\x7\x7\x7", "^..+?\\u0007.", "").Split("\x7".ToCharArray()); + string[] NewPath = SplitPath(cai.Path); if (NewPath[1] != stepnum) { stepnum = NewPath[1]; @@ -1017,7 +1025,7 @@ namespace Volian.Print.Library foreach (ContentAuditInfo cai in auditList) { //raw path - string[] NewPath = Regex.Replace(cai.Path + "\x7\x7\x7", "^..+?\\u0007.", "").Split("\x7".ToCharArray()); + string[] NewPath = SplitPath(cai.Path); if (NewPath[0] != section) { section = NewPath[0];