Fixed Cache for ItemInfo - This was causing steps to not be undated in the editor or the tree.

Unique Key for ROFst Lookup
This commit is contained in:
Rich 2014-04-10 20:13:15 +00:00
parent 132619c0ba
commit 1d760eab81
2 changed files with 17 additions and 13 deletions

View File

@ -547,6 +547,7 @@ namespace VEPROMS.CSLA.Library
else
tmp = DataPortal.Fetch<StepInfo>(new AddingPartCriteria(itemID, addType, number, text, type, fromType, formatID, config, dts, userID));
}
AddToCache(tmp);
return tmp;
}
public void UpdateTransitionText()
@ -1055,6 +1056,19 @@ namespace VEPROMS.CSLA.Library
_MyPrevious = null; // Reset list so that the next line gets a new list
if (MyPrevious != null) MyPrevious.RefreshNextItems(); // Update List for new value
}
internal static ItemInfo CopyPasteReplaceItemInfoFetch(int copyStartID, ItemInfo itemInfo) // int itemID, int? type, int? fromType)
{
ItemInfo tmp = null;
if (itemInfo.GetType() == typeof(ProcedureInfo))
tmp = DataPortal.Fetch<ProcedureInfo>(new ItemInfo.PastingPartCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
else if (itemInfo.GetType() == typeof(SectionInfo))
tmp = DataPortal.Fetch<SectionInfo>(new ItemInfo.PastingPartCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
else
tmp = DataPortal.Fetch<StepInfo>(new ItemInfo.PastingPartCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
AddToCache(tmp);
return tmp;
}
}
public partial class Item
{
@ -1173,7 +1187,7 @@ namespace VEPROMS.CSLA.Library
throw new System.Security.SecurityException("User not authorized to remove a Item");
try
{
ItemInfo newItemInfo = CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); //itemInfo.ItemID, itemInfo.MyContent.Type, itemInfo.MyContent.Type);
ItemInfo newItemInfo = ItemInfo.CopyPasteReplaceItemInfoFetch(copyStartID, itemInfo); //itemInfo.ItemID, itemInfo.MyContent.Type, itemInfo.MyContent.Type);
// Delete business objects, including remove from tree
ItemInfo.DeleteItemInfoAndChildren(itemInfo.ItemID); // Dispose ItemInfo and Children
using (Item item = Get(newItemInfo.ItemID)) ItemInfo.Refresh(item);
@ -1213,17 +1227,6 @@ namespace VEPROMS.CSLA.Library
return itemInfo;
}
}
private static ItemInfo CopyPasteReplaceItemInfoFetch(int copyStartID, ItemInfo itemInfo) // int itemID, int? type, int? fromType)
{
ItemInfo tmp = null;
if (itemInfo.GetType() == typeof(ProcedureInfo))
tmp = DataPortal.Fetch<ProcedureInfo>(new ItemInfo.PastingPartCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
else if (itemInfo.GetType() == typeof(SectionInfo))
tmp = DataPortal.Fetch<SectionInfo>(new ItemInfo.PastingPartCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
else
tmp = DataPortal.Fetch<StepInfo>(new ItemInfo.PastingPartCriteria(copyStartID, itemInfo.ItemID, ItemInfo.EAddpingPart.Replace, itemInfo.MyContent.Type, itemInfo.MyContent.Type, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
return tmp;
}
#endregion
}
}

View File

@ -174,7 +174,8 @@ namespace VEPROMS.CSLA.Library
public ROFSTLookup GetROFSTLookup(DocVersionInfo dvi)
{
//string key = string.Format("{0}.{1}",dvi.DocVersionAssociations[0].ROFstID,dvi.DocVersionConfig.SelectedSlave);
string key = string.Format("{0}.{1}.{2}", ROFstID, dvi.DocVersionConfig.MaxSlaveIndex, dvi.DocVersionConfig.SelectedSlave); if (!dicLookups.ContainsKey(key))
string key = string.Format("{0}.{1}.{2}", ROFstID, dvi.DocVersionConfig.MaxSlaveIndex, dvi.DocVersionConfig.SelectedSlave);
if (!dicLookups.ContainsKey(key))
dicLookups.Add(key, new ROFSTLookup(this, dvi));
return dicLookups[key];
}