Continuous Action Summary logic
Added a LazyLoad that passes in the default value
This commit is contained in:
parent
17d4c2b26b
commit
8708d0bbfc
@ -112,29 +112,41 @@ namespace VEPROMS.CSLA.Library
|
||||
OnPropertyChanged("Step_FloatingFoldout");
|
||||
}
|
||||
}
|
||||
//[Category("Step Attributes")]
|
||||
//[DisplayName("Step Continuous Action Summary")]
|
||||
//[RefreshProperties(RefreshProperties.All)]
|
||||
//[Description("Step Continuous Action Summary")]
|
||||
public bool Step_CAS
|
||||
public string Step_CAS
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = _Xp["Step", "ContActSum"];
|
||||
|
||||
//If there is no value to get, then get the parent value (a.k.a. default value).
|
||||
if (s == string.Empty) return false;
|
||||
if (s == "True") return true;
|
||||
return false;
|
||||
//If there is no value in the config, then return null. This will tell us to check the step type and format flag (ExcludeFromContActSum).
|
||||
if (s == string.Empty) return null;
|
||||
return s;
|
||||
}
|
||||
set
|
||||
{
|
||||
string s = _Xp["Step", "ContActSum"];
|
||||
if (value.ToString() == s) return;
|
||||
_Xp["Step", "ContActSum"] = value.ToString();
|
||||
if (value == s) return;
|
||||
_Xp["Step", "ContActSum"] = value;
|
||||
OnPropertyChanged("Step_CAS");
|
||||
}
|
||||
}
|
||||
//// Alternate text to use on the Continuous Action Summary
|
||||
//public string Step_AlternateContActSumText
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// string s = _Xp["Step", "AlternateContActSumText"];
|
||||
// //If there is no value to get, then we use the actual step text
|
||||
// if (s == string.Empty) return null;
|
||||
// return s;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// string s = _Xp["Step", "AlternateContActSumText"];
|
||||
// if (value == s) return;
|
||||
// _Xp["Step", "AlternateContActSumText"] = value;
|
||||
// OnPropertyChanged("Step_AlternateContActSumText");
|
||||
// }
|
||||
//}
|
||||
//[Category("Step Attributes")]
|
||||
//[DisplayName("Step Placekeeper")]
|
||||
//[RefreshProperties(RefreshProperties.All)]
|
||||
|
@ -1511,6 +1511,43 @@ namespace VEPROMS.CSLA.Library
|
||||
StepData sd = sdlist[stepType];
|
||||
return (sd.Type == type);
|
||||
}
|
||||
|
||||
// determine if the the current step should automatically be placed on the Continuous Action Summary
|
||||
// Note, this logic only checks the format setting of the step. We will check the value of the Tag's Check Box later on.
|
||||
public bool IncludeOnContActSum
|
||||
{
|
||||
get
|
||||
{
|
||||
bool includeOnCAS = false;
|
||||
if ((int)MyContent.Type < 20000) return includeOnCAS;
|
||||
int stepType = ((int)MyContent.Type) % 10000;
|
||||
StepDataList sdlist = ActiveFormat.PlantFormat.FormatData.StepDataList;
|
||||
if (stepType > sdlist.MaxIndex)
|
||||
{
|
||||
//Console.WriteLine("IncludeOnContActSum - Error getting type - contentid = {0}", MyContent.ContentID);
|
||||
_MyLog.InfoFormat(string.Format("IncludeOnContActSum - Error getting type - contentid = {0}", MyContent.ContentID));
|
||||
return false;
|
||||
}
|
||||
// By default the PROMS step types that are initally identified as a Continuous Action type will return True,
|
||||
// unless the format flag "ExcludeFromContActSum" is set on that step type
|
||||
StepData sd = sdlist[stepType];
|
||||
switch (stepType)
|
||||
{
|
||||
case 9: // Continuous Action High Level Step
|
||||
case 44: // Continuous Action Sequential sub-step
|
||||
case 45: // Continuous Action AND sub-step
|
||||
case 46: // Continuous Action OR sub-step
|
||||
case 47: //Continuous Actoin Paragraph sub-step
|
||||
includeOnCAS = !sd.ExcludeFromContActSum; // if flag is not set then Automatically include this step/sub-step on the Continuous Action Summary
|
||||
break;
|
||||
default:
|
||||
includeOnCAS = !sd.ExcludeFromContActSum; //false; // don't automatically include this step/sub-step on the Continuous Action Summary
|
||||
break;
|
||||
}
|
||||
return includeOnCAS;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCautionOrNotePart
|
||||
{
|
||||
get
|
||||
|
@ -3792,6 +3792,14 @@ namespace VEPROMS.CSLA.Library
|
||||
return (_TableOfContentsData == null ? _TableOfContentsData = new TableOfContentsData(SelectSingleNode("TableOfContentsData")) : _TableOfContentsData);
|
||||
}
|
||||
}
|
||||
private ConitnuousActionSummaryData _ContinuousActionSummaryData;
|
||||
public ConitnuousActionSummaryData ContinuousActionSummaryData
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_ContinuousActionSummaryData == null? _ContinuousActionSummaryData = new ConitnuousActionSummaryData(SelectSingleNode("ConitnuousActionSummaryData")) : _ContinuousActionSummaryData);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region TableOfContentsData
|
||||
@ -3889,6 +3897,28 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region ConitnuousActionSummary
|
||||
public class ConitnuousActionSummaryData : vlnFormatItem
|
||||
{
|
||||
public ConitnuousActionSummaryData(XmlNode xmlNode) : base(xmlNode) { }
|
||||
private LazyLoad<bool> _IncludeSectionNumAndTitle;
|
||||
public bool IncludeSectionNumAndTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _IncludeSectionNumAndTitle, "@IncludeSectionNumAndTitle");
|
||||
}
|
||||
}
|
||||
private VE_Font _Font;
|
||||
public VE_Font Font
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Font == null) ? _Font = new VE_Font(base.XmlNode) : _Font;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
#region MetaSectionAll
|
||||
#region MetaSection
|
||||
@ -4690,6 +4720,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
return string.Format("{0}", Type);
|
||||
}
|
||||
private LazyLoad<bool> _ExcludeFromContActSum;
|
||||
public bool ExcludeFromContActSum
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _ExcludeFromContActSum, "@ExcludeFromContActSum", true); // the default setting is true (as is yes, dont include on Continuous Action Summary)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region StepDataList
|
||||
|
@ -353,6 +353,21 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
return xn != null && xn.InnerText.ToUpper() == "TRUE";
|
||||
}
|
||||
// a LaxyLoad that allows you to pass in the default setting
|
||||
public bool LazyLoad(ref LazyLoad<bool> ll, string xPath, bool defaultReturn)
|
||||
{
|
||||
if (ll == null)
|
||||
{
|
||||
XmlNode xn = SelectSingleNode(xPath);
|
||||
ll = new LazyLoad<bool>(RetrieveBool(xn, defaultReturn));
|
||||
}
|
||||
return ll.Value;
|
||||
}
|
||||
// if nothing is set for this node, then use the passed in default value
|
||||
protected static bool RetrieveBool(XmlNode xn, bool defaultReturn)
|
||||
{
|
||||
return (xn != null) ? xn.InnerText.ToUpper() == "TRUE" : defaultReturn;
|
||||
}
|
||||
public string LazyLoad(ref LazyLoad<string> ll, string xPath)
|
||||
{
|
||||
if (ll == null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user