Added MyItemInfo property

Fixed format of ToString for AnnotationAuditInfo
Fixed format of ToString for ContentAuditInfo
Fixed Restore if no next item
Fixed ActiveParent logic after restore
Added Timing logic and then Commented it
Fixed Logic when there is not a NextNode
Timing Debug code
Update UserID when saving annotation
Commented Timing Debug
Created and used FixPath - StepPath
Use MyItemInfo.SearchPath if Content doesn't have path
Refresh Change List from Timer.Tick
Added Timer for Refresh
Added code to refresh ChangeBar
Added and Commented timing debug
Changed logic for saving ROUsages
Added Closed Property that is set when the handle is destroyed
Don't refresh StepRTB if it is closed
This commit is contained in:
Rich
2011-08-23 14:14:14 +00:00
parent 472f4768b1
commit 2aeee7fdbc
11 changed files with 203 additions and 28 deletions

View File

@@ -29,9 +29,20 @@ namespace VEPROMS.CSLA.Library
get { return _IContentID; }
set { _IContentID = value; }
}
public ItemInfo MyItemInfo
{
get {return ItemInfo.Get(this.ItemID);}
}
public override string ToString()
{
return string.Format("{0} by {1} on {2}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
string who = string.Empty;
string when = string.Empty;
if (this.UserID != "Migration" || this.TypeID != 1)
who = string.Format(" by {0}", this.UserID);
if (this.DTS != DateTime.Parse("1/1/1980"))
when = string.Format(" on {0}", this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
//return string.Format("{0}{1}{2}", this.ActionWhat, who, when);
return string.Format("{0}{1}{2}", this.DeleteStatus == 0 ? "Changed" : "Deleted", who, when);
}
}
@@ -63,7 +74,13 @@ namespace VEPROMS.CSLA.Library
}
public override string ToString()
{
return string.Format("{0} by {1} on {2}", this.ActionWhat, this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
string who = string.Empty;
string when = string.Empty;
if (this.UserID != "Migration")
who = string.Format(" by {0}", this.UserID);
if (this.DTS != DateTime.Parse("1/1/1980"))
when = string.Format(" on {0}", this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
return string.Format("{0}{1}{2}", this.ActionWhat, who, when);
//return string.Format("{0} by {1} on {2}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
//return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted");
}
@@ -1161,15 +1178,22 @@ namespace VEPROMS.CSLA.Library
}
public ItemInfo RestoreItem(ItemAuditInfo iai)
{
ItemInfo tmp2 = null;
try
{
ItemInfo tmp = DataPortal.Fetch<ItemInfo>(new RestoreCriteria(iai, this));
tmp2 = tmp;
AddToCache(tmp);
if (tmp.ErrorMessage == "No Record Found") tmp = null;
if(iai.Level == 2)
OnNewChild(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Child));
ItemInfo.RefreshPrevious(tmp.NextItem.ItemID, tmp.ItemID);
tmp.NextItem.ResetOrdinal();
int? nextID = null;
if (tmp.NextItem != null)
{
nextID = tmp.NextItem.ItemID;
ItemInfo.RefreshPrevious(nextID, tmp.ItemID);
tmp.NextItem.ResetOrdinal();
}
//tmp.UpdateTransitionText();
if (tmp.MyContent.ContentTransitions != null)
{

View File

@@ -1762,14 +1762,19 @@ namespace VEPROMS.CSLA.Library
//using (ContentInfo parentContent = ParentContent)
//{
ContentInfo parentContent = ParentContent;
if (parentContent == null || parentContent.ContentItemCount == 0)
if (parentContent == null)// || parentContent.ContentItemCount == 0)
_ActiveParent = this;
else
{
int itemID = 0;
if (parentContent.ContentItems.Count == 0)
parentContent.RefreshContentItems();
using(ItemInfoList list = parentContent.ContentItems)
itemID = list[0].ItemID;
_ActiveParent = ItemInfo.Get(itemID);
if (itemID == 0)
_ActiveParent = this;
else
_ActiveParent = ItemInfo.Get(itemID);
}
//}
}

View File

@@ -192,6 +192,20 @@ namespace VEPROMS.CSLA.Library
MyParent.MyContent.RefreshContentParts();
}
}
//internal void OnDeleted(object sender, Volian.Base.Library.VlnTimer tmr)
//{
//tmr.ActiveProcess = "Deleted";
//if (Deleted != null) Deleted(sender);
//tmr.ActiveProcess = "ItemDeleted";
//if (ItemDeleted != null) ItemDeleted(sender);
//if (MyParent != null)
//{
//tmr.ActiveProcess = "OnChildrenDeleted";
//MyParent.OnChildrenDeleted(sender);
//tmr.ActiveProcess = "RefreshContentParts";
//MyParent.MyContent.RefreshContentParts();
//}
//}
public event ItemInfoEvent ChildrenDeleted;
internal void OnChildrenDeleted(object sender)
{
@@ -770,6 +784,8 @@ namespace VEPROMS.CSLA.Library
}
public static void DeleteItemInfoAndChildren(int itemID)
{
//Volian.Base.Library.VlnTimer _MyTimer = new Volian.Base.Library.VlnTimer();
//_MyTimer.ActiveProcess = "ConvertListToDictionary";
ConvertListToDictionary();
string key = itemID.ToString();
if(_CacheByPrimaryKey.ContainsKey(key))
@@ -777,18 +793,24 @@ namespace VEPROMS.CSLA.Library
ItemInfo [] items = _CacheByPrimaryKey[key].ToArray();
ItemInfo parent = items[0].ActiveParent as ItemInfo;
//_MyTimer.ActiveProcess = "ResetParts";
if (parent != null)
ItemInfo.ResetParts(parent.ItemID);
//Console.WriteLine("\r\n\r\n'Deleting Item {0}'\r\n{0}'Type ','ParentID','ParentUnique','ItemID','Unique'",itemID);
foreach (ItemInfo item in items)
{
//_MyTimer.ActiveProcess = "IsDeleted";
item.IsDeleted = true;
//_MyTimer.ActiveProcess = string.Format("OnDeleted {0}", items.Length);
item.OnDeleted(item);
//item.OnDeleted(item, _MyTimer);
//_MyTimer.ActiveProcess = "DeleteItemInfoAndChildren";
item.DeleteItemInfoAndChildren(" ");
}
//Console.WriteLine("\r\n'Item Deleted'");
}
//_MyTimer.ShowElapsedTimes("DeleteItemInfoAndChildren");
}
private void DeleteItemInfoAndChildren(string depth)
@@ -868,6 +890,7 @@ namespace VEPROMS.CSLA.Library
#region DeleteItemAndChildren
public static void DeleteItemAndChildren(ItemInfo item)
{
//Volian.Base.Library.VlnTimer _MyTimer = new Volian.Base.Library.VlnTimer();
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Item");
try
@@ -875,23 +898,31 @@ namespace VEPROMS.CSLA.Library
ItemInfo nextItem = item.NextItem;
ItemInfo prevItem = item.MyPrevious;
item.OnBeforeDelete();
//_MyTimer.ActiveProcess = "DataPortal.Delete";
DataPortal.Delete(new DeleteCriteria(item.ItemID, Volian.Base.Library.VlnSettings.UserID));
if (nextItem != null) // Adjust PreviousID for NextItem
{
//_MyTimer.ActiveProcess = "RefreshPrevious";
ItemInfo.RefreshPrevious(nextItem.ItemID, item.PreviousID);
// The order of the next two methods was required to fix a null reference
// when getting myparent. This bug was found when deleting a node from the
// tree when the RTBItem was not open (i.e. in the step editor window).
//_MyTimer.ActiveProcess = "RefreshItemParts";
nextItem.RefreshItemParts();
//nextItem.ResetOrdinal(); - UpdateTransitionText calls ResetOrdinal
//_MyTimer.ActiveProcess = "UpdateTransitionText";
nextItem.UpdateTransitionText();
}
else if (prevItem != null)
{
//_MyTimer.ActiveProcess = "RefreshNextItems";
prevItem.RefreshNextItems();
//_MyTimer.ActiveProcess = "ResetOrdinal";
if (prevItem.IsCaution || prevItem.IsNote) prevItem.ResetOrdinal();
//_MyTimer.ActiveProcess = "UpdateTransitionText";
prevItem.UpdateTransitionText();
}
//_MyTimer.ActiveProcess = "DeleteItemInfoAndChildren";
ItemInfo.DeleteItemInfoAndChildren(item.ItemID); // Dispose ItemInfo and Children
}
catch (Exception ex)
@@ -904,6 +935,7 @@ namespace VEPROMS.CSLA.Library
else
throw new DbCslaException("Error on Item.DeleteItemAndChildren", ex);
}
//_MyTimer.ShowElapsedTimes("DeleteItemAndChildren");
}
private static System.Data.SqlClient.SqlException SqlException(Exception ex)
{