diff --git a/PROMS/DataLoader/Transitions.cs b/PROMS/DataLoader/Transitions.cs index 9c33c8bf..5c31aaf7 100644 --- a/PROMS/DataLoader/Transitions.cs +++ b/PROMS/DataLoader/Transitions.cs @@ -132,6 +132,10 @@ namespace DataLoader if (dr2 != null) { string thekey2 = dr2["TONUMBER"].ToString() + "|" + dr2["TOSEQUENCE"].ToString(); + // Range transitions that are type 2 are called 'and' transitions. These should extend to the + // last sibling. In data, these are represented with the SQL database field in the transitions + // table 'IsRange' == 2, and the toid == rangeid. In the content record, the link is + // TransitionRange:[type] [tranid] [toid] [rangeid] -> and the toid == rangeid if (itype == 2) { if (dr["TOSEQUENCE"].ToString().Length > 3 && @@ -165,26 +169,31 @@ namespace DataLoader } if (userid == null || userid == "") userid = "Migration"; Transition tr = null; - try - { - tr = Transition.New(fromCon, toItem, toItem2, itype, ci!=null?ci.ToString():null, dts, userid); - //if (otranskey != null) - // tr.MyZTransition.Oldto = otranskey; // info to finish outside transition processing later - //else - tr.MyZTransition.Oldto = dr["OLDTO"].ToString(); + try + { + int isRange = 0; + if (toItem.ItemID != toItem2.ItemID) + isRange = 1; + else if (itype == 2) + isRange = 2; + tr = Transition.New(fromCon, toItem, toItem2, isRange, itype, ci != null ? ci.ToString() : null, dts, userid); + //if (otranskey != null) + // tr.MyZTransition.Oldto = otranskey; // info to finish outside transition processing later + //else + tr.MyZTransition.Oldto = dr["OLDTO"].ToString(); if (!tr.IsSavable) ErrorRpt.ErrorReport(tr); tr.Save(); if (migrationErrors.Count > 0) _ContentMigrationErrors.Add(fromCon.ContentID, migrationErrors); - } - catch (Exception ex) - { - frmMain.AddError(ex, "Error addition transition record"); - log.Error("Error addition transition record"); - log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); - } + } + catch (Exception ex) + { + frmMain.AddError(ex, "Error addition transition record"); + log.Error("Error addition transition record"); + log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); + } string results = null; - if (toItem.ItemID == toItem2.ItemID) + if (toItem.ItemID == toItem2.ItemID && itype != 2) results = string.Format(@"\v \v0 ", tr.TranType, tr.TransitionID, tr.ToID); else results = string.Format(@"\v \v0 ", tr.TranType, tr.TransitionID, tr.ToID, tr.RangeID);