C2016-020: Enhanced tabs use source tab and if not linked use ‘NA’. This replaces using ordinal for tab for enhanced tabs

This commit is contained in:
Kathy Ruffing 2016-06-15 14:27:10 +00:00
parent e4573a6880
commit 324bc4aa30

View File

@ -3008,6 +3008,16 @@ namespace VEPROMS.CSLA.Library
{
get { return this.MyContent.ContentPartCount > 0; }
}
public bool HasEnhancedLinkedStep
{
get
{
if (!IsStep) return false;
StepConfig sc = MyConfig as StepConfig;
if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count > 0 && sc.MyEnhancedDocuments[0].Type != 0) return true;
return false;
}
}
public bool HasWordContent
{
get { return this.MyContent.MyEntry != null; }
@ -3334,6 +3344,34 @@ namespace VEPROMS.CSLA.Library
_TagsSetup = true;
}
}
public string LinkedTab
{
get
{
EnhancedDocuments eds = GetMyEnhancedDocuments();
if (eds != null && eds.Count == 1 && eds[0].Type == 0)
{
ItemInfo srcItem = ItemInfo.Get(eds[0].ItemID);
return srcItem.MyTab.ToString();
}
return null;
}
}
public int? LinkedOrdinal
{
get
{
EnhancedDocuments eds = GetMyEnhancedDocuments();
if (eds != null && eds.Count == 1 && eds[0].Type == 0)
{
ItemInfo srcItem = ItemInfo.Get(eds[0].ItemID);
return srcItem.Ordinal;
}
return null;
}
}
[NonSerialized]
protected MetaTag _MyHeader;
public MetaTag MyHeader
@ -3411,16 +3449,19 @@ namespace VEPROMS.CSLA.Library
if (((ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) ||
((ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations))
{
// LinkedOrdinal & LinkedTab (in code below) are tabs from the source and account for unlinked steps. See C2016-020 and other
// references to these properties.
if (tbformat.Contains("{LNK C/N Num}"))
{
tbformat = tbformat.Replace("{LNK C/N Num}", Ordinal.ToString());
tbformat = tbformat.Replace("{LNK Step Num}", (ActiveParent as ItemInfo).Ordinal.ToString());
string tb = (LinkedOrdinal==null)? "NA" : LinkedOrdinal.ToString();
tbformat = tbformat.Replace("{LNK C/N Num}", tb);
tbformat = tbformat.Replace("{LNK Step Num}", (ActiveParent as ItemInfo).LinkedTab.Trim(" .".ToCharArray())); //(ActiveParent as ItemInfo).Ordinal.ToString());
tbformat = tbformat.TrimStart(" ".ToCharArray());
}
if (tbformat.Contains("{LNK Step Num}"))
tbformat = tbformat.Replace("{LNK Step Num}", Ordinal.ToString().PadLeft(2));
tbformat = tbformat.Replace("{LNK Step Num}", LinkedTab==null?"NA":LinkedTab.Trim(" .".ToCharArray()).PadLeft(2));//Ordinal.ToString().PadLeft(2));
if (tbformate != null && tbformate.Contains("{LNK Step Num}"))
tbformate = tbformate.Replace("{LNK Step Num}", Ordinal.ToString());
tbformate = tbformate.Replace("{LNK Step Num}", LinkedTab == null ? "NA" : LinkedTab.Trim(" .".ToCharArray()).PadLeft(2));//Ordinal.ToString());
}
if (tbformat.Contains("{indent}")) // Robinson Background format CPBCK
tbformat = tbformat.Substring(8); // we just need to remove the "{indent}" and leave the spaces
@ -3655,7 +3696,24 @@ namespace VEPROMS.CSLA.Library
}
bool isAlpha = tbformat.ToUpper().Contains("ALPHA");
int ordinal = Ordinal;
string alpha = AlphabeticalNumbering(ordinal);
bool useLinked = false; // if this is enhanced, and the LinkedTab isn't numeric, flag to use 'LinkedTab' for the tab.
if (MyActiveSection.IsEnhancedSection)
{
if (IsEnhancedStep)
try
{
ordinal = int.Parse("0" + LinkedTab ?? "0");
}
catch (Exception ex)
{
// use LinkedTab and don't do the AlphabeticalNumbering below. LinkedTab had alpha chars
useLinked = true;
}
else
ordinal = 0;
}
string alpha = useLinked?LinkedTab.Trim():AlphabeticalNumbering(ordinal);
tbformat = tbformat.Replace("{alpha}", alpha.ToLower());
tbformat = tbformat.Replace("{alphaWpar}", alpha.ToLower());
if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && tbformat.Contains("{ALPHA}") && alpha.Length > 1)
@ -3681,12 +3739,24 @@ namespace VEPROMS.CSLA.Library
// otherwise add a space.
if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat && IsBackgroundStep())
{
string stpTab = (!tbformat.Contains(".") ? " " : "") + ordinal.ToString();
string stpTab = null;
if (useLinked)
stpTab = (!tbformat.Contains(".") ? " " : "") + ((ordinal == 0) ? "NA" : LinkedTab);
else
stpTab = (!tbformat.Contains(".") ? " " : "") + ((ordinal == 0) ? "NA" : ordinal.ToString());
tbformat = tbformat.Replace("{numeric}", stpTab);
}
else
tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
if (tbformate != null) tbformate = tbformate.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
if (tbformate != null)
{
if (useLinked)
tbformate = tbformate.Replace("{numeric}", LinkedTab.Trim(" .".ToCharArray()).PadLeft(2));
if (tbformat.Contains("NA") && ordinal == 0)
tbformate = tbformate.Replace("{numeric}", "NA");
else
tbformate = tbformate.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
}
tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString());
if (tbformat.Contains("{asterisk}"))
{
@ -4746,6 +4816,10 @@ namespace VEPROMS.CSLA.Library
{
MyFont = font;
}
public override string ToString()
{
return this.CleanTextNoSymbols;
}
public int Offset;
public int Position;