Added Item.MyItemInfo
Changed ActiveParent object to return cached ItemInfo Added Section.MySectionInfo Added Procedure.MyProcedureInfo Removed debug printout Removed GetChildren from editable object Removed HasChildren from editable object Removed ActiveParent from editable object Removed ActiveFormat from editable object Removed LocalFormat from editable object Changed logic to use SectionInfo to retrieve FormatInfo
This commit is contained in:
parent
119c428ae4
commit
66f1c21425
@ -16,6 +16,8 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Item
|
||||
public partial class Item : IVEDrillDown
|
||||
{
|
||||
public ItemInfo MyItemInfo /* Return Info version of the current Item */
|
||||
{ get { return ItemInfo.Get(ItemID); } }
|
||||
public static void ShowAllocated(string title)
|
||||
{
|
||||
Console.WriteLine("{0} - {1} Items in the dictionary", title, _CacheByPrimaryKey.Count);
|
||||
@ -32,66 +34,67 @@ namespace VEPROMS.CSLA.Library
|
||||
// TODO: Move to ItemInfo Extension
|
||||
|
||||
#region IVEDrillDown
|
||||
public System.Collections.IList GetChildren()
|
||||
{
|
||||
return this.MyContent.ContentParts;
|
||||
}
|
||||
public bool HasChildren
|
||||
{
|
||||
get { return this.MyContent.ContentPartCount > 0; }
|
||||
}
|
||||
public Item MyProcedure
|
||||
{
|
||||
get
|
||||
{
|
||||
// Walk up active parents until the parent is not an item
|
||||
Item tmp = this;
|
||||
while (tmp.ActiveParent.GetType() != typeof(DocVersion)) tmp = (Item)tmp.ActiveParent;
|
||||
return tmp;
|
||||
}
|
||||
} private IVEDrillDown _ActiveParent = null;
|
||||
public IVEDrillDown ActiveParent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ActiveParent == null)
|
||||
{
|
||||
if (MyPrevious != null)
|
||||
_ActiveParent = _MyPrevious.ActiveParent;
|
||||
else
|
||||
{
|
||||
if (ItemDocVersionCount > 0)
|
||||
_ActiveParent = this.ItemDocVersions[0].MyDocVersion;
|
||||
else
|
||||
{
|
||||
if (this.ItemParts == null || this.ItemPartCount == 0)
|
||||
_ActiveParent = this;
|
||||
else
|
||||
_ActiveParent = this.ItemParts[0].MyContent.ContentItems[0].MyItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _ActiveParent == this ? null : _ActiveParent;
|
||||
}
|
||||
}
|
||||
private Format _ActiveFormat = null;// Added to cache ActiveFormat
|
||||
public Format ActiveFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ActiveFormat == null)
|
||||
_ActiveFormat = (LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat);
|
||||
return _ActiveFormat;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ActiveFormat = null; // Reset
|
||||
}
|
||||
}
|
||||
public Format LocalFormat
|
||||
{
|
||||
get { return MyContent.MyFormat; }
|
||||
}
|
||||
//public System.Collections.IList GetChildren()
|
||||
//{
|
||||
// return this.MyContent.ContentParts;
|
||||
//}
|
||||
//public bool HasChildren
|
||||
//{
|
||||
// get { return this.MyContent.ContentPartCount > 0; }
|
||||
//}
|
||||
//public Item MyProcedure
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// // Walk up active parents until the parent is not an item
|
||||
// Item tmp = this;
|
||||
// while (tmp.ActiveParent.GetType() != typeof(DocVersion)) tmp = (Item)tmp.ActiveParent;
|
||||
// return tmp;
|
||||
// }
|
||||
//}
|
||||
//private IVEDrillDown _ActiveParent = null;
|
||||
//public IVEDrillDown ActiveParent
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (_ActiveParent == null)
|
||||
// {
|
||||
// if (MyPrevious != null)
|
||||
// _ActiveParent = _MyPrevious.ActiveParent;
|
||||
// else
|
||||
// {
|
||||
// if (ItemDocVersionCount > 0)
|
||||
// _ActiveParent = this.ItemDocVersions[0].MyDocVersion;
|
||||
// else
|
||||
// {
|
||||
// if (this.ItemParts == null || this.ItemPartCount == 0)
|
||||
// _ActiveParent = this;
|
||||
// else
|
||||
// _ActiveParent = this.ItemParts[0].MyContent.ContentItems[0].MyItem;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return _ActiveParent == this ? null : _ActiveParent;
|
||||
// }
|
||||
//}
|
||||
//private Format _ActiveFormat = null;// Added to cache ActiveFormat
|
||||
//public Format ActiveFormat
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (_ActiveFormat == null)
|
||||
// _ActiveFormat = (LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat);
|
||||
// return _ActiveFormat;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// _ActiveFormat = null; // Reset
|
||||
// }
|
||||
//}
|
||||
//public Format LocalFormat
|
||||
//{
|
||||
// get { return MyContent.MyFormat; }
|
||||
//}
|
||||
public ConfigDynamicTypeDescriptor MyConfig
|
||||
{
|
||||
get { return null; }
|
||||
@ -1286,11 +1289,18 @@ namespace VEPROMS.CSLA.Library
|
||||
_ActiveParent = this.ItemDocVersions[0];
|
||||
else
|
||||
{
|
||||
ContentInfo parentContent = ParentContent;
|
||||
using (ContentInfo parentContent = ParentContent)
|
||||
{
|
||||
if (parentContent == null || parentContent.ContentItemCount == 0)
|
||||
_ActiveParent = this;
|
||||
else
|
||||
_ActiveParent = parentContent.ContentItems[0];
|
||||
{
|
||||
int itemID = 0;
|
||||
using(ItemInfoList list = parentContent.ContentItems)
|
||||
itemID = list[0].ItemID;
|
||||
_ActiveParent = ItemInfo.Get(itemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1335,7 +1345,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_ActiveFormat == null)
|
||||
_ActiveFormat = (LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat);
|
||||
Console.WriteLine("Active {0}", (_ActiveFormat == null) ? "_ActiveFormat is null" : _ActiveFormat.Name);
|
||||
//Console.WriteLine("Active {0}", (_ActiveFormat == null) ? "_ActiveFormat is null" : _ActiveFormat.Name);
|
||||
return _ActiveFormat;
|
||||
}
|
||||
//get { return LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat; }
|
||||
@ -1343,7 +1353,7 @@ namespace VEPROMS.CSLA.Library
|
||||
public FormatInfo LocalFormat
|
||||
{
|
||||
get {
|
||||
Console.WriteLine("Local {0}", (MyContent.MyFormat==null)?"MYformat is null": MyContent.MyFormat.Name);
|
||||
//Console.WriteLine("Local {0}", (MyContent.MyFormat==null)?"MYformat is null": MyContent.MyFormat.Name);
|
||||
return MyContent.MyFormat; }
|
||||
}
|
||||
private ConfigDynamicTypeDescriptor _MyConfig=null;
|
||||
@ -1905,6 +1915,8 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
public partial class Procedure : Item
|
||||
{
|
||||
public ProcedureInfo MyProcedureInfo /* Return Info version of the current Item */
|
||||
{ get { return ProcedureInfo.Get(ItemID); } }
|
||||
public new static Procedure Get(int itemID)
|
||||
{
|
||||
if (!CanGetObject())
|
||||
@ -2022,6 +2034,8 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
public partial class Section : Item
|
||||
{
|
||||
public SectionInfo MySectionInfo /* Return Info version of the current Item */
|
||||
{ get { return SectionInfo.Get(ItemID); } }
|
||||
public new static Section Get(int itemID)
|
||||
{
|
||||
if (!CanGetObject())
|
||||
|
@ -126,7 +126,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_MyDocStyleList == null)
|
||||
{
|
||||
_MyDocStyleList = new SortedList<string, int>();
|
||||
foreach(DocStyle ds in _MySection.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
|
||||
foreach(DocStyle ds in _MySection.MySectionInfo.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
|
||||
{
|
||||
_MyDocStyleList.Add(ds.Name,10000 + (int) ds.Index);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user