DataLoader changes during development

This commit is contained in:
2007-11-14 14:49:18 +00:00
parent da9b899424
commit ef81207dbe
28 changed files with 2118 additions and 962 deletions

View File

@@ -19,19 +19,13 @@ using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
using Volian.CSLA.Library;
using VEPROMS.CSLA.Library;
namespace DataLoader
{
public partial class frmLoader : Form
public partial class Loader
{
private void AddRoUsage(int structId, string ROID)
{
RoUsage ro = RoUsage.MakeRoUsage(structId, ROID);
ro.StructureID = structId;
ro.ROID = ROID;
}
private string MigrateRos(OleDbConnection cn, string textm, string seqcvt, int structId)
private string MigrateRos(OleDbConnection cn, string textm, string seqcvt, Content content)
{
StringBuilder rotxt = new StringBuilder();
int instance = 0;
@@ -39,7 +33,7 @@ namespace DataLoader
DataTable dt = null;
DataSet ds = null;
OleDbDataAdapter da = null;
//TODO: ZSteps
string cmd = "SELECT * FROM USAGERO WHERE [NUMBER]='" + ProcNumber.Replace("'", "''") + "' AND [SEQUENCE] ='" + seqcvt + "' ORDER BY [INSTANCE]";
da = new OleDbDataAdapter(cmd, cn);
// get usage records for the ROID.
@@ -63,17 +57,26 @@ namespace DataLoader
// found a token, add the roid & value into the string and
// add an ro usage for it.
rotxt.Append(textm.Substring(beg, tok - beg));
DataRow dr = dt.Rows[instance];
string ROID = dr["ROID"].ToString();
AddRoUsage(structId, ROID);
rotxt.Append("\x15{{");
rotxt.Append(ROID);
rotxt.Append("}{");
string val = rofst.GetRoValue(ROID.Substring(0, 12));
rotxt.Append(val);
rotxt.Append("}}");
instance++;
if (instance < dt.Rows.Count)
{
DataRow dr = dt.Rows[instance];
string ROID = dr["ROID"].ToString();
RoUsage ro = RoUsage.MakeRoUsage(content, ROID, null, DateTime.Now, "Migration");
rotxt.Append("\x15\\v RO\\v0 ");
string val = rofst.GetRoValue(ROID.Substring(0, 12).ToUpper());
rotxt.Append(val);
rotxt.Append("\\v #");
rotxt.Append(ro.ROUsageID.ToString());
rotxt.Append(" ");
rotxt.Append(ROID);
rotxt.Append("\\v0 ");
instance++;
}
else
{
log.Error("Error setting RO data in text field");
log.ErrorFormat("proc number = {0}, oldstepsequence = {1}, instance = {2}", ProcNumber, seqcvt, instance);
}
beg = tok + 1;
if (beg > textm.Length)
{
@@ -89,4 +92,5 @@ namespace DataLoader
return rotxt.ToString();
}
}
}