diff --git a/PROMS/DataLoader/DocVersions.cs b/PROMS/DataLoader/DocVersions.cs index d8c37637..565e8c86 100644 --- a/PROMS/DataLoader/DocVersions.cs +++ b/PROMS/DataLoader/DocVersions.cs @@ -26,37 +26,54 @@ namespace DataLoader public partial class Loader { public Item MigrateDocVersion(DocVersion docver) + { + return MigrateDocVersion(docver, true); + } + + private OutsideTransition _OutTran; + + public Item MigrateDocVersion(DocVersion docver, bool convertProcedures) { string pth = docver.Title; - // Open connection + // TODO: If set.dbf is missing or curset.dat is missing don't process it. + if (!File.Exists(pth + @"\set.dbf") || !File.Exists(pth + @"\curset.dat")) return null; // Open connection OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pth + ";Extended Properties=dBase III;Persist Security Info=False"); - // load rofst (use it later).... - rofst = new ROFST(pth + "\\ro.fst"); - // Migrate library documents - MigrateLibDocs(cn, pth); - // Initialize Dictionaries - dicTrans_ItemDone = new Dictionary(); - dicTrans_ItemIds = new Dictionary(); - - // Create a 'dummy' content record. This will be used for any transitions 'to' - // that don't exist when dbf is processed. At end, use this to see if there - // are missing transitions. - TransDummyCont = Content.MakeContent(null, "DUMMY CONTENT FOR TRANSITION MIGRATION", null, null, null); + if (convertProcedures) + { + _OutTran = new OutsideTransition(cn); + // load rofst (use it later).... + rofst = new ROFST(pth + "\\ro.fst"); + // Migrate library documents + MigrateLibDocs(cn, pth); + // Initialize Dictionaries + dicTrans_ItemDone = new Dictionary(); + dicTrans_ItemIds = new Dictionary(); + dicTrans_MigrationErrors = new Dictionary>(); + // Create a 'dummy' content record. This will be used for any transitions 'to' + // that don't exist when dbf is processed. At end, use this to see if there + // are missing transitions. + TransDummyCont = Content.MakeContent(null, "DUMMY CONTENT FOR TRANSITION MIGRATION", null, null, null); + } // Process Procedures - Item itm = MigrateProcedures(cn,pth,docver); + Item itm = null; + if (convertProcedures || docver.VersionType == (int)VEPROMS.CSLA.Library.VersionTypeEnum.WorkingDraft) + itm = MigrateProcedures(cn, pth, docver, convertProcedures); // Show any Missing Transtitons (i.e. Transitions which have not been processed) - ShowMissingTransitions(); - log.InfoFormat("Completed Migration of {0}", pth); - MessageBox.Show("Completed Migration of " + pth); - rofst.Close(); + if (convertProcedures) + { + ShowMissingTransitions(); + log.InfoFormat("Completed Migration of {0}", pth); + MessageBox.Show("Completed Migration of " + pth); + rofst.Close(); + dicTrans_ItemDone.Clear(); + dicTrans_ItemDone = null; + } cn.Close(); - dicTrans_ItemDone.Clear(); - dicTrans_ItemDone = null; if (itm != null) { docver.MyItem = itm; - docver.Title = ""; + if (convertProcedures) docver.Title = ""; // clearing this tell us this docver (path) was converted? if (!docver.IsSavable) ErrorRpt.ErrorReport(docver); docver.Save(); } diff --git a/PROMS/DataLoader/ErrorReport.cs b/PROMS/DataLoader/ErrorReport.cs index 1f273629..38726b04 100644 --- a/PROMS/DataLoader/ErrorReport.cs +++ b/PROMS/DataLoader/ErrorReport.cs @@ -9,6 +9,7 @@ namespace DataLoader { public static class ErrorRpt { + public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public static void ErrorReport(IVEHasBrokenRules mybr) { string smess = mybr.GetType().Name; @@ -22,7 +23,8 @@ namespace DataLoader smess += "\n" + br.Property + " - " + br.Description; } } - MessageBox.Show(smess); + //MessageBox.Show(smess); + _MyLog.Error(smess); } } }