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,29 +188,36 @@ namespace DataLoader
{
DataRow drpsi = dt.Rows[0];
string psistr = drpsi["TEXTM"].ToString();
if (psistr != null && psistr != "")
{
StringReader strrd = new StringReader(psistr);
try
{
if (psistr != null && psistr != "")
{
StringReader strrd = new StringReader(psistr);
string sLine;
if (ci == null) ci = new ConfigInfo(null);
while ((sLine = strrd.ReadLine()) != null)
{
int indx = sLine.IndexOf(' ');
string nm = null;
string vl = null;
if (indx < 0)
nm = sLine;
else
{
nm = sLine.Substring(0, indx);
string tmpPsi = sLine.Substring(indx + 1, sLine.Length - indx - 1);
if (tmpPsi.Length > 0) tmpPsi=TextConvert.ConvertText(tmpPsi);
vl = tmpPsi;
}
ci.AddItem("PSI", nm, vl == null ? null : vl);
}
}
string sLine;
if (ci == null) ci = new ConfigInfo(null);
while ((sLine = strrd.ReadLine()) != null)
{
int indx = sLine.IndexOf(' ');
string nm = null;
string vl = null;
if (indx < 0)
nm = sLine;
else
{
nm = sLine.Substring(0, indx);
string tmpPsi = sLine.Substring(indx + 1, sLine.Length - indx - 1);
if (tmpPsi.Length > 0) tmpPsi = TextConvert.ConvertText(tmpPsi);
vl = tmpPsi;
}
ci.AddItem("PSI", nm, vl == null ? null : vl);
}
}
}
catch(Exception ex)
{
log.Warn("Failure during PSI", ex);
}
}
dapsi.Dispose();
}
@ -329,7 +336,7 @@ namespace DataLoader
// addpart = false;
//}
//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;
int subSecs = drw["Sequence"].ToString().PadRight(12, ' ')[5] - 48;
if (level > 0)
@ -357,7 +364,7 @@ namespace DataLoader
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();
//foreach (Item secItm in dicSecParentItem.Values)
@ -395,8 +402,8 @@ namespace DataLoader
// to. However, if reset, the 'oldto' may not contain a reference
// to a foldout, i.e. may contain 'junk' data. Only add the
// reference to the dictionary if it's a foldout.
int fromStep = drt["FROMSEQUEN"].ToString()[1] - '0';
int toStep = drt["TOSEQUENCE"].ToString()[1] - '0';
int fromStep = TextConvert.ConvertSeq(drt["FROMSEQUEN"].ToString())[1] - '0';
int toStep = TextConvert.ConvertSeq(drt["TOSEQUENCE"].ToString())[1] - '0';
string foldSeq = drt["OLDTO"].ToString().Substring(0, 2);
if (foldSeq[1] == 'F')
{
@ -512,8 +519,8 @@ namespace DataLoader
}
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
try
{
@ -521,6 +528,8 @@ namespace DataLoader
DataSet ds = new DataSet();
da.Fill(ds);
Item FrItm = null;
if (FirstItm != null)
FrItm = ItemInfo.Get(FirstItm.ItemID).LastSibling.Get();
frmMain.pbProcMaximum = ds.Tables[0].Rows.Count;
frmMain.UpdateLabels(0, 0, 0);
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;
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
{

View File

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