Added UpdateDRoUsages to Update DROUsages when a Document is Saved

Added a list of ROIDs as a parameter to the code that walks through the MSWORD Document text and replaces ROs with their values
Fixed search string in FindRO
Added code to call GetAffectedDROUsages when an RO changes.
This adds annotations to show the changes to RO Values.
Added DROUsages table to capture ROUsages in Documents
This commit is contained in:
Rich
2011-01-20 20:22:10 +00:00
parent 7cdc7f4994
commit c4344f2308
7 changed files with 280 additions and 22 deletions

View File

@@ -224,14 +224,30 @@ namespace VEPROMS.CSLA.Library
// roid's are stored in database as 16 characters long in the rousages table. They may be stored
// as 12 characters in the ro.fst.
string padroid = chg.Length <= 12 ? chg + "0000" : chg;
RoUsageInfoList affected = RoUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroid, desc, "Changed");
foreach (RoUsageInfo roUsg in affected)
using (RoUsageInfoList affected = RoUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroid, desc, "Changed"))
{
using (Content content = Content.Get(roUsg.MyContent.ContentID))
foreach (RoUsageInfo roUsg in affected)
{
content.FixContentText(roUsg, newvalue);
if (content.IsDirty)
content.Save();
using (Content content = Content.Get(roUsg.MyContent.ContentID))
{
content.FixContentText(roUsg, newvalue);
if (content.IsDirty)
content.Save();
}
}
}
using (DROUsageInfoList affected = DROUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroid, desc, "Changed"))
{
foreach (DROUsageInfo droUsg in affected)
{
using (Document document = Document.Get(droUsg.DocID))
{
if (document.DocPdf != null)
{
document.DocPdf = null;
document.Save();
}
}
}
}
}
@@ -240,7 +256,8 @@ namespace VEPROMS.CSLA.Library
Console.WriteLine("Deleted ROID = {0}", del);
string desc = string.Format("Deleted RO: Value = {0}", origLU.GetRoValue(del));
string padroiddel = del.Length <= 12 ? del + "0000" : del;
RoUsageInfoList affected = RoUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroiddel, desc, "Deleted");
using (RoUsageInfoList affected = RoUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroiddel, desc, "Deleted")) ;
using (DROUsageInfoList Daffected = DROUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroiddel, desc, "Deleted")) ;
}
}