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

View File

@ -68,6 +68,32 @@ namespace DataLoader
* "Special Landscape, Elite, 6 lines per inch"
*/
if (stype != null)
{
// stype[1] == 'p' or 'P' or '6' 'f' or 'L' get spc = 6
int lpi = 6;
if (stype[1] == '*') lpi = 8;
else if (stype[1] == '4') lpi = 4;
else if (stype[1] == '7') lpi = 7;
// if need landscape set too: bool landscape = (stype[1] == 'L');
d.SetLineSpacing(lpi); // if need landscape set too: , landscape); ;
}
string temppath = Path.GetTempFileName();
/* 16-bit's type[1] used the following codes to represent the respective lpi setting
*
* char far typestr[] = "*pP46f7L";
*
* char * far printtypes[] = {
* "Compressed, 8 lines per inch",
* "Elite, 6 lines per inch",
* "Pica, 6 lines per inch",
* "Default font, 4 Lines Per Inch",
* "Default font, 6 Lines Per Inch",
* "Compressed 6 LPI",
* "Default font, 7 Lines Per Inch",
* "Special Landscape, Elite, 6 lines per inch"
*/
if (stype != null)
{
// stype[1] == 'p' or 'P' or '6' 'f' or 'L' get spc = 6
@ -111,15 +137,19 @@ namespace DataLoader
string t1 = (title == null || title == "") ? null : title;
Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), DateTime.Now, "Migration", ".Doc");
FileInfo tmpFile = new FileInfo(temppath);
FileInfo doctmpFile = tmpFile.CopyTo(temppath.Substring(0,temppath.LastIndexOf(".")) + @".doc");
doc.UpdateDocAscii(temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc");
string docfile = temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc";
if (File.Exists(docfile)) File.Delete(docfile);
FileInfo doctmpFile = tmpFile.CopyTo(docfile);
doc.UpdateDocAscii(docfile);
doc.Save();
File.Delete(docfile);
DocumentInfo di = DocumentInfo.Get(doc.DocID);
return doc.DocID;
}
// for an io exception, keep trying
catch (IOException)
catch (IOException exio)
{
Console.WriteLine("IO: {0} - {1}", exio.GetType().Name, exio.Message);
Wait(2);
return 0;
}
@ -143,4 +173,4 @@ namespace DataLoader
return done;
}
}
}
}

View File

@ -53,14 +53,19 @@ namespace DataLoader
private string GetProc(string setid, string procid)
{
string retval = null;
string xtproccmd = "SELECT * FROM [xtprocid] WHERE [SETID]='" + setid + "' AND [PROCID]='" + procid + "'";
OleDbDataAdapter da = new OleDbDataAdapter(xtproccmd, _DbConnect);
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dt = ds.Tables[0];
dt.CaseSensitive = true;
DataRow dr = dt.Rows[0]; // there should be only one entry!
return dr["Procnum"].ToString(); // this should be the procedure number!
using (OleDbDataAdapter da = new OleDbDataAdapter(xtproccmd, _DbConnect))
{
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dt = ds.Tables[0];
dt.CaseSensitive = true;
DataRow dr = dt.Rows[0]; // there should be only one entry!
retval = dr["Procnum"].ToString(); // this should be the procedure number!
ds.Dispose();
}
return retval;
}
private string GetPath(string setid)
@ -72,7 +77,10 @@ namespace DataLoader
DataTable dt = ds.Tables[0];
dt.CaseSensitive = true;
DataRow dr = dt.Rows[0]; // there should be only one entry!
return dr["Path"].ToString(); // this should be the path to the proc set!
string retval = dr["Path"].ToString();
da.Dispose();
ds.Dispose();
return retval; // dr["Path"].ToString(); // this should be the path to the proc set!
}
private string GetTitle(string setid, string procid)
@ -84,7 +92,10 @@ namespace DataLoader
DataTable dt = ds.Tables[0];
dt.CaseSensitive = true;
DataRow dr = dt.Rows[0]; // there should be only one entry!
return dr["Proctitle"].ToString(); // this should be the procedure number!
string retval = dr["Proctitle"].ToString();
da.Dispose();
ds.Dispose();
return retval; // dr["Proctitle"].ToString(); // this should be the procedure number!
}
public string GetDescription(string key)

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);

View File

@ -48,7 +48,13 @@ namespace DataLoader
{
log.Error("Error getting RO Usages");
log.ErrorFormat("proc number = {0}, oldstepsequence = {1}",ProcNumber, seqcvt);
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
do
{
log.ErrorFormat("{0} - {1}", ex.GetType().Name, ex.Message);
ex = ex.InnerException;
} while (ex != null);
ds.Dispose();
da.Dispose();
return textm;
}
int tok = textm.IndexOf('\x15');
@ -105,7 +111,9 @@ namespace DataLoader
}
if (beg <= textm.Length - 1)
rotxt.Append(textm.Substring(beg, textm.Length - beg));
ds.Dispose();
da.Dispose();
return rotxt.ToString();
}
}

View File

@ -116,7 +116,6 @@ namespace DataLoader
}
else
itm = Item.MakeItem(FromItem, cont, Dts, Userid);
dicTrans_ItemDone[ProcNumber+"|"+trstpseq] = itm;
dicOldStepSequence[itm] = stpseq;
return itm;
@ -200,7 +199,7 @@ namespace DataLoader
{
if ((ds.OldToNew & docstyle)>0) return (int)ds.Index;
}
return -1;
return 0;
}
private FormatInfo GetFormat(Item procitem, DocVersion docver)
{
@ -258,6 +257,7 @@ namespace DataLoader
{
log.ErrorFormat("Error getting long section title {0}", ex.Message);
}
da.Dispose();
}
// For step sections, the long section title is stored on the section record
// (see above comment for accessory pages to see the difference)
@ -442,7 +442,6 @@ namespace DataLoader
libDocid = dicLibDocRef[thekey];
}
}
Item secitem = AddSection(procitem, num, title, stype, dts, init, ci, step + sequence, fmt, libDocid, pth, FromItem, docver);
thesectid = secitem.ItemID;

View File

@ -207,6 +207,8 @@ namespace DataLoader
log.Error("Error getting transitions");
log.ErrorFormat("from number = {0} oldstepsequence = {1}", ProcNumber, seqcvt);
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
ds.Dispose();
da.Dispose();
return textm;
}
}
@ -260,6 +262,8 @@ namespace DataLoader
log.ErrorFormat("Error - extra transition records for step, check data ");
log.ErrorFormat("from number = {0} oldstepsequence = {1}", ProcNumber, seqcvt);
}
ds.Dispose();
da.Dispose();
return trtxt.ToString();
}
private void ShowMissingTransitions()