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

@@ -394,7 +394,9 @@ namespace DataLoader
get { return Loader._OverrideColor; }
set { Loader._OverrideColor = value; }
}
private bool hasFloatingFoldouts = false;
private Dictionary<string, int> FoldoutStpSeq = null;
private List<int> FloatingFoldoutHLS = null;
private Item MigrateSection(Item procitem, string procnum, OleDbConnection cn, DataRowView dr, DataTable dt, Item FromItem, bool hasSubSection, string pth, DocVersion docver, FormatInfo activeFormat,Content cont)
{
Int32 thesectid = 0;
@@ -427,12 +429,14 @@ namespace DataLoader
{
ismulti = sectFormat.PlantFormat.FormatData.SectData.StepSectionData.UseMultiLineSectionTitle;
conv_caret = sectFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta;
hasFloatingFoldouts = sectFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout;
}
if (fmt != null && fmt != "") if (fmt == docverFormat.Name) fmt = null;
string title = SectTitle(cn, dr, ismulti, conv_caret);
string init = dr["initials"].ToString().Trim();
string sequence = dr["CSequence"].ToString().PadRight(10);
string step = dr["CStep"].ToString();
int libDocid = 0;
DateTime dts = GetDTS(dr["Date"].ToString(), dr["Time"].ToString());
@@ -563,6 +567,11 @@ namespace DataLoader
//Console.WriteLine("After AddSection");
if (secitem == null)
throw (new Exception("Null parameter in AddSection"));
if (hasFloatingFoldouts)
{
if (FoldoutStpSeq == null) FoldoutStpSeq = new Dictionary<string, int>();
if (step[1] == 'F') FoldoutStpSeq.Add(step, secitem.ItemID);
}
if (cont != null)
{
// ContentsParts.Add can use 'fromtype', item - fromtype here = 2, section
@@ -621,6 +630,11 @@ namespace DataLoader
foreach (DataRowView drv in dv)
{
FrItem = MigrateStep(cn, dt, drv, FrItem, conv_caret, pth, docver, sectFormat, secitem, type);
if (hasFloatingFoldouts && (sequence[2] == 'x' || sequence[2] == 'X'))
{
if (FloatingFoldoutHLS == null) FloatingFoldoutHLS = new List<int>();
FloatingFoldoutHLS.Add(FrItem.ItemID);
}
type = 0; // Only add ContentPart for first child
//if (secitem.MyContent.ContentParts.Count == 0)
//{
@@ -634,6 +648,7 @@ namespace DataLoader
}
return secitem;
}
private void LoadSection(DataSet ds, OleDbDataAdapter da, string FileName)
{
try
@@ -648,13 +663,13 @@ 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)");
dt.Columns.Add("SubStepNo", System.Type.GetType("System.Int32"), "Convert(Convert(Substring(CSequence,Len(CSequence),1),'System.Char'),'System.Int32')-48");
dt.Columns.Add("locb", System.Type.GetType("System.Int32"), "Convert(Convert(Substring(CSequence,2,1),'System.Char'),'System.Int32')-48");
}
catch (Exception ex)
{
FileInfo fi;