This commit is contained in:
2009-11-03 16:31:30 +00:00
parent 27cb94f418
commit afc16fb9f9
6 changed files with 102 additions and 48 deletions

View File

@@ -71,7 +71,7 @@ namespace DataLoader
// if the dbt is bad, fix it.
DbtOk(dr["entry"].ToString(),pth);
// See if there is PSI and if so, add it to the xml.
OleDbDataAdapter dapsi = new OleDbDataAdapter("select * from [" + dr["entry"] + "] where [STEP] is null", cn);
OleDbDataAdapter dapsi = new OleDbDataAdapter("select * from [" + dr["entry"] + "] where [STEP] is null", cn);
try
{
dapsi.Fill(ds);
@@ -81,35 +81,35 @@ namespace DataLoader
Console.WriteLine(ex.Message);
Application.Exit();
}
dt = ds.Tables[0];
dt = ds.Tables[0];
if (dt.Rows.Count > 0)
{
DataRow drpsi = dt.Rows[0];
string psistr = drpsi["TEXTM"].ToString();
if (psistr != null && psistr != "")
{
StringReader strrd = new StringReader(psistr);
if (dt.Rows.Count > 0)
{
DataRow drpsi = dt.Rows[0];
string psistr = drpsi["TEXTM"].ToString();
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);
vl = sLine.Substring(indx + 1, sLine.Length - indx - 1);
}
ci.AddItem("PSI", nm, vl == null ? null : vl);
}
}
}
dapsi.Dispose();
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);
vl = sLine.Substring(indx + 1, sLine.Length - indx - 1);
}
ci.AddItem("PSI", nm, vl == null ? null : vl);
}
}
}
dapsi.Dispose();
}
else // log an error
{
@@ -146,7 +146,7 @@ namespace DataLoader
}
}
}
if (convertProcedures /* && number == "0POP05-EO-EC00"*/)
if (convertProcedures /*&& number == "0POP05\\u8209?EO\\u8209?ES32"*/) //0POP05\u8209?EO\u8209?ES32
{
OleDbDataAdapter da = new OleDbDataAdapter("select * from [" + dr["entry"] + "] where sequence like ' %'", cn);
try
@@ -174,6 +174,7 @@ namespace DataLoader
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
log.Error(ex.StackTrace);
}
da.Dispose();
// dicSecCount is dictionary to track number of subsections for the parent at a level
// dicSecID is the parent at that level
@@ -192,7 +193,6 @@ namespace DataLoader
foreach (DataRowView drw in dv)
{
SectItm = MigrateSection(parentitem, ProcNumber, cn, drw, ds.Tables["Steps"], SectItm, dicSecCount.Count > 0 ? true : false, pth, docver);
// if no children, add first child (cont)
if (addpart)
{
@@ -234,6 +234,7 @@ namespace DataLoader
itm.Save();
}
}
ds.Dispose();
return itm;
}
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures)
@@ -248,6 +249,7 @@ namespace DataLoader
Item FrItm = null;
frmMain.pbProcMaximum = ds.Tables[0].Rows.Count;
frmMain.UpdateLabels(0, 0, 0);
foreach (DataRow dr in ds.Tables[0].Rows)
{
FrItm = MigrateProcedure(cn, dr, FrItm, pth, docver, convertProcedures);