From a1c02eb3393ad92fe645b3beed1b0d8f413fbf9a Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 4 Apr 2014 13:07:37 +0000 Subject: [PATCH] =?UTF-8?q?Set=20the=20DocVersionConfig.Print=5FUnitNumber?= =?UTF-8?q?ForPageList=20value=20based=20on=20BGE=E2=80=99s=20unit=20numbe?= =?UTF-8?q?r=20in=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/DataLoader/DocVersions.cs | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/PROMS/DataLoader/DocVersions.cs b/PROMS/DataLoader/DocVersions.cs index 8360d3c7..4af5bd3d 100644 --- a/PROMS/DataLoader/DocVersions.cs +++ b/PROMS/DataLoader/DocVersions.cs @@ -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(); dicTrans_ItemIds = new Dictionary(); @@ -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);