Removed AncestorLookup property

HasParent to Property rather than method
Removed ActiveFormat from editable object
Changed DefaultFormatSelection to use info objects
Added Folder.MyFolderInfo
Changed logic to use Info version of parent
Changed Ancestor Lookup to use Info objects
Fixed default value for disableduplex
This commit is contained in:
Rich
2009-10-08 14:27:52 +00:00
parent 6396b53eeb
commit 4bdc127c87

View File

@@ -36,14 +36,14 @@ namespace VEPROMS.CSLA.Library
//PROPGRID: Hide AncestorLookup //PROPGRID: Hide AncestorLookup
//PROPGRID: Needed to comment out [NonSerialized] in order to hide this field from the property grid //PROPGRID: Needed to comment out [NonSerialized] in order to hide this field from the property grid
//[NonSerialized] //[NonSerialized]
[Browsable(false)] //[Browsable(false)]
private bool _AncestorLookup; //private bool _AncestorLookup;
[Browsable(false)] //[Browsable(false)]
public bool AncestorLookup //public bool AncestorLookup
{ //{
get { return _AncestorLookup; } // get { return _AncestorLookup; }
set { _AncestorLookup = value; } // set { _AncestorLookup = value; }
} //}
private Folder _Folder; private Folder _Folder;
private FolderInfo _FolderInfo; private FolderInfo _FolderInfo;
public FolderConfig(Folder folder) public FolderConfig(Folder folder)
@@ -52,34 +52,13 @@ namespace VEPROMS.CSLA.Library
string xml = _Folder.Config; string xml = _Folder.Config;
if (xml == string.Empty) xml = "<config/>"; if (xml == string.Empty) xml = "<config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
if (folder.MyParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder); if (folder.MyFolderInfo.MyParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
} }
private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args) private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args)
{ {
if (_AncestorLookup || ParentLookup || args.AncestorLookup) if (ParentLookup || args.AncestorLookup)
return GetParentValue(args.Group, args.Item);
return string.Empty;
}
public bool HasParent()
{ {
if (_Folder.ActiveParent != null) return true; for (FolderInfo folder = _Folder.MyFolderInfo.MyParent; folder != null; folder = folder.MyParent)
return false;
}
public string GetParentValue(string group, string item)
{
for (Folder folder = _Folder.MyParent; folder != null; folder = folder.MyParent)
{
string retval = folder.FolderConfig.GetValue(group, item);
if (retval != string.Empty) return retval;
}
return string.Empty;
}
private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
{
if (_AncestorLookup || ParentLookup)
{
for (FolderInfo folder = _FolderInfo.MyParent; folder != null; folder = folder.MyParent)
{ {
string retval = folder.FolderConfig.GetValue(args.Group, args.Item); string retval = folder.FolderConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval; if (retval != string.Empty) return retval;
@@ -87,6 +66,27 @@ namespace VEPROMS.CSLA.Library
} }
return string.Empty; return string.Empty;
} }
public bool HasParent
{
get
{
if (_Folder != null) return _Folder.ParentID != _Folder.FolderID;
if (_FolderInfo != null) return _FolderInfo.ParentID != _FolderInfo.FolderID;
return false;
}
}
//private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
//{
// if (args.AncestorLookup || ParentLookup)
// {
// for (FolderInfo folder = _FolderInfo.MyParent; folder != null; folder = folder.MyParent)
// {
// string retval = folder.FolderConfig.GetValue(args.Group, args.Item);
// if (retval != string.Empty) return retval;
// }
// }
// return string.Empty;
//}
public FolderConfig(FolderInfo folderInfo) public FolderConfig(FolderInfo folderInfo)
{ {
_FolderInfo = folderInfo; _FolderInfo = folderInfo;
@@ -154,7 +154,7 @@ namespace VEPROMS.CSLA.Library
if (_Folder != null) if (_Folder != null)
{ {
_Folder.MyFormat = FormatList.ToFormat(value); _Folder.MyFormat = FormatList.ToFormat(value);
_Folder.ActiveFormat = null; //_Folder.ActiveFormat = null;
} }
} }
} }
@@ -166,13 +166,15 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
if (_Folder != null && _Folder.ActiveParent != null && _Folder.ActiveParent.ActiveFormat != null) return _Folder.ActiveParent.ActiveFormat.FullName; if (_Folder != null && _Folder.MyFolderInfo.MyParent != null && _Folder.MyFolderInfo.MyParent.ActiveFormat != null) return _Folder.MyFolderInfo.MyParent.ActiveFormat.FullName;
if (_FolderInfo != null && _FolderInfo.MyParent != null && _FolderInfo.MyParent.ActiveFormat != null) return _FolderInfo.MyParent.ActiveFormat.FullName; if (_FolderInfo != null && _FolderInfo.MyParent != null && _FolderInfo.MyParent.ActiveFormat != null) return _FolderInfo.MyParent.ActiveFormat.FullName;
return null; return null;
} }
} }
public Folder MyFolder public Folder MyFolder
{ get { return _Folder; } } { get { return _Folder; } }
public FolderInfo MyFolderInfo
{ get { return _FolderInfo; } }
#endregion #endregion
#region ToString #region ToString
public override string ToString() public override string ToString()
@@ -760,7 +762,7 @@ namespace VEPROMS.CSLA.Library
string parval = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value string parval = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "false"; parval = "False";
if (parval.Equals(value.ToString())) if (parval.Equals(value.ToString()))
_Xp["PrintSettings", "disableduplex"] = string.Empty; // reset to parent value _Xp["PrintSettings", "disableduplex"] = string.Empty; // reset to parent value