Outside Transitions logic and annotations for unresolved transitions

This commit is contained in:
Jsj 2008-02-21 16:51:50 +00:00
parent efd8d900b2
commit 68d3ef8861

View File

@ -16,7 +16,7 @@ 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) 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; Content content = null;
Item item = null; Item item = null;
@ -52,7 +52,7 @@ namespace DataLoader
if (cbittst != ' ' && (cbittst & 0x80) > 1) if (cbittst != ' ' && (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");
newstptyp = StepType.Substring(1, 1); newstptyp = StepType.Substring(1, 1);
} }
@ -78,10 +78,11 @@ namespace DataLoader
// use the unicode chars. // use the unicode chars.
char[] chrrotrn = { '\x252C', '\x2566' }; char[] chrrotrn = { '\x252C', '\x2566' };
tokrt = Textm.IndexOfAny(chrrotrn); tokrt = Textm.IndexOfAny(chrrotrn);
_TransitionMigrationErrors = new List<string>();
if (tokrt > -1) if (tokrt > -1)
{ {
txtdirty = true; txtdirty = true;
stptext = MigrateTrans(cn, stptext, seqcvt, content); stptext = MigrateTrans(cn, stptext, seqcvt, content, pth);
} }
if (txtdirty) if (txtdirty)
{ {
@ -89,6 +90,9 @@ namespace DataLoader
//content.Save(); //content.Save();
} }
if (!content.IsSavable) ErrorRpt.ErrorReport(content); if (!content.IsSavable) ErrorRpt.ErrorReport(content);
List<string> migrationerrors = null;
if (_ContentMigrationErrors.ContainsKey(content.ContentID))
migrationerrors = _ContentMigrationErrors[content.ContentID];
content.Save(); content.Save();
// check if already created thru new during transition migration... // check if already created thru new during transition migration...
if (dicTrans_ItemIds.ContainsKey(ProcNumber + "|" + seqcvt)) if (dicTrans_ItemIds.ContainsKey(ProcNumber + "|" + seqcvt))
@ -101,9 +105,29 @@ namespace DataLoader
if (!item.IsSavable) ErrorRpt.ErrorReport(item); if (!item.IsSavable) ErrorRpt.ErrorReport(item);
item.Save(); item.Save();
dicTrans_ItemIds.Remove(ProcNumber + "|" + seqcvt); dicTrans_ItemIds.Remove(ProcNumber + "|" + seqcvt);
dicTrans_MigrationErrors.Remove(ProcNumber + "|" + seqcvt);
} }
else else
item = Item.MakeItem(FromItem, content, content.DTS, content.UserID); 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; dicTrans_ItemDone[ProcNumber + "|" + seqcvt] = item;
dicOldStepSequence[content] = seqcvt; dicOldStepSequence[content] = seqcvt;
} }
@ -251,7 +275,7 @@ namespace DataLoader
} }
return retval; 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 try
{ {
@ -259,7 +283,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); , 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, //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);
@ -312,7 +336,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); , GetDTS(drvs["Date"].ToString(), drvs["Time"].ToString()), drvs["Initials"].ToString(), conv_caret, pth);
if (FrType > 0 ) if (FrType > 0 )
{ {