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
This commit is contained in:
Rich 2011-08-02 19:40:35 +00:00
parent 7ec5ca5555
commit d8f76dcbd3
2 changed files with 27 additions and 8 deletions

View File

@ -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;

View File

@ -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<ContentAuditInfo> auditList = new List<ContentAuditInfo>();
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];