new revision config class
This commit is contained in:
parent
435606b403
commit
1c2c28c625
100
PROMS/VEPROMS.CSLA.Library/Config/RevisionConfig.cs
Normal file
100
PROMS/VEPROMS.CSLA.Library/Config/RevisionConfig.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using DescriptiveEnum;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
[Serializable]
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class RevisionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
|
||||
{
|
||||
#region DynamicTypeDescriptor
|
||||
internal override bool IsReadOnly
|
||||
{
|
||||
get { return false; }//_Section == null; }
|
||||
}
|
||||
#endregion
|
||||
#region XML
|
||||
private XMLProperties _Xp;
|
||||
private XMLProperties Xp
|
||||
{
|
||||
get { return _Xp; }
|
||||
}
|
||||
#endregion
|
||||
#region Constructors
|
||||
private Revision _Revision;
|
||||
private RevisionInfo _RevisionInfo;
|
||||
[Browsable(false)]
|
||||
public bool ParentLookup
|
||||
{
|
||||
get { return _Xp.ParentLookup; }
|
||||
set { _Xp.ParentLookup = value; }
|
||||
}
|
||||
public RevisionConfig(Revision revision)
|
||||
{
|
||||
_Revision = revision;
|
||||
string xml = revision.Config;
|
||||
if (xml == string.Empty) xml = "<Config/>";
|
||||
_Xp = new XMLProperties(xml);
|
||||
}
|
||||
public RevisionConfig(RevisionInfo revisionInfo)
|
||||
{
|
||||
_RevisionInfo = revisionInfo;
|
||||
string xml = revisionInfo.Config;
|
||||
if (xml == string.Empty) xml = "<Config/>";
|
||||
_Xp = new XMLProperties(xml);
|
||||
}
|
||||
public RevisionConfig(string xml)
|
||||
{
|
||||
if (xml == string.Empty) xml = "<Config/>";
|
||||
_Xp = new XMLProperties(xml);
|
||||
}
|
||||
public RevisionConfig()
|
||||
{
|
||||
_Xp = new XMLProperties();
|
||||
}
|
||||
internal string GetValue(string group, string item)
|
||||
{
|
||||
return _Xp[group, item];
|
||||
}
|
||||
#endregion
|
||||
#region Properties and Methods
|
||||
// This is needed for the Data Loader
|
||||
[Category("History")]
|
||||
[Browsable(false)]
|
||||
[DisplayName("Start Date")]
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
[Description("Start date used for change bars")]
|
||||
public DateTime History_StartDate
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = _Xp["History", "StartDate"];
|
||||
if (s == string.Empty) return DateTime.MinValue;
|
||||
return DateTime.Parse(s);
|
||||
}
|
||||
set
|
||||
{
|
||||
string s = _Xp["History", "StartDate"];
|
||||
if (s == value.ToString("MM/dd/yyyy hh:mm:ss")) return;
|
||||
_Xp["History", "StartDate"] = value.ToString("MM/dd/yyyy hh:mm:ss");
|
||||
OnPropertyChanged("History_StartDate");
|
||||
}
|
||||
}
|
||||
public void Save()
|
||||
{
|
||||
if (_Revision != null)
|
||||
_Revision.Config = this.ToString();
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
string s = _Xp.ToString();
|
||||
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
|
||||
return s;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user