This commit is contained in:
2012-09-27 10:26:36 +00:00
parent 747fd76f21
commit e8033fe6d4
2 changed files with 70 additions and 2 deletions

View File

@@ -303,6 +303,59 @@ namespace DataLoader
}
}
ds.Dispose();
// if there are any floating foldouts & associated steps, set config on steps for foldout association.
// the free the lists for the next procedure:
if (FoldoutStpSeq != null && FoldoutStpSeq.Count>0)
{
string cmd = "SELECT * FROM [tran] WHERE [FROMNUMBER]='" + ProcNumber.Replace("'", "''") + "' AND [TYPE] ='R'";
OleDbDataAdapter da = new OleDbDataAdapter(cmd, cn);
// get transition records for this step.
ds = new DataSet();
try
{
da.Fill(ds);
DataTable dtt = ds.Tables[0];
dtt.CaseSensitive = true;
Dictionary<int, string> stpFoldSeq = new Dictionary<int,string>();
foreach (DataRow drt in dtt.Rows)
{
// get from/to seq, subtract off '0' to get stepnumber.
int fromStep = drt["FROMSEQUEN"].ToString()[1] - '0';
int toStep = drt["TOSEQUENCE"].ToString()[1] - '0';
string foldSeq = drt["OLDTO"].ToString().Substring(0, 2);
for (int istp = fromStep; istp <= toStep; istp++)
stpFoldSeq.Add(istp, foldSeq);
}
ds.Dispose();
da.Dispose();
// now read in the HLS's and set their config to the appropriate foldout:
int cnt = 1;
foreach (int hlsItemId in FloatingFoldoutHLS)
{
using (Item itmF = Item.Get(hlsItemId))
{
string fldstr = stpFoldSeq[cnt];
int fldItemId = FoldoutStpSeq[fldstr];
ConfigInfo ciFold = new ConfigInfo(itmF.MyContent.Config);
ciFold.AddItem("Step", "FloatingFoldout", fldItemId.ToString());
itmF.MyContent.Config = ciFold.ToString();
itmF.Save();
}
}
}
catch (Exception ex)
{
frmMain.AddError(ex, "Error resolving Floating Foldout Data '{0}'", ProcNumber);
log.Error("Error resolving Floating Foldout Data");
log.ErrorFormat("from number = {0}", ProcNumber);
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
ds.Dispose();
da.Dispose();
}
}
if (FoldoutStpSeq!=null) FoldoutStpSeq.Clear();
if (FloatingFoldoutHLS!=null) FloatingFoldoutHLS.Clear();
//Console.WriteLine("End MigrateProcedure number {0}", number);
//Console.WriteLine("End MigrateProcedure Item Key {0} List {1}", Item.CacheCountPrimaryKey, Item.CacheCountList);
//Console.WriteLine("End MigrateProcedure ItemInfo Key {0} List {1}", ItemInfo.CacheCountPrimaryKey, ItemInfo.CacheCountList);