This commit is contained in:
@@ -48,7 +48,11 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_docVer == null) _docVer = DocVersion.Get(this.ROFstAssociations[0].MyDocVersion.VersionID);
|
||||
if (_docVer == null)
|
||||
{
|
||||
if (ROFstAssociations.Count == 0) return null;
|
||||
_docVer = DocVersion.Get(this.ROFstAssociations[0].MyDocVersion.VersionID);
|
||||
}
|
||||
return _docVer;
|
||||
}
|
||||
set
|
||||
@@ -161,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
/// the current one.
|
||||
/// <param name="docver" - hook into this doc version></param>
|
||||
/// <returns>ROFst: Returns the created rofst object</returns>
|
||||
public static ROFst UpdateRoFst(RODbInfo rdi, DocVersionAssociation dva, DocVersion docver)
|
||||
public static ROFst UpdateRoFst(RODbInfo rdi, DocVersionAssociation dva, DocVersion docver, ROFstInfo origROFst)
|
||||
{
|
||||
// file validity checks are done before getting here - just do the import
|
||||
// here.
|
||||
@@ -200,9 +204,47 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
// Now update the usages: compare old to new rofsts and update usages accordingly, i.e. modified
|
||||
// values, deleted ros, etc.
|
||||
UpdateROValuesText(origROFst, rofst);
|
||||
return rofst;
|
||||
}
|
||||
}
|
||||
private static void UpdateROValuesText(ROFstInfo origROFstInfo, ROFst newROFst)
|
||||
{
|
||||
ROFSTLookup origLU = new ROFSTLookup(origROFstInfo);
|
||||
ROFSTLookup newLU = new ROFSTLookup(newROFst);
|
||||
List <string> delList = new List<string>();
|
||||
List<string> chgList = newLU.GetValueDifferences(origLU, ref delList);
|
||||
|
||||
foreach (string chg in chgList)
|
||||
{
|
||||
string newvalue = newLU.GetRoValue(chg);
|
||||
string desc = string.Format("Change in RO Values: Old value = {0}, New value = {1}", origLU.GetRoValue(chg), newvalue);
|
||||
// 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 (Content content = Content.Get(roUsg.MyContent.ContentID))
|
||||
{
|
||||
content.FixContentText(roUsg, newvalue);
|
||||
if (content.IsDirty)
|
||||
content.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (string del in delList)
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static string NewROName(string roName)
|
||||
{
|
||||
string retval = roName;
|
||||
|
Reference in New Issue
Block a user