Set the DocVersionConfig.Print_UnitNumberForPageList value based on BGE’s unit number in path

This commit is contained in:
Kathy Ruffing 2014-04-04 13:07:37 +00:00
parent decbe11e52
commit a1c02eb339

View File

@ -69,6 +69,15 @@ namespace DataLoader
frmMain.AddInfo("After MigrateROFST{0}\r\n{1}", GC.GetTotalMemory(true), VEPROMS.CSLA.Library.CSLACache.UsageAll);
// Migrate library documents
MigrateLibDocs(cn, pth);
// if migrating bge, save the 'unit' number. This unit number is used in pagelist items and is
// based on the path/directory name of the procedure set.
if (true) // somehow check for BGE
{
SetDocVersionUnitConfig(pth, docver);
}
// Initialize Dictionaries
dicTrans_ItemDone = new Dictionary<string, Item>();
dicTrans_ItemIds = new Dictionary<string, Item>();
@ -115,6 +124,34 @@ namespace DataLoader
}
return TimeSpan.FromTicks(lTime);
}
private void SetDocVersionUnitConfig(string pth, DocVersion docver)
{
// the following 'rules' were taken from 16bit code, in pagelist.c, to define the unit number.
string unitNum = "0";
string testPath = pth.ToUpper();
// back up further if this is a tmpchg or approved directory.
int lastPart = pth.LastIndexOf(@"\");
if (lastPart != -1)
{
testPath = testPath.Substring(testPath.LastIndexOf(@"\"));
if (testPath.Contains("TMPCHG") || testPath.Contains("APPROVED"))
testPath = testPath.Substring(testPath.LastIndexOf(@"\", lastPart));
}
if (testPath.IndexOf("PROCS2") > -1 || testPath.IndexOf("2.PRC") > -1)
unitNum = "2";
else if (testPath.IndexOf("PROCS") > -1 || testPath.IndexOf("1.PRC") > -1)
unitNum = "1";
else if (testPath.IndexOf("3.PRC") > -1)
unitNum = "3";
else if (testPath.IndexOf("4.PRC") > -1)
unitNum = "4";
docver.DocVersionConfig.Print_UnitNumberForPageList = unitNum;
docver.Save();
}
private void DeleteINFFiles(string pth)
{
DirectoryInfo di = new DirectoryInfo(pth);