101 lines
3.5 KiB
C#
101 lines
3.5 KiB
C#
// ========================================================================
|
|
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
|
|
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
|
// ------------------------------------------------------------------------
|
|
// $Workfile: $ $Revision: $
|
|
// $Author: $ $Date: $
|
|
//
|
|
// $History: $
|
|
// ========================================================================
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
using System.Data;
|
|
using System.Data.OleDb;
|
|
using System.Collections.Specialized;
|
|
using System.Collections.Generic;
|
|
using System.Xml;
|
|
using System.IO;
|
|
using System.Text;
|
|
using VEPROMS.CSLA.Library;
|
|
|
|
namespace DataLoader
|
|
{
|
|
public partial class Loader
|
|
{
|
|
private string MigrateRos(OleDbConnection cn, string textm, string seqcvt, Content content, DocVersion docver)
|
|
{
|
|
StringBuilder rotxt = new StringBuilder();
|
|
int instance = 0;
|
|
int beg = 0;
|
|
DataTable dt = null;
|
|
DataSet ds = null;
|
|
OleDbDataAdapter da = null;
|
|
|
|
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.
|
|
ds = new DataSet();
|
|
try
|
|
{
|
|
da.Fill(ds);
|
|
dt = ds.Tables[0];
|
|
dt.CaseSensitive = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
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);
|
|
return textm;
|
|
}
|
|
int tok = textm.IndexOf('\x15');
|
|
while (tok > -1)
|
|
{
|
|
// found a token, add the roid & value into the string and
|
|
// add an ro usage for it.
|
|
rotxt.Append(textm.Substring(beg, tok - beg));
|
|
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", rodb);
|
|
try
|
|
{
|
|
string rov = rofstinfo.ROFSTLookup.GetRoValue(ROID.Substring(0, 12).ToUpper());
|
|
string results = string.Format(@"{0}{1}\v #Link:ReferencedObject:{2} {3} {4}\v0",
|
|
'\x15', rofstinfo.ROFSTLookup.GetRoValue(ROID.Substring(0, 12).ToUpper()), ro.ROUsageID, ROID, rodb.RODbID);
|
|
rotxt.Append(results);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("Error setting RO data in text field");
|
|
log.ErrorFormat("Error Message = {0}", ex.Message);
|
|
log.ErrorFormat("proc number = {0}, oldstepsequence = {1}, instance = {2}", ProcNumber, seqcvt, instance);
|
|
}
|
|
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)
|
|
{
|
|
tok = -1;
|
|
da.Dispose();
|
|
}
|
|
else
|
|
tok = textm.IndexOf('\x15', beg);
|
|
}
|
|
if (beg < textm.Length - 1)
|
|
rotxt.Append(textm.Substring(beg, textm.Length - beg));
|
|
|
|
return rotxt.ToString();
|
|
}
|
|
}
|
|
|
|
} |