Add error handler for PSI failures.

Support appending to an existing Procedure Set
This commit is contained in:
Rich 2014-12-08 20:25:37 +00:00
parent 7511ebcd2c
commit 13d9350fdf
2 changed files with 53 additions and 37 deletions

View File

@ -188,6 +188,8 @@ namespace DataLoader
{ {
DataRow drpsi = dt.Rows[0]; DataRow drpsi = dt.Rows[0];
string psistr = drpsi["TEXTM"].ToString(); string psistr = drpsi["TEXTM"].ToString();
try
{
if (psistr != null && psistr != "") if (psistr != null && psistr != "")
{ {
StringReader strrd = new StringReader(psistr); StringReader strrd = new StringReader(psistr);
@ -210,6 +212,11 @@ namespace DataLoader
} }
ci.AddItem("PSI", nm, vl == null ? null : vl); ci.AddItem("PSI", nm, vl == null ? null : vl);
} }
}
}
catch(Exception ex)
{
log.Warn("Failure during PSI", ex);
} }
} }
dapsi.Dispose(); dapsi.Dispose();
@ -329,7 +336,7 @@ namespace DataLoader
// addpart = false; // addpart = false;
//} //}
//FrType = 0; //FrType = 0;
Console.WriteLine("'before',{0},{1},{2},{3}", SectItm == null ? "" : SectItm.DisplayNumber, parentitem.DisplayNumber, level, dicSecCount.Count > 0 ? dicSecCount[level] : 0); //Console.WriteLine("'before',{0},{1},{2},{3}", SectItm == null ? "" : SectItm.DisplayNumber, parentitem.DisplayNumber, level, dicSecCount.Count > 0 ? dicSecCount[level] : 0);
dicSecParentItem[level] = SectItm; dicSecParentItem[level] = SectItm;
int subSecs = drw["Sequence"].ToString().PadRight(12, ' ')[5] - 48; int subSecs = drw["Sequence"].ToString().PadRight(12, ' ')[5] - 48;
if (level > 0) if (level > 0)
@ -357,7 +364,7 @@ namespace DataLoader
parentitem = itm; parentitem = itm;
} }
} }
Console.WriteLine("'after',{0},{1},{2},{3}", SectItm == null ? "" : SectItm.DisplayNumber, parentitem.DisplayNumber, level, dicSecCount.Count > 0 ? dicSecCount[level] : 0); //Console.WriteLine("'after',{0},{1},{2},{3}", SectItm == null ? "" : SectItm.DisplayNumber, parentitem.DisplayNumber, level, dicSecCount.Count > 0 ? dicSecCount[level] : 0);
} }
dv.Dispose(); dv.Dispose();
//foreach (Item secItm in dicSecParentItem.Values) //foreach (Item secItm in dicSecParentItem.Values)
@ -395,8 +402,8 @@ namespace DataLoader
// to. However, if reset, the 'oldto' may not contain a reference // to. However, if reset, the 'oldto' may not contain a reference
// to a foldout, i.e. may contain 'junk' data. Only add the // to a foldout, i.e. may contain 'junk' data. Only add the
// reference to the dictionary if it's a foldout. // reference to the dictionary if it's a foldout.
int fromStep = drt["FROMSEQUEN"].ToString()[1] - '0'; int fromStep = TextConvert.ConvertSeq(drt["FROMSEQUEN"].ToString())[1] - '0';
int toStep = drt["TOSEQUENCE"].ToString()[1] - '0'; int toStep = TextConvert.ConvertSeq(drt["TOSEQUENCE"].ToString())[1] - '0';
string foldSeq = drt["OLDTO"].ToString().Substring(0, 2); string foldSeq = drt["OLDTO"].ToString().Substring(0, 2);
if (foldSeq[1] == 'F') if (foldSeq[1] == 'F')
{ {
@ -513,7 +520,7 @@ namespace DataLoader
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures, FormatInfo activeFormat) private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures, FormatInfo activeFormat)
{ {
Item FirstItm = null; Item FirstItm = docver.MyItem;// null;
// Loop through Set File for each Procedure // Loop through Set File for each Procedure
try try
{ {
@ -521,6 +528,8 @@ namespace DataLoader
DataSet ds = new DataSet(); DataSet ds = new DataSet();
da.Fill(ds); da.Fill(ds);
Item FrItm = null; Item FrItm = null;
if (FirstItm != null)
FrItm = ItemInfo.Get(FirstItm.ItemID).LastSibling.Get();
frmMain.pbProcMaximum = ds.Tables[0].Rows.Count; frmMain.pbProcMaximum = ds.Tables[0].Rows.Count;
frmMain.UpdateLabels(0, 0, 0); frmMain.UpdateLabels(0, 0, 0);
dicSetfileEntries = new Dictionary<string, string>(); // used to check for duplicate SET file info - jsj 2/11/10 dicSetfileEntries = new Dictionary<string, string>(); // used to check for duplicate SET file info - jsj 2/11/10
@ -528,7 +537,8 @@ namespace DataLoader
frmMain.ShowSections = convertProcedures; frmMain.ShowSections = convertProcedures;
foreach (DataRow dr in ds.Tables[0].Rows) foreach (DataRow dr in ds.Tables[0].Rows)
{ {
if (++i > frmMain.SkipProcedures) i++;
if (i > frmMain.SkipProcedures && (frmMain.HowManyProcedures == 0|| i <= (frmMain.SkipProcedures + frmMain.HowManyProcedures) ))
{ {
if (OKtoProcessDBF(dr, pth)) // look for duplicate SET file info - jsj 2/11/10 if (OKtoProcessDBF(dr, pth)) // look for duplicate SET file info - jsj 2/11/10
{ {

View File

@ -90,18 +90,24 @@ namespace DataLoader
rofst = ROFst.MakeROFst(rodb, ab, null, fi.LastWriteTimeUtc, "Migration"); rofst = ROFst.MakeROFst(rodb, ab, null, fi.LastWriteTimeUtc, "Migration");
} }
// Next hook the rofst to the docversion using the associations table. // Next hook the rofst to the docversion using the associations table.
bool appending = false;
if (docver.DocVersionAssociationCount == 0)
{
DocVersionAssociation dva = docver.DocVersionAssociations.Add(rofst); DocVersionAssociation dva = docver.DocVersionAssociations.Add(rofst);
AssociationConfig assoc_cfg = new AssociationConfig(); AssociationConfig assoc_cfg = new AssociationConfig();
assoc_cfg.RODefaults_graphicsprefix = img_prefix; assoc_cfg.RODefaults_graphicsprefix = img_prefix;
assoc_cfg.RODefaults_setpointprefix = sp_prefix; assoc_cfg.RODefaults_setpointprefix = sp_prefix;
dva.Config = assoc_cfg.ToString(); dva.Config = assoc_cfg.ToString();
docver.Save(); docver.Save();
rofstinfo = ROFstInfo.Get(rofst.ROFstID); // refresh the info record!
rofst.Dispose(); rofst.Dispose();
}
else
appending = true;
rofstinfo = ROFstInfo.Get(rofst.ROFstID); // refresh the info record!
// Now load any images in... type 8: // Intergrated Graphics RO type // Now load any images in... type 8: // Intergrated Graphics RO type
ROFSTLookup mylookup = rofstinfo.GetROFSTLookup(DocVersionInfo.Get(docver.VersionID)); ROFSTLookup mylookup = rofstinfo.GetROFSTLookup(DocVersionInfo.Get(docver.VersionID));
if (mylookup != null) if (!appending && mylookup != null)
{ {
for (int i = 0; i < mylookup.myHdr.myDbs.Length; i++) for (int i = 0; i < mylookup.myHdr.myDbs.Length; i++)
{ {