This commit is contained in:
@@ -13,8 +13,17 @@ using System.Drawing;
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
#region Item
|
||||
public partial class Item:IVEDrillDown
|
||||
public partial class Item : IVEDrillDown
|
||||
{
|
||||
public static void ShowAllocated(string title)
|
||||
{
|
||||
Console.WriteLine("{0} - {1} Items in the dictionary", title, _CacheByPrimaryKey.Count);
|
||||
foreach (List<Item> itmlst in _CacheByPrimaryKey.Values)
|
||||
foreach(Item itm in itmlst)
|
||||
Console.WriteLine("Item {0} UniqueID {1}", itm.ItemID, itm.MyItemUnique);
|
||||
Console.WriteLine("- - - - - -");
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} {1}", MyContent.Number, MyContent.Text).Trim();
|
||||
@@ -54,25 +63,29 @@ namespace VEPROMS.CSLA.Library
|
||||
_ActiveParent = this.ItemDocVersions[0].MyDocVersion;
|
||||
else
|
||||
{
|
||||
if (this.ItemParts == null || this.ItemPartCount == 0)
|
||||
if (this.ItemParts == null || this.ItemPartCount == 0)
|
||||
_ActiveParent = this;
|
||||
else
|
||||
_ActiveParent = this.ItemParts[0].MyContent.ContentItems[0].MyItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _ActiveParent==this ? null : _ActiveParent;
|
||||
return _ActiveParent == this ? null : _ActiveParent;
|
||||
}
|
||||
}
|
||||
private Format _ActiveFormat=null;// Added to cache ActiveFormat
|
||||
private Format _ActiveFormat = null;// Added to cache ActiveFormat
|
||||
public Format ActiveFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_ActiveFormat == null)
|
||||
if (_ActiveFormat == null)
|
||||
_ActiveFormat = (LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat);
|
||||
return _ActiveFormat;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ActiveFormat = null; // Reset
|
||||
}
|
||||
}
|
||||
public Format LocalFormat
|
||||
{
|
||||
@@ -83,18 +96,200 @@ namespace VEPROMS.CSLA.Library
|
||||
get { return null; }
|
||||
}
|
||||
#endregion
|
||||
public void MoveItem(IVEDrillDownReadOnly pInfo, int index)
|
||||
{
|
||||
bool wasfirstchild = false;
|
||||
ItemInfo parentInfo = pInfo as ItemInfo;
|
||||
DocVersionInfo parentInfoDV = pInfo as DocVersionInfo;
|
||||
IList<ItemInfo> children = null;
|
||||
E_FromType partType = 0; // this is needed later to determine sub-group type.
|
||||
if (parentInfo != null)
|
||||
{
|
||||
// this may have subgroups, need to use part type to get children list...
|
||||
ItemInfo thisinfo = ItemInfo.Get(ItemID);
|
||||
partType = thisinfo.FirstSibling.ItemParts[0].PartType;
|
||||
children = (IList<ItemInfo>)parentInfo.Lookup((int)partType);
|
||||
}
|
||||
else
|
||||
children = (IList<ItemInfo>)parentInfoDV.GetChildren();
|
||||
int numChild = children.Count;
|
||||
|
||||
if (this.MyPrevious == null) wasfirstchild = true;
|
||||
Item origNextItem = null;
|
||||
|
||||
// First, remove from this item from its list. To do this, get the current item's next point and redirect it's myprevious
|
||||
// to this item's previous...
|
||||
if (NextItems != null && NextItems.Count > 0)
|
||||
{
|
||||
origNextItem = NextItems.Items[0];
|
||||
origNextItem.MyPrevious = this.MyPrevious;
|
||||
this.Save();
|
||||
}
|
||||
|
||||
// check to see if the item is being moved into the middle of some items. newPreviousItem is the item defined
|
||||
// by index-1, i.e. inserting below newPreviousItem.
|
||||
ItemInfo newPreviousInfo = (index == 0) ? null : children[index - 1];
|
||||
ItemInfo newNextInfo = (index == children.Count) ? null : children[index];
|
||||
|
||||
// Adjust the new next proc to be me.
|
||||
if (newNextInfo != null)
|
||||
{
|
||||
using (Item newNextItem = newNextInfo.Get())
|
||||
{
|
||||
newNextItem.MyPrevious = this;
|
||||
newNextItem.Save().Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// adjust the previous node, i.e. may either be at same level or, if first in list, adjust the parent...
|
||||
// if 'newPreviousItem' isn't null, then adding to the middle of the list.
|
||||
if (newPreviousInfo != null)
|
||||
{
|
||||
using (Item newPreviousItem = newPreviousInfo.Get())
|
||||
{
|
||||
MyPrevious = newPreviousItem;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
// newPreviousInfo == null if moving into first child, and wasfirstchild == true if moving out of first child.
|
||||
// This will require adjusting the DocVersion to point to the correct first child if a procedure is moved.
|
||||
if (newPreviousInfo == null || wasfirstchild)
|
||||
{
|
||||
if (parentInfo != null) // Moving Item within procedure, i.e. moving a section or step
|
||||
{
|
||||
using (Item parentItem = parentInfo.Get())
|
||||
{
|
||||
// moving first child out... reset parent to point to the original next item
|
||||
if (wasfirstchild)
|
||||
parentItem.MyContent.ContentParts[(int)partType].MyItem = origNextItem;
|
||||
else
|
||||
parentItem.MyContent.ContentParts[(int)partType].MyItem = this;
|
||||
parentItem.Save().Dispose();
|
||||
}
|
||||
}
|
||||
else if (parentInfoDV != null) // Moving Item (Procedure) within DocVersion
|
||||
{
|
||||
using (DocVersion parentItemDV = parentInfoDV.Get())
|
||||
{
|
||||
ItemInfo firstinfo = parentInfoDV.FirstChild();
|
||||
parentItemDV.MyItem = wasfirstchild?parentInfoDV.Procedures[1].Get():this;
|
||||
parentItemDV.Save().Dispose();
|
||||
if (!wasfirstchild && firstinfo != null)
|
||||
{
|
||||
using (Item firstchild = firstinfo.Get())
|
||||
{
|
||||
firstchild.MyPrevious = this;
|
||||
firstchild.Save().Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!wasfirstchild)
|
||||
{
|
||||
this.MyPrevious = null;
|
||||
this.Save();
|
||||
}
|
||||
if (origNextItem != null) origNextItem.Dispose();
|
||||
if (parentInfo != null)
|
||||
parentInfo.MyContent.RefreshContentParts();
|
||||
if (parentInfoDV != null)
|
||||
parentInfoDV.ResetProcedures();
|
||||
}
|
||||
|
||||
}
|
||||
protected static int MakeNewItem(IVEDrillDownReadOnly parentInfoDD, ItemInfo previousInfo, string number, string title, int type, E_FromType partType)
|
||||
{
|
||||
int newitemid = 0;
|
||||
if (parentInfoDD == null)
|
||||
parentInfoDD = previousInfo.ActiveParent;
|
||||
ItemInfo parentInfo = parentInfoDD as ItemInfo;
|
||||
DocVersionInfo parentInfoDV = parentInfoDD as DocVersionInfo;
|
||||
using (Content cont = Content.New(number, title, type, null, null))
|
||||
{
|
||||
using (Item fromitem = previousInfo == null ? null : previousInfo.Get())
|
||||
{
|
||||
ItemInfo nextInfo = null; // Check to see if the item is being inserted in the middle of some items.
|
||||
if (previousInfo != null && previousInfo.NextItems != null && previousInfo.NextItems.Count > 0)
|
||||
nextInfo = previousInfo.NextItems[0];
|
||||
using (Item itm = Item.MakeItem(fromitem, cont))
|
||||
{
|
||||
newitemid = itm.ItemID;
|
||||
if (nextInfo != null)
|
||||
{
|
||||
using (Item nextItem = nextInfo.Get())
|
||||
{
|
||||
nextItem.MyPrevious = itm;// Aim the next item back at the new item.
|
||||
nextItem.Save().Dispose();
|
||||
}
|
||||
}
|
||||
if (fromitem == null)
|
||||
{
|
||||
if (parentInfo != null) // Adding Item to Procedure, Section or Step
|
||||
{
|
||||
using (Item parentItem = parentInfo.Get())
|
||||
{
|
||||
ItemInfo firstinfo = parentInfo.FirstChild(partType);
|
||||
if (firstinfo != null)
|
||||
{
|
||||
using (Item firstchild = firstinfo.Get())
|
||||
{
|
||||
parentItem.MyContent.ContentParts[(int)partType].MyItem = itm;// First update the parent to point to the new first child
|
||||
parentItem.Save().Dispose();
|
||||
firstchild.MyPrevious = itm;// Aim the old first child to point to the new first child.
|
||||
firstchild.Save().Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
parentItem.MyContent.ContentParts.Add((int)partType, itm);// update the parent to point to the new first child
|
||||
parentItem.Save().Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parentInfoDV != null) // Adding Item (Procedure) to DocVersion
|
||||
{
|
||||
using (DocVersion parentItemDV = parentInfoDV.Get())
|
||||
{
|
||||
ItemInfo firstinfo = parentInfoDV.FirstChild();
|
||||
parentItemDV.MyItem = itm;// First update the parent to point to the new first child
|
||||
parentItemDV.Save().Dispose();
|
||||
if (firstinfo != null)
|
||||
{
|
||||
using (Item firstchild = firstinfo.Get())
|
||||
{
|
||||
firstchild.MyPrevious = itm;// Aim the old first child to point to the new first child.
|
||||
firstchild.Save().Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parentInfo != null)
|
||||
parentInfo.MyContent.RefreshContentParts();
|
||||
if (parentInfoDV != null)
|
||||
parentInfoDV.ResetProcedures();
|
||||
return newitemid;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region ItemInfo
|
||||
public partial class ItemInfo:IVEDrillDownReadOnly
|
||||
{
|
||||
protected void ExtensionRefreshFields(Item tmp)
|
||||
{
|
||||
_ActiveParent = null;
|
||||
}
|
||||
#region LoadAtOnce2
|
||||
public static ItemInfo GetItemAndChildren2(int? itemID)
|
||||
{
|
||||
try
|
||||
{
|
||||
ItemInfo tmp = DataPortal.Fetch<ItemInfo>(new ItemAndChildrenCriteria2(itemID));
|
||||
//_AllList.Add(tmp);
|
||||
AddToCache(tmp);
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
}
|
||||
@@ -152,7 +347,7 @@ namespace VEPROMS.CSLA.Library
|
||||
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
_AllList.Remove(this);
|
||||
RemoveFromCache(this);
|
||||
}
|
||||
private void SpinThroughChildren()
|
||||
{
|
||||
@@ -169,7 +364,7 @@ namespace VEPROMS.CSLA.Library
|
||||
try
|
||||
{
|
||||
ItemInfo tmp = DataPortal.Fetch<ItemInfo>(new ItemAndChildrenCriteria(itemID,parentID));
|
||||
//_AllList.Add(tmp);
|
||||
AddToCache(tmp);
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
}
|
||||
@@ -429,6 +624,27 @@ namespace VEPROMS.CSLA.Library
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
public ItemInfo LastSibling
|
||||
{
|
||||
get
|
||||
{
|
||||
ItemInfo temp = this;
|
||||
while (temp.NextItems[0] != null) temp = temp.NextItems[0];
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
public ItemInfo LastChild(E_FromType partType)
|
||||
{
|
||||
ItemInfoList myitems = Lookup((int)partType);
|
||||
if (myitems !=null) return myitems[myitems.Count-1];
|
||||
return null;
|
||||
}
|
||||
public ItemInfo FirstChild(E_FromType partType)
|
||||
{
|
||||
ItemInfoList myitems = Lookup((int)partType);
|
||||
if (myitems != null) return myitems[0];
|
||||
return null;
|
||||
}
|
||||
public bool IsSubStep
|
||||
{
|
||||
get
|
||||
@@ -614,16 +830,39 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private ItemInfoList Lookup(int fromType, ref ItemInfoList itemInfoList)
|
||||
{
|
||||
if (itemInfoList != null) return itemInfoList;
|
||||
if (itemInfoList == null)
|
||||
itemInfoList = Lookup(fromType);
|
||||
return itemInfoList;
|
||||
}
|
||||
internal ItemInfoList Lookup(int fromType)
|
||||
{
|
||||
ItemInfoList itemInfoList = null;
|
||||
if (MyContent.ContentPartCount != 0)
|
||||
foreach (PartInfo partInfo in MyContent.ContentParts)
|
||||
if (partInfo.FromType == fromType)
|
||||
{
|
||||
itemInfoList = partInfo._MyItems = ItemInfoList.GetList(partInfo.ItemID,partInfo.FromType);
|
||||
itemInfoList = partInfo._MyItems = ItemInfoList.GetList(partInfo.ItemID, partInfo.FromType);
|
||||
return itemInfoList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static void ResetParts(int itemID)
|
||||
{
|
||||
string key = itemID.ToString();
|
||||
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||
foreach (ItemInfo itm in _CacheByPrimaryKey[key])
|
||||
itm.ResetParts();
|
||||
}
|
||||
public void ResetParts()
|
||||
{
|
||||
_Procedures = null;
|
||||
_Sections = null;
|
||||
_Cautions = null;
|
||||
_Notes = null;
|
||||
_RNOs = null;
|
||||
_Steps = null;
|
||||
_Tables = null;
|
||||
}
|
||||
private ItemInfoList _Procedures;
|
||||
public ItemInfoList Procedures
|
||||
{ get { return Lookup(1,ref _Procedures); } }
|
||||
@@ -740,6 +979,20 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get { return this.MyContent.ContentPartCount > 0; }
|
||||
}
|
||||
public bool HasWordContent
|
||||
{
|
||||
get { return this.MyContent.MyEntry != null; }
|
||||
}
|
||||
public bool HasStepContent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MyContent.ContentPartCount == 0) return false;
|
||||
if (MyContent.ContentPartCount == 1 && MyContent.ContentParts[0].PartType == E_FromType.Section) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemInfo MyProcedure
|
||||
{
|
||||
get
|
||||
@@ -757,13 +1010,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (_ActiveParent == this)_ActiveParent = null;
|
||||
if (_ActiveParent == null)
|
||||
{
|
||||
if (MyPrevious != null)
|
||||
_ActiveParent = _MyPrevious.ActiveParent;
|
||||
else
|
||||
{
|
||||
if (ItemDocVersionCount > 0)
|
||||
if (this.ItemDocVersions != null && this.ItemDocVersions.Count > 0)
|
||||
_ActiveParent = this.ItemDocVersions[0];
|
||||
else
|
||||
{
|
||||
@@ -778,6 +1032,7 @@ namespace VEPROMS.CSLA.Library
|
||||
return _ActiveParent==this ? null : _ActiveParent;
|
||||
}
|
||||
internal set
|
||||
//set
|
||||
{
|
||||
_ActiveParent = value;
|
||||
}
|
||||
@@ -813,7 +1068,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_ActiveFormat == null)
|
||||
if (_ActiveFormat == null)
|
||||
_ActiveFormat = (LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat);
|
||||
return _ActiveFormat;
|
||||
}
|
||||
@@ -982,11 +1237,44 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
public partial class ProcedureInfo : ItemInfo, IVEDrillDownReadOnly
|
||||
{
|
||||
protected override void RefreshFields(Item tmp)
|
||||
{
|
||||
base.RefreshFields(tmp);
|
||||
ExtensionRefreshFields(tmp);
|
||||
}
|
||||
#if ItemWithContent
|
||||
public ProcedureInfo(SafeDataReader dr) : base(dr, true) { }
|
||||
#else
|
||||
public ProcedureInfo(SafeDataReader dr) : base(dr) { }
|
||||
#endif
|
||||
private ProcedureInfo() : base() { ;}
|
||||
public new static ProcedureInfo Get(int itemID)
|
||||
{
|
||||
//if (!CanGetObject())
|
||||
// throw new System.Security.SecurityException("User not authorized to view a Item");
|
||||
try
|
||||
{
|
||||
ProcedureInfo tmp = GetCachedByPrimaryKey(itemID) as ProcedureInfo;
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<ProcedureInfo>(new PKCriteria(itemID));
|
||||
AddToCache(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on Item.Get", ex);
|
||||
}
|
||||
}
|
||||
public void MoveProcedure(IVEDrillDownReadOnly pInfo, int index)
|
||||
{
|
||||
using (Item ii = Item.Get(this.ItemID))
|
||||
{
|
||||
ii.MoveItem(pInfo, index);
|
||||
}
|
||||
}
|
||||
public new Procedure Get()
|
||||
{
|
||||
return (Procedure) (_Editable = Procedure.Get(ItemID));
|
||||
@@ -1013,11 +1301,14 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new System.Security.SecurityException("User not authorized to view a Item");
|
||||
try
|
||||
{
|
||||
Procedure tmp = (Procedure)GetExistingByPrimaryKey(itemID);
|
||||
Item itm = GetCachedByPrimaryKey(itemID);
|
||||
Procedure tmp = itm as Procedure;
|
||||
//Procedure tmp = (Procedure)GetExistingByPrimaryKey(itemID);
|
||||
if (tmp == null)
|
||||
{
|
||||
if (itm != null) Console.WriteLine("type = {0}", itm.GetType().Name);
|
||||
tmp = DataPortal.Fetch<Procedure>(new PKCriteria(itemID));
|
||||
_AllList.Add(tmp);
|
||||
AddToCache(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@@ -1031,6 +1322,11 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
return (Procedure)base.Save();
|
||||
}
|
||||
public static Procedure MakeProcedure(IVEDrillDownReadOnly parentInfo, ItemInfo previousInfo, string procNumber, string procTitle, int procType)
|
||||
{
|
||||
int newitemid = MakeNewItem(parentInfo, previousInfo, procNumber, procTitle, procType, E_FromType.Procedure);
|
||||
return Procedure.Get(newitemid);
|
||||
}
|
||||
#region ProcedureConfig
|
||||
[NonSerialized]
|
||||
private ProcedureConfig _ProcedureConfig;
|
||||
@@ -1057,15 +1353,49 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
public partial class SectionInfo : ItemInfo, IVEDrillDownReadOnly
|
||||
{
|
||||
protected override void RefreshFields(Item tmp)
|
||||
{
|
||||
base.RefreshFields(tmp);
|
||||
ExtensionRefreshFields(tmp);
|
||||
}
|
||||
#if ItemWithContent
|
||||
public SectionInfo(SafeDataReader dr) : base(dr, true) { }
|
||||
#else
|
||||
public SectionInfo(SafeDataReader dr) : base(dr) { }
|
||||
#endif
|
||||
private SectionInfo() : base() { ;}
|
||||
public new static SectionInfo Get(int itemID)
|
||||
{
|
||||
//if (!CanGetObject())
|
||||
// throw new System.Security.SecurityException("User not authorized to view a Item");
|
||||
try
|
||||
{
|
||||
SectionInfo tmp = GetCachedByPrimaryKey(itemID) as SectionInfo;
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<SectionInfo>(new PKCriteria(itemID));
|
||||
AddToCache(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on Item.Get", ex);
|
||||
}
|
||||
}
|
||||
public void MoveSection(IVEDrillDownReadOnly pInfo, int index)
|
||||
{
|
||||
using (Item ii = Item.Get(this.ItemID))
|
||||
{
|
||||
ii.MoveItem(pInfo, index);
|
||||
}
|
||||
}
|
||||
public new Section Get()
|
||||
{
|
||||
return (Section)(_Editable = Section.Get(ItemID));
|
||||
}
|
||||
|
||||
#region SectionConfig
|
||||
[NonSerialized]
|
||||
private SectionConfig _SectionConfig;
|
||||
@@ -1088,11 +1418,11 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new System.Security.SecurityException("User not authorized to view a Item");
|
||||
try
|
||||
{
|
||||
Section tmp = (Section)GetExistingByPrimaryKey(itemID);
|
||||
Section tmp = GetCachedByPrimaryKey(itemID) as Section;
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Section>(new PKCriteria(itemID));
|
||||
_AllList.Add(tmp);
|
||||
AddToCache(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@@ -1102,12 +1432,15 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on Item.Get", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public new Section Save()
|
||||
{
|
||||
return (Section)base.Save();
|
||||
}
|
||||
|
||||
public static Section MakeSection(IVEDrillDownReadOnly parentInfo, ItemInfo previousInfo, string sectNumber, string sectTitle, int sectType)
|
||||
{
|
||||
int newitemid = MakeNewItem(parentInfo, previousInfo, sectNumber, sectTitle, sectType, E_FromType.Section);
|
||||
return Section.Get(newitemid);
|
||||
}
|
||||
#region SectionConfig
|
||||
[NonSerialized]
|
||||
private SectionConfig _SectionConfig;
|
||||
@@ -1134,6 +1467,11 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
public partial class StepInfo : ItemInfo
|
||||
{
|
||||
protected override void RefreshFields(Item tmp)
|
||||
{
|
||||
base.RefreshFields(tmp);
|
||||
ExtensionRefreshFields(tmp);
|
||||
}
|
||||
//public override string ToString()
|
||||
//{
|
||||
// return "Step " + base.ToString();
|
||||
@@ -1143,6 +1481,34 @@ namespace VEPROMS.CSLA.Library
|
||||
#else
|
||||
public StepInfo(SafeDataReader dr) : base(dr) { }
|
||||
#endif
|
||||
private StepInfo() : base() { ;}
|
||||
public new static StepInfo Get(int itemID)
|
||||
{
|
||||
//if (!CanGetObject())
|
||||
// throw new System.Security.SecurityException("User not authorized to view a Item");
|
||||
try
|
||||
{
|
||||
StepInfo tmp = GetCachedByPrimaryKey(itemID) as StepInfo;
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<StepInfo>(new PKCriteria(itemID));
|
||||
AddToCache(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on Item.Get", ex);
|
||||
}
|
||||
}
|
||||
public void MoveStep(IVEDrillDownReadOnly pInfo, int index)
|
||||
{
|
||||
using (Item ii = Item.Get(this.ItemID))
|
||||
{
|
||||
ii.MoveItem(pInfo, index);
|
||||
}
|
||||
}
|
||||
public new Step Get()
|
||||
{
|
||||
return (Step)(_Editable = Step.Get(ItemID));
|
||||
@@ -1162,11 +1528,11 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new System.Security.SecurityException("User not authorized to view a Item");
|
||||
try
|
||||
{
|
||||
Step tmp = (Step)GetExistingByPrimaryKey(itemID);
|
||||
Step tmp = (Step)GetCachedByPrimaryKey(itemID);
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Step>(new PKCriteria(itemID));
|
||||
_AllList.Add(tmp);
|
||||
AddToCache(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@@ -1176,6 +1542,17 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on Item.Get", ex);
|
||||
}
|
||||
}
|
||||
// TODO :MakeCaution;
|
||||
// TODO :MakeNote;
|
||||
// TODO :MakeRNO;
|
||||
// TODO :MakeSection;
|
||||
// TODO :MakeSubStep;
|
||||
// TODO :MakeTable;
|
||||
public static Step MakeStep(IVEDrillDownReadOnly parentInfo, ItemInfo previousInfo, string stepNumber, string stepTitle, int stepType, E_FromType fromType)
|
||||
{
|
||||
int newitemid = MakeNewItem(parentInfo, previousInfo, stepNumber, stepTitle, stepType, fromType);
|
||||
return Step.Get(newitemid);
|
||||
}
|
||||
//#region StepConfig
|
||||
//[NonSerialized]
|
||||
//private StepConfig _StepConfig;
|
||||
|
Reference in New Issue
Block a user