Add error handler for PSI failures.
Support appending to an existing Procedure Set
This commit is contained in:
parent
7511ebcd2c
commit
13d9350fdf
@ -188,29 +188,36 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
DataRow drpsi = dt.Rows[0];
|
DataRow drpsi = dt.Rows[0];
|
||||||
string psistr = drpsi["TEXTM"].ToString();
|
string psistr = drpsi["TEXTM"].ToString();
|
||||||
if (psistr != null && psistr != "")
|
try
|
||||||
{
|
{
|
||||||
StringReader strrd = new StringReader(psistr);
|
if (psistr != null && psistr != "")
|
||||||
|
{
|
||||||
|
StringReader strrd = new StringReader(psistr);
|
||||||
|
|
||||||
string sLine;
|
string sLine;
|
||||||
if (ci == null) ci = new ConfigInfo(null);
|
if (ci == null) ci = new ConfigInfo(null);
|
||||||
while ((sLine = strrd.ReadLine()) != null)
|
while ((sLine = strrd.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
int indx = sLine.IndexOf(' ');
|
int indx = sLine.IndexOf(' ');
|
||||||
string nm = null;
|
string nm = null;
|
||||||
string vl = null;
|
string vl = null;
|
||||||
if (indx < 0)
|
if (indx < 0)
|
||||||
nm = sLine;
|
nm = sLine;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nm = sLine.Substring(0, indx);
|
nm = sLine.Substring(0, indx);
|
||||||
string tmpPsi = sLine.Substring(indx + 1, sLine.Length - indx - 1);
|
string tmpPsi = sLine.Substring(indx + 1, sLine.Length - indx - 1);
|
||||||
if (tmpPsi.Length > 0) tmpPsi=TextConvert.ConvertText(tmpPsi);
|
if (tmpPsi.Length > 0) tmpPsi = TextConvert.ConvertText(tmpPsi);
|
||||||
vl = tmpPsi;
|
vl = tmpPsi;
|
||||||
}
|
}
|
||||||
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')
|
||||||
{
|
{
|
||||||
@ -512,8 +519,8 @@ 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
|
||||||
{
|
{
|
||||||
|
@ -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.
|
||||||
DocVersionAssociation dva = docver.DocVersionAssociations.Add(rofst);
|
bool appending = false;
|
||||||
AssociationConfig assoc_cfg = new AssociationConfig();
|
if (docver.DocVersionAssociationCount == 0)
|
||||||
assoc_cfg.RODefaults_graphicsprefix = img_prefix;
|
{
|
||||||
assoc_cfg.RODefaults_setpointprefix = sp_prefix;
|
DocVersionAssociation dva = docver.DocVersionAssociations.Add(rofst);
|
||||||
dva.Config = assoc_cfg.ToString();
|
AssociationConfig assoc_cfg = new AssociationConfig();
|
||||||
docver.Save();
|
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!
|
rofstinfo = ROFstInfo.Get(rofst.ROFstID); // refresh the info record!
|
||||||
rofst.Dispose();
|
|
||||||
|
|
||||||
// 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++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user