diff --git a/PROMS/DataLoader/Sections.cs b/PROMS/DataLoader/Sections.cs index 3ad121c6..ef5e6849 100644 --- a/PROMS/DataLoader/Sections.cs +++ b/PROMS/DataLoader/Sections.cs @@ -97,7 +97,7 @@ namespace DataLoader if (cmchar > '2') ci.AddItem("Section", "ColumnMode", "1"); else - ci.AddItem("Section", "ColumnMode", stpseq.Substring(5, 1)); + ci.AddItem("Section", "ColumnMode", stpseq.Substring(5, 1)); } // find rtf file (or use the library document temp file) & read it into the field @@ -443,6 +443,13 @@ namespace DataLoader ConfigInfo ci = new ConfigInfo(null); ci.AddItem("History", "RecID", rid); + ci.AddItem("History", "ProcName", ProcFileName.ToUpper()); + if (MultiUnitCount > 0) + { + string apple = AddApplicability(rid); + if(apple != null) + ci.AddItem("MasterSlave", "Applicability", apple); + } ci.AddItem("Section", "OldType", stype); @@ -648,7 +655,42 @@ namespace DataLoader } return secitem; } - + + private string AddApplicability(string recnum) + { + //if (recnum == "00002491") + // System.Threading.Thread.Sleep(1000); + if (!MyProcAPL.ContainsKey(recnum)) + return null; + string apple = MyProcAPL[recnum]; + if (apple == "40000000") + return "0"; + UInt32 mask = 0; + foreach (int i in Old2NewApple.Keys) + mask |= (uint)(1 << (i - 1)); + UInt32 val = UInt32.Parse(apple, System.Globalization.NumberStyles.HexNumber); + //UInt32 val = UInt32.Parse(apple); + val &= mask; + if (val == 0) + return null; + if (val == mask) + return null; + int j = 1; + StringBuilder sb = new StringBuilder(); + string sep = string.Empty; + while (val != 0) + { + if ((val & 1u) == 1u) + { + sb.Append(sep + Old2NewApple[j].ToString()); + sep = ","; + } + j++; + val = val >> 1; + } + return sb.ToString(); + + } private void LoadSection(DataSet ds, OleDbDataAdapter da, string FileName) { try @@ -663,7 +705,6 @@ namespace DataLoader { drw["CStep"] = TextConvert.ConvertSeq(drw["Step"].ToString()); drw["CSequence"] = TextConvert.ConvertSeq(drw["Sequence"].ToString()); - } dt.Columns.Add("StepNo", System.Type.GetType("System.Int32"), "Convert(Convert(Substring(CStep,2,1),'System.Char'),'System.Int32')-48"); dt.Columns.Add("Level", System.Type.GetType("System.Int32"), "Len(CSequence)");