ColumnMode, Reset Child Lists, Reset Ordinal

This commit is contained in:
Rich 2009-03-28 22:22:42 +00:00
parent 76d3f0abe4
commit 7693a9a034

View File

@ -658,7 +658,7 @@ namespace VEPROMS.CSLA.Library
return ((IsProcedure || IsSection || IsHigh)?0:(IsRNO?1:0)+((ItemInfo)ActiveParent).RNOLevel);
}
}
public int Columns
public int ColumnMode
{
get
{
@ -667,9 +667,9 @@ namespace VEPROMS.CSLA.Library
if (si != null)
{
if (si.SectionConfig.Section_ColumnMode != SectionConfig.SectionColumnMode.Default)
return (int)si.SectionConfig.Section_ColumnMode;
return (int)si.SectionConfig.Section_ColumnMode - 1;
}
return ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PMode ?? 2;
return (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PMode ?? 2) -1;
}
}
/// <summary>
@ -882,8 +882,7 @@ namespace VEPROMS.CSLA.Library
}
public string ShortSearchPath
{
//get { return Regex.Replace(_SearchPath, "\x11.*?\x07", "\x07") + " \t" + DisplayText; }
get { return Regex.Replace(_SearchPath, "\x11.*?\x07", "\x07"); }
get { return Regex.Replace(_SearchPath, "\x11.*?\x07", "\x07"); }
}
internal int _SearchAnnotationID;
public int SearchAnnotationID
@ -1054,6 +1053,17 @@ namespace VEPROMS.CSLA.Library
private ItemInfoList _Tables;
public ItemInfoList Tables
{ get { return Lookup(7,ref _Tables); } }
//public void ResetChildren()
//{
// _Procedures = null;
// _Sections = null;
// _Steps = null;
// _Cautions = null;
// _Notes = null;
// _RNOs = null;
// _Steps = null;
// _Tables = null;
//}
//public XmlDocument ToXml()
//{
// XmlDocument retval = new XmlDocument();
@ -1310,7 +1320,12 @@ namespace VEPROMS.CSLA.Library
{
ItemInfo prevItemInfo = MyPrevious;
ItemInfo newItemInfo = null;
PartInfoList partInfoList = MyParent != null && MyParent.MyContent != null ? MyParent.MyContent.ContentParts : null;
PartInfoList partInfoList = null;
if(MyParent != null && MyParent.MyContent != null)
{
MyParent.MyContent.RefreshContentParts();
partInfoList = MyParent.MyContent.ContentParts;
}
using (Item prevItem = prevItemInfo == null ? null : prevItemInfo.Get()) // Get the previous Item
{
using (Item newItem = Item.MakeItem(prevItem, Content.MakeContent(number, "", MyContent.Type, null, null))) // Create the new Item
@ -1329,7 +1344,9 @@ namespace VEPROMS.CSLA.Library
}
}
}
// ToDo: Need change PartInfo in PartInfoList
newItemInfo = ItemInfo.Get(newItem.ItemID);
newItemInfo.ResetOrdinal();
}
}
return newItemInfo;
@ -1356,7 +1373,9 @@ namespace VEPROMS.CSLA.Library
nextItem.MyPrevious = newItem; // Point to the new item
nextItem.Save(); // Save Changes
}
// ToDo: Need change PartInfo in PartInfoList
newItemInfo = ItemInfo.Get(newItem.ItemID);
newItemInfo.ResetOrdinal();
}
}
return newItemInfo;
@ -1407,6 +1426,31 @@ namespace VEPROMS.CSLA.Library
return null;
}
}
private static void ResetOrdinal(int itemID)
{
bool first = true;
ConvertListToDictionary();
string key = itemID.ToString();
if (_CacheByPrimaryKey.ContainsKey(key))
{
foreach (ItemInfo itm in _CacheByPrimaryKey[key])
{
itm._Ordinal = null;
//Console.WriteLine("Ordinal {0},{1}",key,itm.MyPrevious == null ? 0 : itm.MyPrevious._Ordinal);
if (first && itm.NextItem != null)
{
ResetOrdinal(itm.NextItem.ItemID);
first = false;
}
}
}
}
private void ResetOrdinal()
{
//_Ordinal = null;
//Console.WriteLine("Ordinal {0},{1}",ItemID,MyPrevious == null ? 0 : MyPrevious.Ordinal);
ResetOrdinal(ItemID);
}
#endregion
}
#endregion ItemInfo
@ -1529,7 +1573,6 @@ namespace VEPROMS.CSLA.Library
catch (Exception ex)
{
throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
//return null;
}
}
[Serializable()]