Added getDRoUsagesByROIDsAndVersions and getRoUsagesByROIDsAndVersions to speed-up RO Value Update process.
Added logic to speed up RO Value Update Process. Added logic to keep SvgImages from failing if the ImagePath is null.
This commit is contained in:
@@ -351,12 +351,19 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private static void UpdateROValuesText(ROFstInfo origROFstInfo, ROFst newROFst, string versionList)
|
||||
{
|
||||
//DateTime dtStart = DateTime.Now;
|
||||
//DateTime dtLast = DateTime.Now;
|
||||
ROFSTLookup origLU = new ROFSTLookup(origROFstInfo);
|
||||
//dtLast = ShowDuration(dtLast, "origLU");
|
||||
ROFSTLookup newLU = new ROFSTLookup(newROFst);
|
||||
//dtLast = ShowDuration(dtLast, "newLU");
|
||||
List<string> delList = new List<string>();
|
||||
List<string> chgList = newLU.GetValueDifferences(origLU, ref delList);
|
||||
//dtLast = ShowDuration(dtLast, "chgList");
|
||||
string RoidList = GetRoidList(newROFst.RODbID, chgList);
|
||||
List<string> activeRoids = BuildActiveROIDsForRoUsages(RoidList);
|
||||
//dtLast = ShowDuration(dtLast, "RoidList");
|
||||
List<string> activeRoids = BuildActiveROIDsForRoUsages(RoidList, versionList);
|
||||
//dtLast = ShowDuration(dtLast, "activeRoids");
|
||||
foreach (string chg in chgList)
|
||||
{
|
||||
if (activeRoids.Contains(chg))
|
||||
@@ -389,7 +396,9 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
activeRoids = BuildActiveROIDsForDRoUsages(RoidList);
|
||||
//dtLast = ShowDuration(dtLast, "chg loop");
|
||||
activeRoids = BuildActiveROIDsForDRoUsages(RoidList, versionList);
|
||||
//dtLast = ShowDuration(dtLast, "activeRoids Doc");
|
||||
foreach (string chg in chgList)
|
||||
{
|
||||
if (activeRoids.Contains(chg))
|
||||
@@ -408,6 +417,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
//dtLast = ShowDuration(dtLast, "chg loop Doc");
|
||||
foreach (string del in delList)
|
||||
{
|
||||
string desc = string.Format("Deleted RO: Value = {0}", origLU.GetRoValue(del));
|
||||
@@ -437,6 +447,15 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
//dtLast = ShowDuration(dtLast, "delList");
|
||||
//dtStart = ShowDuration(dtStart, "Total");
|
||||
}
|
||||
|
||||
private static DateTime ShowDuration(DateTime dtLast, string message)
|
||||
{
|
||||
DateTime dtNext = DateTime.Now;
|
||||
Console.WriteLine("{0,10:#####0.00},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - dtLast.Ticks).TotalSeconds, message);
|
||||
return dtNext;
|
||||
}
|
||||
private static List<string> BuildActiveROIDsForRoUsages(string RoidList)
|
||||
{
|
||||
@@ -453,6 +472,21 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return activeRoids;
|
||||
}
|
||||
private static List<string> BuildActiveROIDsForRoUsages(string RoidList,string versions)
|
||||
{
|
||||
List<string> activeRoids = new List<string>();
|
||||
using (RoUsageInfoList activeList = RoUsageInfoList.GetROUSagesByROIDsAndVersions(RoidList,versions))
|
||||
{
|
||||
foreach (RoUsageInfo roui in activeList)
|
||||
{
|
||||
string roid = roui.ROID.ToUpper();
|
||||
if (roid.EndsWith("0000")) roid = roid.Substring(0, 12);
|
||||
if (!activeRoids.Contains(roid))
|
||||
activeRoids.Add(roid);
|
||||
}
|
||||
}
|
||||
return activeRoids;
|
||||
}
|
||||
private static List<string> BuildActiveROIDsForDRoUsages(string RoidList)
|
||||
{
|
||||
List<string> activeRoids = new List<string>();
|
||||
@@ -468,6 +502,21 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return activeRoids;
|
||||
}
|
||||
private static List<string> BuildActiveROIDsForDRoUsages(string RoidList,string versions)
|
||||
{
|
||||
List<string> activeRoids = new List<string>();
|
||||
using (DROUsageInfoList activeList = DROUsageInfoList.GetDROUsagesByROIDsAndVersions(RoidList,versions))
|
||||
{
|
||||
foreach (DROUsageInfo roui in activeList)
|
||||
{
|
||||
string roid = roui.ROID;
|
||||
if (roid.EndsWith("0000")) roid = roid.Substring(0, 12);
|
||||
if (!activeRoids.Contains(roid))
|
||||
activeRoids.Add(roid);
|
||||
}
|
||||
}
|
||||
return activeRoids;
|
||||
}
|
||||
private static string GetRoidList(int dbid, List<string> chgList)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(string.Format("{0}", dbid));
|
||||
|
Reference in New Issue
Block a user