Outside Transitions logic and annotations for unresolved transitions
This commit is contained in:
parent
efd8d900b2
commit
68d3ef8861
@ -16,7 +16,7 @@ namespace DataLoader
|
||||
{
|
||||
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)
|
||||
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)
|
||||
{
|
||||
Content content = null;
|
||||
Item item = null;
|
||||
@ -37,7 +37,7 @@ namespace DataLoader
|
||||
else
|
||||
stptext = TextConvert.ConvertText(Textm.Substring(0, tok), conv_caret);
|
||||
|
||||
string seqcvt = TextConvert.ConvertSeq(stpseq);
|
||||
string seqcvt = TextConvert.ConvertSeq(stpseq);
|
||||
|
||||
// Figure marker - it should NEVER get here!!!
|
||||
int tokfig = Textm.IndexOf('\xE8');
|
||||
@ -52,11 +52,11 @@ namespace DataLoader
|
||||
if (cbittst != ' ' && (cbittst & 0x80) > 1)
|
||||
{
|
||||
ManualPagebreak = true;
|
||||
if (ci==null) ci = new ConfigInfo(null);
|
||||
if (ci == null) ci = new ConfigInfo(null);
|
||||
ci.AddItem("Step", "ManualPagebreak", "True");
|
||||
newstptyp = StepType.Substring(1, 1);
|
||||
}
|
||||
|
||||
|
||||
// Need the content record for the RO & transitions.
|
||||
//content = Content.MakeContent(null, stptext, 20000 + int.Parse(newstptyp!=null?newstptyp:StepType),null, ManualPagebreak?ci.ToString():null, dts, userid);
|
||||
content = Content.New(null, stptext, 20000 + int.Parse(newstptyp != null ? newstptyp : StepType), null, ManualPagebreak ? ci.ToString() : null, dts, userid);
|
||||
@ -64,7 +64,7 @@ namespace DataLoader
|
||||
|
||||
// Before we save it, handle RO & Transitions tokens.
|
||||
int tokrt = Textm.IndexOf('\x15');
|
||||
bool txtdirty = false;
|
||||
bool txtdirty = false;
|
||||
if (tokrt > -1)
|
||||
{
|
||||
txtdirty = true;
|
||||
@ -78,10 +78,11 @@ namespace DataLoader
|
||||
// use the unicode chars.
|
||||
char[] chrrotrn = { '\x252C', '\x2566' };
|
||||
tokrt = Textm.IndexOfAny(chrrotrn);
|
||||
_TransitionMigrationErrors = new List<string>();
|
||||
if (tokrt > -1)
|
||||
{
|
||||
txtdirty = true;
|
||||
stptext = MigrateTrans(cn, stptext, seqcvt, content);
|
||||
stptext = MigrateTrans(cn, stptext, seqcvt, content, pth);
|
||||
}
|
||||
if (txtdirty)
|
||||
{
|
||||
@ -89,6 +90,9 @@ namespace DataLoader
|
||||
//content.Save();
|
||||
}
|
||||
if (!content.IsSavable) ErrorRpt.ErrorReport(content);
|
||||
List<string> migrationerrors = null;
|
||||
if (_ContentMigrationErrors.ContainsKey(content.ContentID))
|
||||
migrationerrors = _ContentMigrationErrors[content.ContentID];
|
||||
content.Save();
|
||||
// check if already created thru new during transition migration...
|
||||
if (dicTrans_ItemIds.ContainsKey(ProcNumber + "|" + seqcvt))
|
||||
@ -101,18 +105,38 @@ namespace DataLoader
|
||||
if (!item.IsSavable) ErrorRpt.ErrorReport(item);
|
||||
item.Save();
|
||||
dicTrans_ItemIds.Remove(ProcNumber + "|" + seqcvt);
|
||||
dicTrans_MigrationErrors.Remove(ProcNumber + "|" + seqcvt);
|
||||
}
|
||||
else
|
||||
item = Item.MakeItem(FromItem, content, content.DTS, content.UserID);
|
||||
if (migrationerrors != null)
|
||||
{
|
||||
foreach (string str in migrationerrors)
|
||||
{
|
||||
ItemAnnotation ia = item.ItemAnnotations.Add(MigrationErrorType);
|
||||
ia.SearchText = str;
|
||||
}
|
||||
if (!item.IsSavable) ErrorRpt.ErrorReport(item);
|
||||
item.Save();
|
||||
}
|
||||
if (_TransitionMigrationErrors.Count > 0)
|
||||
{
|
||||
foreach (string str in _TransitionMigrationErrors)
|
||||
{
|
||||
if (!dicTrans_MigrationErrors.ContainsKey(str))
|
||||
dicTrans_MigrationErrors.Add(str, new List<Item>());
|
||||
dicTrans_MigrationErrors[str].Add(item);
|
||||
}
|
||||
}
|
||||
dicTrans_ItemDone[ProcNumber + "|" + seqcvt] = item;
|
||||
dicOldStepSequence[content] = seqcvt;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Error("Save Step");
|
||||
log.ErrorFormat("oldstepsequence = {0}", stpseq);
|
||||
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
|
||||
log.ErrorFormat(ex.StackTrace);
|
||||
log.Error("Save Step");
|
||||
log.ErrorFormat("oldstepsequence = {0}", stpseq);
|
||||
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
|
||||
log.ErrorFormat(ex.StackTrace);
|
||||
item = null;
|
||||
}
|
||||
|
||||
@ -251,7 +275,7 @@ namespace DataLoader
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
private Item MigrateStep(OleDbConnection cn, DataTable dt, DataRowView drv, Item FromItem, bool conv_caret)
|
||||
private Item MigrateStep(OleDbConnection cn, DataTable dt, DataRowView drv, Item FromItem, bool conv_caret, string pth)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -259,7 +283,7 @@ namespace DataLoader
|
||||
Item item = AddStep(cn, drv["Type"].ToString()
|
||||
, (drv["textm"] == DBNull.Value ? drv["Text"].ToString() : drv["Textm"].ToString())
|
||||
, 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);
|
||||
, GetDTS(drv["Date"].ToString(), drv["Time"].ToString()), drv["Initials"].ToString(), conv_caret, pth);
|
||||
//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());
|
||||
//Item item = Item.MakeItem(FromItem, cont, cont.DTS, cont.UserID);
|
||||
@ -312,7 +336,7 @@ namespace DataLoader
|
||||
, (drvs["textm"] == DBNull.Value ? drvs["Text"].ToString() : drvs["Textm"].ToString())
|
||||
, drv["Recid"].ToString(), drvs["CStep"].ToString() + drvs["CSequence"].ToString()
|
||||
, GetStructType(drvs["sequence"].ToString()), FrItem
|
||||
, GetDTS(drvs["Date"].ToString(), drvs["Time"].ToString()), drvs["Initials"].ToString(), conv_caret);
|
||||
, GetDTS(drvs["Date"].ToString(), drvs["Time"].ToString()), drvs["Initials"].ToString(), conv_caret, pth);
|
||||
|
||||
if (FrType > 0 )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user