133 lines
5.1 KiB
C#
133 lines
5.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace VEPROMS.CSLA.Library
|
|
{
|
|
public partial class ItemInfo
|
|
{
|
|
public ItemInfo SearchNext
|
|
{
|
|
get
|
|
{
|
|
return SearchNextSkip(SkipPartType.This);
|
|
}
|
|
}
|
|
private ItemInfo SearchNextSkip(SkipPartType skip)
|
|
{
|
|
if (skip < SkipPartType.Caution && Cautions != null && Cautions.Count > 0) return Cautions[0].SearchTop;
|
|
if (skip < SkipPartType.Note && Notes != null && Notes.Count > 0) return Notes[0].SearchTop;
|
|
if (skip < SkipPartType.This) return this;
|
|
if (skip < SkipPartType.RNO && RNOs != null && RNOs.Count > 0) return RNOs[0].SearchTop;
|
|
if (skip < SkipPartType.SupInfo && SupInfos != null && SupInfos.Count > 0) return SupInfos[0].SearchTop;
|
|
if (skip < SkipPartType.Table && Tables != null && Tables.Count > 0) return Tables[0].SearchTop;
|
|
if (skip < SkipPartType.Procedures && Procedures != null && Procedures.Count > 0) return Procedures[0].SearchTop;
|
|
if (skip < SkipPartType.Sections && Sections != null && Sections.Count > 0) return Sections[0].SearchTop;
|
|
// fix B2016-158: Don't process steps if this sectin is 'not-editable' (steps may exist but are hidden
|
|
// from edit & print)
|
|
bool iseditable = true;
|
|
if (IsSection)
|
|
{
|
|
SectionConfig sc = MyConfig as SectionConfig;
|
|
if (sc != null && sc.SubSection_Edit != "Y") iseditable = false;
|
|
}
|
|
if (iseditable && skip < SkipPartType.Steps && Steps != null && Steps.Count > 0) return Steps[0].SearchTop;
|
|
|
|
if (NextItem != null) return NextItem.SearchTop;
|
|
return UpOneNext;
|
|
}
|
|
public ItemInfo SearchTop
|
|
{
|
|
get
|
|
{
|
|
if (Cautions != null) return Cautions[0].SearchTop;
|
|
if (Notes != null) return Notes[0].SearchTop;
|
|
return this;
|
|
}
|
|
}
|
|
public ItemInfo UpOneNext
|
|
{
|
|
get
|
|
{
|
|
ItemInfo parentItem = ActiveParent as ItemInfo;
|
|
if (parentItem == null) return null;
|
|
if (IsCautionPart) return parentItem.SearchNextSkip(SkipPartType.Caution);
|
|
if (IsNotePart) return parentItem.SearchNextSkip(SkipPartType.Note);
|
|
if (IsRNOPart) return parentItem.SearchNextSkip(SkipPartType.RNO);
|
|
if (IsSupInfoPart) return parentItem.SearchNextSkip(SkipPartType.SupInfo);
|
|
if (IsTablePart) return parentItem.SearchNextSkip(SkipPartType.Table);
|
|
if (IsProcedurePart) return parentItem.SearchNextSkip(SkipPartType.Procedures);
|
|
if (IsSectionPart) return parentItem.SearchNextSkip(SkipPartType.Sections);
|
|
if (IsStepPart) return parentItem.SearchNextSkip(SkipPartType.Steps);
|
|
if (parentItem.NextItem != null) return parentItem.NextItem.SearchTop;
|
|
return parentItem.UpOneNext;
|
|
}
|
|
}
|
|
public ItemInfo SearchPrev
|
|
{
|
|
get
|
|
{
|
|
return SearchPrevSkip(SkipPartType.This);
|
|
}
|
|
}
|
|
private ItemInfo SearchPrevSkip(SkipPartType skip)
|
|
{
|
|
if (skip > SkipPartType.Steps && Steps != null) return Steps[0].LastSibling.SearchBottom;
|
|
if (skip > SkipPartType.Sections && Sections != null) return Sections[0].LastSibling.SearchBottom;
|
|
if (skip > SkipPartType.Procedures && Procedures != null) return Procedures[0].LastSibling.SearchBottom;
|
|
if (skip > SkipPartType.Table && Tables != null) return Tables[0].LastSibling.SearchBottom;
|
|
if (skip > SkipPartType.SupInfo && SupInfos != null) return SupInfos[0].LastSibling.SearchBottom;
|
|
if (skip > SkipPartType.RNO && RNOs != null) return RNOs[0].LastSibling.SearchBottom;
|
|
if (skip > SkipPartType.This) return this;
|
|
if (skip > SkipPartType.Note && Notes != null) return Notes[0].LastSibling.SearchBottom;
|
|
if (skip > SkipPartType.Caution && Cautions != null) return Cautions[0].LastSibling.SearchBottom;
|
|
if (MyPrevious != null) return MyPrevious.SearchBottom;
|
|
return UpOnePrev;
|
|
}
|
|
public ItemInfo SearchBottom
|
|
{
|
|
get
|
|
{
|
|
if (Steps != null) return Steps[0].LastSibling.SearchBottom;
|
|
if (Sections != null) return Sections[0].LastSibling.SearchBottom;
|
|
if (Procedures != null) return Procedures[0].LastSibling.SearchBottom;
|
|
if (Tables != null) return Tables[0].LastSibling.SearchBottom;
|
|
if (RNOs != null) return RNOs[0].LastSibling.SearchBottom;
|
|
if (SupInfos != null) return SupInfos[0].LastSibling.SearchBottom;
|
|
return this;
|
|
}
|
|
}
|
|
public ItemInfo UpOnePrev
|
|
{
|
|
get
|
|
{
|
|
ItemInfo parentItem = ActiveParent as ItemInfo;
|
|
if (parentItem == null) return null;
|
|
if (IsCautionPart) return parentItem.SearchPrevSkip(SkipPartType.Caution);
|
|
if (IsNotePart) return parentItem.SearchPrevSkip(SkipPartType.Note);
|
|
if (IsRNOPart) return parentItem.SearchPrevSkip(SkipPartType.RNO);
|
|
if (IsSupInfoPart) return parentItem.SearchPrevSkip(SkipPartType.SupInfo);
|
|
if (IsTablePart) return parentItem.SearchPrevSkip(SkipPartType.Table);
|
|
if (IsProcedurePart) return parentItem.SearchPrevSkip(SkipPartType.Procedures);
|
|
if (IsSectionPart) return parentItem.SearchPrevSkip(SkipPartType.Sections);
|
|
if (IsStepPart) return parentItem.SearchPrevSkip(SkipPartType.Steps);
|
|
if (parentItem.MyPrevious != null) return parentItem.MyPrevious.SearchTop;
|
|
return parentItem.UpOnePrev;
|
|
}
|
|
}
|
|
enum SkipPartType
|
|
{
|
|
Nothing=0,
|
|
Caution=1,
|
|
Note=2,
|
|
This=3,
|
|
RNO=4,
|
|
SupInfo = 5,
|
|
Table=6,
|
|
Procedures=7,
|
|
Sections=8,
|
|
Steps=9
|
|
}
|
|
}
|
|
}
|