This commit is contained in:
parent
27cb94f418
commit
afc16fb9f9
@ -68,6 +68,32 @@ namespace DataLoader
|
|||||||
* "Special Landscape, Elite, 6 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
|
||||||
|
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)
|
if (stype != null)
|
||||||
{
|
{
|
||||||
// stype[1] == 'p' or 'P' or '6' 'f' or 'L' get spc = 6
|
// 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;
|
string t1 = (title == null || title == "") ? null : title;
|
||||||
Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), DateTime.Now, "Migration", ".Doc");
|
Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), DateTime.Now, "Migration", ".Doc");
|
||||||
FileInfo tmpFile = new FileInfo(temppath);
|
FileInfo tmpFile = new FileInfo(temppath);
|
||||||
FileInfo doctmpFile = tmpFile.CopyTo(temppath.Substring(0,temppath.LastIndexOf(".")) + @".doc");
|
string docfile = temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc";
|
||||||
doc.UpdateDocAscii(temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc");
|
if (File.Exists(docfile)) File.Delete(docfile);
|
||||||
|
FileInfo doctmpFile = tmpFile.CopyTo(docfile);
|
||||||
|
doc.UpdateDocAscii(docfile);
|
||||||
doc.Save();
|
doc.Save();
|
||||||
|
File.Delete(docfile);
|
||||||
DocumentInfo di = DocumentInfo.Get(doc.DocID);
|
DocumentInfo di = DocumentInfo.Get(doc.DocID);
|
||||||
return doc.DocID;
|
return doc.DocID;
|
||||||
}
|
}
|
||||||
// for an io exception, keep trying
|
// for an io exception, keep trying
|
||||||
catch (IOException)
|
catch (IOException exio)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("IO: {0} - {1}", exio.GetType().Name, exio.Message);
|
||||||
Wait(2);
|
Wait(2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -53,14 +53,19 @@ namespace DataLoader
|
|||||||
|
|
||||||
private string GetProc(string setid, string procid)
|
private string GetProc(string setid, string procid)
|
||||||
{
|
{
|
||||||
|
string retval = null;
|
||||||
string xtproccmd = "SELECT * FROM [xtprocid] WHERE [SETID]='" + setid + "' AND [PROCID]='" + procid + "'";
|
string xtproccmd = "SELECT * FROM [xtprocid] WHERE [SETID]='" + setid + "' AND [PROCID]='" + procid + "'";
|
||||||
OleDbDataAdapter da = new OleDbDataAdapter(xtproccmd, _DbConnect);
|
using (OleDbDataAdapter da = new OleDbDataAdapter(xtproccmd, _DbConnect))
|
||||||
|
{
|
||||||
DataSet ds = new DataSet();
|
DataSet ds = new DataSet();
|
||||||
da.Fill(ds);
|
da.Fill(ds);
|
||||||
DataTable dt = ds.Tables[0];
|
DataTable dt = ds.Tables[0];
|
||||||
dt.CaseSensitive = true;
|
dt.CaseSensitive = true;
|
||||||
DataRow dr = dt.Rows[0]; // there should be only one entry!
|
DataRow dr = dt.Rows[0]; // there should be only one entry!
|
||||||
return dr["Procnum"].ToString(); // this should be the procedure number!
|
retval = dr["Procnum"].ToString(); // this should be the procedure number!
|
||||||
|
ds.Dispose();
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetPath(string setid)
|
private string GetPath(string setid)
|
||||||
@ -72,7 +77,10 @@ namespace DataLoader
|
|||||||
DataTable dt = ds.Tables[0];
|
DataTable dt = ds.Tables[0];
|
||||||
dt.CaseSensitive = true;
|
dt.CaseSensitive = true;
|
||||||
DataRow dr = dt.Rows[0]; // there should be only one entry!
|
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)
|
private string GetTitle(string setid, string procid)
|
||||||
@ -84,7 +92,10 @@ namespace DataLoader
|
|||||||
DataTable dt = ds.Tables[0];
|
DataTable dt = ds.Tables[0];
|
||||||
dt.CaseSensitive = true;
|
dt.CaseSensitive = true;
|
||||||
DataRow dr = dt.Rows[0]; // there should be only one entry!
|
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)
|
public string GetDescription(string key)
|
||||||
|
@ -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);
|
OleDbDataAdapter da = new OleDbDataAdapter("select * from [" + dr["entry"] + "] where sequence like ' %'", cn);
|
||||||
try
|
try
|
||||||
@ -174,6 +174,7 @@ namespace DataLoader
|
|||||||
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
|
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
|
||||||
log.Error(ex.StackTrace);
|
log.Error(ex.StackTrace);
|
||||||
}
|
}
|
||||||
|
da.Dispose();
|
||||||
|
|
||||||
// dicSecCount is dictionary to track number of subsections for the parent at a level
|
// dicSecCount is dictionary to track number of subsections for the parent at a level
|
||||||
// dicSecID is the parent at that level
|
// dicSecID is the parent at that level
|
||||||
@ -192,7 +193,6 @@ namespace DataLoader
|
|||||||
foreach (DataRowView drw in dv)
|
foreach (DataRowView drw in dv)
|
||||||
{
|
{
|
||||||
SectItm = MigrateSection(parentitem, ProcNumber, cn, drw, ds.Tables["Steps"], SectItm, dicSecCount.Count > 0 ? true : false, pth, docver);
|
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 no children, add first child (cont)
|
||||||
if (addpart)
|
if (addpart)
|
||||||
{
|
{
|
||||||
@ -234,6 +234,7 @@ namespace DataLoader
|
|||||||
itm.Save();
|
itm.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ds.Dispose();
|
||||||
return itm;
|
return itm;
|
||||||
}
|
}
|
||||||
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures)
|
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures)
|
||||||
@ -248,6 +249,7 @@ namespace DataLoader
|
|||||||
Item FrItm = null;
|
Item FrItm = null;
|
||||||
frmMain.pbProcMaximum = ds.Tables[0].Rows.Count;
|
frmMain.pbProcMaximum = ds.Tables[0].Rows.Count;
|
||||||
frmMain.UpdateLabels(0, 0, 0);
|
frmMain.UpdateLabels(0, 0, 0);
|
||||||
|
|
||||||
foreach (DataRow dr in ds.Tables[0].Rows)
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
||||||
{
|
{
|
||||||
FrItm = MigrateProcedure(cn, dr, FrItm, pth, docver, convertProcedures);
|
FrItm = MigrateProcedure(cn, dr, FrItm, pth, docver, convertProcedures);
|
||||||
|
@ -48,7 +48,13 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
log.Error("Error getting RO Usages");
|
log.Error("Error getting RO Usages");
|
||||||
log.ErrorFormat("proc number = {0}, oldstepsequence = {1}",ProcNumber, seqcvt);
|
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;
|
return textm;
|
||||||
}
|
}
|
||||||
int tok = textm.IndexOf('\x15');
|
int tok = textm.IndexOf('\x15');
|
||||||
@ -106,6 +112,8 @@ namespace DataLoader
|
|||||||
if (beg <= textm.Length - 1)
|
if (beg <= textm.Length - 1)
|
||||||
rotxt.Append(textm.Substring(beg, textm.Length - beg));
|
rotxt.Append(textm.Substring(beg, textm.Length - beg));
|
||||||
|
|
||||||
|
ds.Dispose();
|
||||||
|
da.Dispose();
|
||||||
return rotxt.ToString();
|
return rotxt.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,6 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
itm = Item.MakeItem(FromItem, cont, Dts, Userid);
|
itm = Item.MakeItem(FromItem, cont, Dts, Userid);
|
||||||
|
|
||||||
dicTrans_ItemDone[ProcNumber+"|"+trstpseq] = itm;
|
dicTrans_ItemDone[ProcNumber+"|"+trstpseq] = itm;
|
||||||
dicOldStepSequence[itm] = stpseq;
|
dicOldStepSequence[itm] = stpseq;
|
||||||
return itm;
|
return itm;
|
||||||
@ -200,7 +199,7 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
if ((ds.OldToNew & docstyle)>0) return (int)ds.Index;
|
if ((ds.OldToNew & docstyle)>0) return (int)ds.Index;
|
||||||
}
|
}
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
private FormatInfo GetFormat(Item procitem, DocVersion docver)
|
private FormatInfo GetFormat(Item procitem, DocVersion docver)
|
||||||
{
|
{
|
||||||
@ -258,6 +257,7 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
log.ErrorFormat("Error getting long section title {0}", ex.Message);
|
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
|
// For step sections, the long section title is stored on the section record
|
||||||
// (see above comment for accessory pages to see the difference)
|
// (see above comment for accessory pages to see the difference)
|
||||||
@ -442,7 +442,6 @@ namespace DataLoader
|
|||||||
libDocid = dicLibDocRef[thekey];
|
libDocid = dicLibDocRef[thekey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item secitem = AddSection(procitem, num, title, stype, dts, init, ci, step + sequence, fmt, libDocid, pth, FromItem, docver);
|
Item secitem = AddSection(procitem, num, title, stype, dts, init, ci, step + sequence, fmt, libDocid, pth, FromItem, docver);
|
||||||
thesectid = secitem.ItemID;
|
thesectid = secitem.ItemID;
|
||||||
|
|
||||||
|
@ -207,6 +207,8 @@ namespace DataLoader
|
|||||||
log.Error("Error getting transitions");
|
log.Error("Error getting transitions");
|
||||||
log.ErrorFormat("from number = {0} oldstepsequence = {1}", ProcNumber, seqcvt);
|
log.ErrorFormat("from number = {0} oldstepsequence = {1}", ProcNumber, seqcvt);
|
||||||
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
|
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
|
||||||
|
ds.Dispose();
|
||||||
|
da.Dispose();
|
||||||
return textm;
|
return textm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,6 +262,8 @@ namespace DataLoader
|
|||||||
log.ErrorFormat("Error - extra transition records for step, check data ");
|
log.ErrorFormat("Error - extra transition records for step, check data ");
|
||||||
log.ErrorFormat("from number = {0} oldstepsequence = {1}", ProcNumber, seqcvt);
|
log.ErrorFormat("from number = {0} oldstepsequence = {1}", ProcNumber, seqcvt);
|
||||||
}
|
}
|
||||||
|
ds.Dispose();
|
||||||
|
da.Dispose();
|
||||||
return trtxt.ToString();
|
return trtxt.ToString();
|
||||||
}
|
}
|
||||||
private void ShowMissingTransitions()
|
private void ShowMissingTransitions()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user