CSLA Config cleanup
This commit is contained in:
@@ -1,19 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using DescriptiveEnum;
|
||||
using System.Xml;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public partial class EnhancedDocuments : List<EnhancedDocument>
|
||||
{
|
||||
public void Add(int type, int itemID)
|
||||
{
|
||||
Add(new EnhancedDocument(type, itemID));
|
||||
}
|
||||
public static EnhancedDocuments Load(XMLProperties _Xp)
|
||||
public void Add(int type, int itemID) => Add(new EnhancedDocument(type, itemID));
|
||||
public static EnhancedDocuments Load(XMLProperties _Xp)
|
||||
{
|
||||
EnhancedDocuments ed = new EnhancedDocuments();
|
||||
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
|
||||
@@ -31,45 +26,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public partial class EnhancedDocument
|
||||
{
|
||||
private int _Type;
|
||||
public int Type
|
||||
{
|
||||
get { return _Type; }
|
||||
set { _Type = value; }
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
public EnhancedDocument() { ;}
|
||||
public int Type { get; set; }
|
||||
public int ItemID { get; set; }
|
||||
public EnhancedDocument() { ;}
|
||||
public EnhancedDocument(int type, int itemID)
|
||||
{
|
||||
Type = type;
|
||||
ItemID = itemID;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}.ItemID={1}", Type, ItemID);
|
||||
}
|
||||
}
|
||||
public override string ToString() => $"{Type}.ItemID={ItemID}";
|
||||
}
|
||||
[Serializable]
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class StepConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig
|
||||
{
|
||||
#region DynamicTypeDescriptor
|
||||
internal override bool IsReadOnly
|
||||
{
|
||||
get { return false; }//_Section == null; }
|
||||
}
|
||||
#endregion
|
||||
#region XML
|
||||
private XMLProperties _Xp;
|
||||
private XMLProperties Xp
|
||||
{
|
||||
get { return _Xp; }
|
||||
}
|
||||
#region DynamicTypeDescriptor
|
||||
internal override bool IsReadOnly => false;
|
||||
#endregion
|
||||
#region XML
|
||||
private readonly XMLProperties _Xp;
|
||||
#endregion
|
||||
#region Constructors
|
||||
//PROPGRID: Hide ParentLookup
|
||||
@@ -79,18 +54,8 @@ namespace VEPROMS.CSLA.Library
|
||||
get { return _Xp.ParentLookup; }
|
||||
set { _Xp.ParentLookup = value; }
|
||||
}
|
||||
//PROPGRID: Had to comment out NonSerialized to hide AncestorLookup from Property Grid
|
||||
//[NonSerialized]
|
||||
//private bool _AncestorLookup;
|
||||
////PROPGRID: Hide AncestorLookup
|
||||
//[Browsable(false)]
|
||||
//public bool AncestorLookup
|
||||
//{
|
||||
// get { return _AncestorLookup; }
|
||||
// set { _AncestorLookup = value; }
|
||||
//}
|
||||
private Step _Step;
|
||||
private StepInfo _StepInfo;
|
||||
private readonly Step _Step;
|
||||
private readonly StepInfo _StepInfo;
|
||||
public StepConfig(Step step)
|
||||
{
|
||||
_Step = step;
|
||||
@@ -111,47 +76,36 @@ namespace VEPROMS.CSLA.Library
|
||||
_Xp = new XMLProperties(xml);
|
||||
|
||||
}
|
||||
public StepConfig()
|
||||
{
|
||||
_Xp = new XMLProperties();
|
||||
}
|
||||
internal string GetValue(string group, string item)
|
||||
{
|
||||
return _Xp[group, item];
|
||||
}
|
||||
#endregion
|
||||
#region Local Properties
|
||||
|
||||
#endregion
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
public StepConfig() => _Xp = new XMLProperties();
|
||||
internal string GetValue(string group, string item) => _Xp[group, item];
|
||||
#endregion
|
||||
#region Local Properties
|
||||
|
||||
#endregion
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
string s = _Xp.ToString();
|
||||
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
|
||||
return s;
|
||||
}
|
||||
#endregion
|
||||
#region StepAttr
|
||||
//[Category("Step Attributes")]
|
||||
//[DisplayName("Step Floating Foldout Association")]
|
||||
//[RefreshProperties(RefreshProperties.All)]
|
||||
//[Description("Step Floating Foldout Association")]
|
||||
public int Step_FloatingFoldout
|
||||
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
|
||||
}
|
||||
#endregion
|
||||
#region StepAttr
|
||||
public int Step_FloatingFoldout
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = _Xp["Step", "FloatingFoldout"];
|
||||
if (s == string.Empty) return 0;
|
||||
int tst = 0;
|
||||
try
|
||||
int tst;
|
||||
try
|
||||
{
|
||||
tst = int.Parse(s);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
catch (Exception)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return int.Parse(s);
|
||||
return tst;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -196,28 +150,6 @@ namespace VEPROMS.CSLA.Library
|
||||
OnPropertyChanged("Step_TCAS");
|
||||
}
|
||||
}
|
||||
//// 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)]
|
||||
//[Description("Step Placekeeper")]
|
||||
public string Step_Placekeeper
|
||||
{
|
||||
get
|
||||
@@ -236,10 +168,6 @@ namespace VEPROMS.CSLA.Library
|
||||
OnPropertyChanged("Step_Placekeeper");
|
||||
}
|
||||
}
|
||||
//[Category("Step Attributes")]
|
||||
//[DisplayName("Step Check Off Index")]
|
||||
//[RefreshProperties(RefreshProperties.All)]
|
||||
//[Description("Step Check Off Index")]
|
||||
public int Step_CheckOffIndex
|
||||
{
|
||||
get
|
||||
@@ -248,24 +176,14 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
if (s == string.Empty) return 0;
|
||||
|
||||
// there was an invalid character for Wolf Creek's index. just return
|
||||
// a 0 if found. The dataloader was fixed (6/8/12) to not migrate the
|
||||
// bad character, but this was added, in case there are some other conditions.
|
||||
int tst = 0;
|
||||
if(int.TryParse(s,out tst))
|
||||
return tst;
|
||||
tst = (int) s[0];
|
||||
// there was an invalid character for Wolf Creek's index. just return
|
||||
// a 0 if found. The dataloader was fixed (6/8/12) to not migrate the
|
||||
// bad character, but this was added, in case there are some other conditions.
|
||||
if (int.TryParse(s, out int tst))
|
||||
return tst;
|
||||
tst = (int) s[0];
|
||||
tst -= '0';
|
||||
return tst;
|
||||
//try
|
||||
//{
|
||||
// tst = int.Parse(s);
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// return 0;
|
||||
//}
|
||||
//return int.Parse(s);
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -275,10 +193,6 @@ namespace VEPROMS.CSLA.Library
|
||||
OnPropertyChanged("Step_CheckOffIndex");
|
||||
}
|
||||
}
|
||||
//[Category("Step Attributes")]
|
||||
//[DisplayName("Step Manual Pagebreak")]
|
||||
//[RefreshProperties(RefreshProperties.All)]
|
||||
//[Description("Step Manual Pagebreak")]
|
||||
public bool Step_ManualPagebreak
|
||||
{
|
||||
get
|
||||
@@ -352,10 +266,6 @@ namespace VEPROMS.CSLA.Library
|
||||
OnPropertyChanged("Step_SubStepPagebreak");
|
||||
}
|
||||
}
|
||||
//[Category("Step Attributes")]
|
||||
//[DisplayName("Step Change Bar Override")]
|
||||
//[RefreshProperties(RefreshProperties.All)]
|
||||
//[Description("Step Change Bar Override")]
|
||||
public string Step_CBOverride
|
||||
{
|
||||
get
|
||||
@@ -440,10 +350,6 @@ namespace VEPROMS.CSLA.Library
|
||||
OnPropertyChanged("Step_Responsibility");
|
||||
}
|
||||
}
|
||||
//[Category("Step Attributes")]
|
||||
//[DisplayName("Step Change By Spell Checker")]
|
||||
//[RefreshProperties(RefreshProperties.All)]
|
||||
//[Description("Step Change By Spell Checker")]
|
||||
// When the spell checker changes text do not assign a change bar but keep existing change bar if it is there
|
||||
public string Step_SpellCheckerChangedText
|
||||
{
|
||||
@@ -557,16 +463,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
string s = _Xp["Step", "ImageWidth"];
|
||||
if (s == string.Empty) return 0;
|
||||
int tst = 0;
|
||||
try
|
||||
int tst;
|
||||
try
|
||||
{
|
||||
tst = int.Parse(s);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
catch (Exception)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return int.Parse(s);
|
||||
return tst;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -582,16 +488,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
string s = _Xp["Step", "ImageHeight"];
|
||||
if (s == string.Empty) return 0;
|
||||
int tst = 0;
|
||||
try
|
||||
int tst;
|
||||
try
|
||||
{
|
||||
tst = int.Parse(s);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
catch (Exception)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return int.Parse(s);
|
||||
return tst;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -617,7 +523,6 @@ namespace VEPROMS.CSLA.Library
|
||||
set
|
||||
{
|
||||
_MyEnhancedDocuments = value;
|
||||
//OnPropertyChanged("EnhancedDocuments");
|
||||
}
|
||||
}
|
||||
public void AddEnhancedDocument(int type, int itemid)
|
||||
@@ -637,7 +542,6 @@ namespace VEPROMS.CSLA.Library
|
||||
// so that what remains are those that need added to xml that will then be written to database
|
||||
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
|
||||
{
|
||||
//EnhancedDocument tmp = edsToAdd[int.Parse(xn.Attributes["Type"].Value)];
|
||||
EnhancedDocument tmp = edsToAdd.GetByType(int.Parse(xn.Attributes["Type"].Value));
|
||||
if (tmp != null)
|
||||
{
|
||||
@@ -659,74 +563,6 @@ namespace VEPROMS.CSLA.Library
|
||||
xa.Value = edadd.ItemID.ToString();
|
||||
}
|
||||
}
|
||||
//public string Step_SourceToBackground
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// string s = _Xp["Step", "SourceToBackground"];
|
||||
// if (s == string.Empty) return null;
|
||||
// return s;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// string s = _Xp["Step", "SourceToBackground"];
|
||||
// if (value != null && value.ToString() == s) return;
|
||||
// if (value == null && s != null) _Xp["Step", "SourceToBackground"] = null;
|
||||
// else _Xp["Step", "SourceToBackground"] = value.ToString();
|
||||
// OnPropertyChanged("Step_SourceToBackground");
|
||||
// }
|
||||
//}
|
||||
//public string Step_BackgroundToSource
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// string s = _Xp["Step", "BackgroundToSource"];
|
||||
// if (s == string.Empty) return null;
|
||||
// return s;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// string s = _Xp["Step", "BackgroundToSource"];
|
||||
// if (value != null && value.ToString() == s) return;
|
||||
// if (value == null && s != null) _Xp["Step", "BackgroundToSource"] = null;
|
||||
// else _Xp["Step", "BackgroundToSource"] = value.ToString();
|
||||
// OnPropertyChanged("Step_BackgroundToSource");
|
||||
// }
|
||||
//}
|
||||
//public string Step_SourceToDeviation
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// string s = _Xp["Step", "SourceToDeviation"];
|
||||
// if (s == string.Empty) return null;
|
||||
// return s;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// string s = _Xp["Step", "SourceToDeviation"];
|
||||
// if (value != null && value.ToString() == s) return;
|
||||
// if (value == null && s != null) _Xp["Step", "SourceToDeviation"] = null;
|
||||
// else _Xp["Step", "SourceToDeviation"] = value.ToString();
|
||||
// OnPropertyChanged("Step_SourceToDeviation");
|
||||
// }
|
||||
//}
|
||||
//public string Step_DeviationToSource
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// string s = _Xp["Step", "DeviationToSource"];
|
||||
// if (s == string.Empty) return null;
|
||||
// return s;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// string s = _Xp["Step", "DeviationToSource"];
|
||||
// if (value != null && value.ToString() == s) return;
|
||||
// if (value == null && s != null) _Xp["Step", "DeviationToSource"] = null;
|
||||
// else _Xp["Step", "DeviationToSource"] = value.ToString();
|
||||
// OnPropertyChanged("Step_DeviationToSource");
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region IItemConfig Members
|
||||
|
||||
Reference in New Issue
Block a user