This commit is contained in:
parent
d5ab27cb80
commit
c83ee4259a
@ -11,13 +11,16 @@ using System.Xml;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using VEPROMS.CSLA.Library;
|
using VEPROMS.CSLA.Library;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace DataLoader
|
namespace DataLoader
|
||||||
{
|
{
|
||||||
public partial class Loader
|
public partial class Loader
|
||||||
{
|
{
|
||||||
private Item AddStep(OleDbConnection cn, string StepType, string Textm, string Recid, string stpseq, string structtype, Item FromItem, DateTime dts, string userid, bool conv_caret, string pth, DocVersion docver)
|
private Item AddStep(OleDbConnection cn, string StepType, string Textm, string Recid, string stpseq, string structtype, Item FromItem, DateTime dts, string userid, bool conv_caret, string pth, DocVersion docver, FormatInfo fmt)
|
||||||
{
|
{
|
||||||
|
//if (ProcNumber + "|" + stpseq == "082-002CD|A=S")
|
||||||
|
// Console.WriteLine("here");
|
||||||
Content content = null;
|
Content content = null;
|
||||||
Item item = null;
|
Item item = null;
|
||||||
|
|
||||||
@ -55,11 +58,15 @@ namespace DataLoader
|
|||||||
string newstptyp = null;
|
string newstptyp = null;
|
||||||
bool ManualPagebreak = false;
|
bool ManualPagebreak = false;
|
||||||
char cbittst = StepType.PadRight(2)[0];
|
char cbittst = StepType.PadRight(2)[0];
|
||||||
if (cbittst != ' ' && (cbittst & 0x80) > 1)
|
//Console.WriteLine(string.Format("AddStep() StepType {0} cbitst = {1} OR'd 0x80 = {2}",StepType,Convert.ToInt16(cbittst),(cbittst & 0x80)));
|
||||||
|
if (cbittst != ' ' && (cbittst & 0xFF80) > 1)//(cbittst & 0x80) > 1)
|
||||||
{
|
{
|
||||||
ManualPagebreak = true;
|
ManualPagebreak = true;
|
||||||
//if (ci == null) ci = new ConfigInfo(null);
|
//if (ci == null) ci = new ConfigInfo(null);
|
||||||
ci.AddItem("Step", "ManualPagebreak", "True");
|
ci.AddItem("Step", "ManualPagebreak", "True");
|
||||||
|
if ((Convert.ToInt16(cbittst)) == 9508) //page break on HIGH5 step type (40)
|
||||||
|
newstptyp = "40";
|
||||||
|
else
|
||||||
newstptyp = StepType.Substring(1, 1);
|
newstptyp = StepType.Substring(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +101,12 @@ namespace DataLoader
|
|||||||
stptext = MigrateTrans(cn, stptext, seqcvt, content, pth);
|
stptext = MigrateTrans(cn, stptext, seqcvt, content, pth);
|
||||||
stptext = stptext.TrimEnd(" ".ToCharArray());
|
stptext = stptext.TrimEnd(" ".ToCharArray());
|
||||||
}
|
}
|
||||||
|
string fixStpText = FixStepText(stptext);
|
||||||
|
if (fixStpText != stptext)
|
||||||
|
{
|
||||||
|
txtdirty = true;
|
||||||
|
stptext = fixStpText;
|
||||||
|
}
|
||||||
if (txtdirty)
|
if (txtdirty)
|
||||||
{
|
{
|
||||||
content.Text = stptext;
|
content.Text = stptext;
|
||||||
@ -119,6 +132,15 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
item = Item.MakeItem(FromItem, content, content.DTS, content.UserID);
|
item = Item.MakeItem(FromItem, content, content.DTS, content.UserID);
|
||||||
|
|
||||||
|
// Remove styles that user entered but are automatically done via the format
|
||||||
|
string tstr = item.MyItemInfo.RemoveRtfStyles(content.Text,fmt);
|
||||||
|
if (tstr != content.Text)
|
||||||
|
{
|
||||||
|
item.MyContent.Text = tstr;
|
||||||
|
item.Save();
|
||||||
|
}
|
||||||
|
|
||||||
if (migrationerrors != null)
|
if (migrationerrors != null)
|
||||||
{
|
{
|
||||||
foreach (string str in migrationerrors)
|
foreach (string str in migrationerrors)
|
||||||
@ -251,6 +273,21 @@ namespace DataLoader
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Regex _ReplaceSpaceNewLine = new Regex(@"(?<=\\[^' \\?\r\n\t]*) (?=\r\n)");
|
||||||
|
private Regex _ReplaceTokenSpaceToken = new Regex(@"(?<=\\[^' \\?\r\n\t]*) (?=\\)");
|
||||||
|
private string FixStepText(string stepText)
|
||||||
|
{
|
||||||
|
stepText = stepText.Replace("\xF8", @"\'f8");
|
||||||
|
stepText = stepText.Replace(@"\par ", "\r\n");
|
||||||
|
stepText = _ReplaceTokenSpaceToken.Replace(stepText, "");
|
||||||
|
//stepText = stepText.Replace(@"\v0 \", @"\v0\");
|
||||||
|
//Change Token Order to match RTB output
|
||||||
|
stepText = stepText.Replace(@"\v0\b0", @"\b0\v0");
|
||||||
|
stepText = stepText.Replace(@"\b0\ulnone", @"\ulnone\b0");
|
||||||
|
stepText = _ReplaceSpaceNewLine.Replace(stepText, "");
|
||||||
|
return stepText;
|
||||||
|
}
|
||||||
|
|
||||||
//private static bool AddContentDetail(Content content, int type, string strn)
|
//private static bool AddContentDetail(Content content, int type, string strn)
|
||||||
//{
|
//{
|
||||||
// if (strn != null && strn.Trim() != "" )
|
// if (strn != null && strn.Trim() != "" )
|
||||||
@ -297,7 +334,7 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
private Item MigrateStep(OleDbConnection cn, DataTable dt, DataRowView drv, Item FromItem, bool conv_caret, string pth, DocVersion docver)
|
private Item MigrateStep(OleDbConnection cn, DataTable dt, DataRowView drv, Item FromItem, bool conv_caret, string pth, DocVersion docver, FormatInfo fmt)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -305,7 +342,7 @@ namespace DataLoader
|
|||||||
Item item = AddStep(cn, drv["Type"].ToString()
|
Item item = AddStep(cn, drv["Type"].ToString()
|
||||||
, (drv["textm"] == DBNull.Value ? drv["Text"].ToString() : drv["Textm"].ToString())
|
, (drv["textm"] == DBNull.Value ? drv["Text"].ToString() : drv["Textm"].ToString())
|
||||||
, drv["Recid"].ToString(), drv["CStep"].ToString() + drv["CSequence"].ToString(), "S", FromItem // was str
|
, drv["Recid"].ToString(), drv["CStep"].ToString() + drv["CSequence"].ToString(), "S", FromItem // was str
|
||||||
, GetDTS(drv["Date"].ToString(), drv["Time"].ToString()), drv["Initials"].ToString(), conv_caret, pth, docver);
|
, GetDTS(drv["Date"].ToString(), drv["Time"].ToString()), drv["Initials"].ToString(), conv_caret, pth, docver, fmt);
|
||||||
//Content cont = Content.MakeContent(null,(drv["textm"] == DBNull.Value ? drv["Text"].ToString() : drv["Textm"].ToString()),drv["Type"]+20000,null,null,
|
//Content cont = Content.MakeContent(null,(drv["textm"] == DBNull.Value ? drv["Text"].ToString() : drv["Textm"].ToString()),drv["Type"]+20000,null,null,
|
||||||
// GetDTS(drv["Date"].ToString(), drv["Time"].ToString()), drv["Initials"].ToString());
|
// GetDTS(drv["Date"].ToString(), drv["Time"].ToString()), drv["Initials"].ToString());
|
||||||
//Item item = Item.MakeItem(FromItem, cont, cont.DTS, cont.UserID);
|
//Item item = Item.MakeItem(FromItem, cont, cont.DTS, cont.UserID);
|
||||||
@ -358,7 +395,7 @@ namespace DataLoader
|
|||||||
, (drvs["textm"] == DBNull.Value ? drvs["Text"].ToString() : drvs["Textm"].ToString())
|
, (drvs["textm"] == DBNull.Value ? drvs["Text"].ToString() : drvs["Textm"].ToString())
|
||||||
, drv["Recid"].ToString(), drvs["CStep"].ToString() + drvs["CSequence"].ToString()
|
, drv["Recid"].ToString(), drvs["CStep"].ToString() + drvs["CSequence"].ToString()
|
||||||
, GetStructType(drvs["sequence"].ToString()), FrItem
|
, GetStructType(drvs["sequence"].ToString()), FrItem
|
||||||
, GetDTS(drvs["Date"].ToString(), drvs["Time"].ToString()), drvs["Initials"].ToString(), conv_caret, pth, docver);
|
, GetDTS(drvs["Date"].ToString(), drvs["Time"].ToString()), drvs["Initials"].ToString(), conv_caret, pth, docver, fmt);
|
||||||
|
|
||||||
if (FrType > 0 )
|
if (FrType > 0 )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user