Removed AncestorLookup property

Changed logic to use Info version of parent
Changed Ancestor Lookup to use Info objects
Removed ActiveFormat from editable object
This commit is contained in:
Rich 2009-10-08 14:29:52 +00:00
parent 10f55d09fd
commit d3e7bc9dd5
2 changed files with 27 additions and 53 deletions

View File

@ -35,12 +35,12 @@ namespace VEPROMS.CSLA.Library
//[NonSerialized]
private bool _AncestorLookup;
//PROPGRID: Hide AncestorLookup
[Browsable(false)]
public bool AncestorLookup
{
get { return _AncestorLookup; }
set { _AncestorLookup = value; }
}
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Section _Section;
private SectionInfo _SectionInfo;
@ -50,51 +50,29 @@ namespace VEPROMS.CSLA.Library
string xml = section.MyContent.Config;
if (xml == string.Empty) xml = "<config/>";
_Xp = new XMLProperties(xml);
if (section.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
if (section.MySectionInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
}
private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args)
{
if (_AncestorLookup || ParentLookup)
if (args.AncestorLookup || ParentLookup)
{
string retval;
Section sect = _Section;
while (sect.ActiveParent.GetType() == typeof(Section))
SectionInfo sect = _Section.MySectionInfo;
while (sect.ActiveParent.GetType() == typeof(SectionInfo))
{
retval = sect.SectionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
sect = (Section)sect.ActiveParent;
sect = (SectionInfo)sect.ActiveParent;
}
Procedure proc = (Procedure)sect.ActiveParent;
while (proc.ActiveParent.GetType() == typeof(Procedure))
ProcedureInfo proc = (ProcedureInfo)sect.ActiveParent;
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
while (proc.ActiveParent.GetType() == typeof(ProcedureInfo))
{
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
proc = (Procedure)proc.ActiveParent;
proc = (ProcedureInfo)proc.ActiveParent;
}
DocVersion docVersion = (DocVersion)proc.ActiveParent;
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
for (Folder folder = docVersion.MyFolder; folder != null; folder = folder.MyParent)
{
retval = folder.FolderConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
}
}
return string.Empty;
}
private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
{
if (_AncestorLookup || ParentLookup)
{
string retval;
Section sect = _Section;
while (sect.ActiveParent.GetType() == typeof(Section))
{
//retval = sect.SectionConfig.GetValue(args.Group, args.Item);
//if (retval != string.Empty) return retval;
sect = (Section)sect.ActiveParent;
}
Procedure proc = (Procedure)sect.ActiveParent;
DocVersionInfo docVersion = (DocVersionInfo)proc.ActiveParent;
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
@ -182,7 +160,7 @@ namespace VEPROMS.CSLA.Library
if (_Section != null)
{
_Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
_Section.ActiveFormat = null;
//_Section.ActiveFormat = null;
DocStyleListConverter.MySection = _Section;
}
}
@ -213,7 +191,7 @@ namespace VEPROMS.CSLA.Library
{
get
{
if (_Section != null && _Section.ActiveParent != null && _Section.ActiveParent.ActiveFormat != null) return _Section.ActiveParent.ActiveFormat.FullName;
if (_Section != null && _Section.MySectionInfo.ActiveParent != null && _Section.MySectionInfo.ActiveParent.ActiveFormat != null) return _Section.MySectionInfo.ActiveParent.ActiveFormat.FullName;
if (_SectionInfo != null && _SectionInfo.MyParent != null && _SectionInfo.MyParent.ActiveFormat != null) return _SectionInfo.MyParent.ActiveFormat.FullName;
return null;
}
@ -223,11 +201,7 @@ namespace VEPROMS.CSLA.Library
{
get
{
if (_Section != null)
{
SectionInfo sectionInfo = SectionInfo.Get(_Section.ItemID);
return sectionInfo.ActiveParent.ActiveFormat;
}
if (_Section != null) return _Section.MySectionInfo.ActiveParent.ActiveFormat;
return _SectionInfo.ActiveParent.ActiveFormat;
}
}

View File

@ -33,14 +33,14 @@ namespace VEPROMS.CSLA.Library
}
//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 bool _AncestorLookup;
////PROPGRID: Hide AncestorLookup
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Step _Step;
private StepInfo _StepInfo;
public StepConfig(Step step)