Save WindowState - Maximize, Minimize, Normal by user.

Load all at once code to support print.
Open Command from the Start (PROMS2010) Menu.
Enter key on treeview executes Open.
The Treeview was retaining focus after opening procedures or accessory documents. This was fixed.
Tab Bar initialized to the full width.
Items were not always being displayed after the tree was clicked.
The RO and Transition Info tabs are made invisible for accessory documents.
The Tags, RO and Transition tabs are made invisible when no doucment is selected.
Enter the DSO Framer window when it is created.
Enter the Accessory page editor or step editor when a tab is selected.
Remember the last selection in a step editor page when you return.
Activate one of the remaining tabs when a tab is closed.
Embed the pushpin images.
This commit is contained in:
Rich
2008-05-21 21:00:07 +00:00
parent 41eb961ceb
commit e42c3cea5c
17 changed files with 869 additions and 358 deletions

View File

@@ -18,6 +18,13 @@ namespace VEPROMS.CSLA.Library
}
public partial class ContentInfo
{
public void AddPart(SafeDataReader dr, ItemInfo itemInfo)
{
if (_ContentParts == null)
_ContentParts = new PartInfoList(dr, itemInfo);
else
_ContentParts.AddPartInfo(dr, itemInfo);
}
public override string ToString()
{
return string.Format("{0} {1}", Number, Text);
@@ -41,6 +48,48 @@ namespace VEPROMS.CSLA.Library
// xn.Attributes.Append(xa);
// }
//}
internal ContentInfo(SafeDataReader dr,bool ForItem)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfo.Constructor", GetHashCode());
try
{
ReadDataItemList(dr);
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentInfo.Constructor", ex);
throw new DbCslaException("ContentInfo.Constructor", ex);
}
}
private void ReadDataItemList(SafeDataReader dr)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfo.ReadDataItemList", GetHashCode());
try
{
_ContentID = dr.GetInt32("ContentID");
_Number = dr.GetString("Number");
_Text = dr.GetString("Text");
_Type = (int?)dr.GetValue("Type");
_FormatID = (int?)dr.GetValue("FormatID");
_Config = dr.GetString("Config");
_DTS = dr.GetDateTime("cDTS");
_UserID = dr.GetString("cUserID");
_ContentDetailCount = dr.GetInt32("DetailCount");
_ContentEntryCount = dr.GetInt32("EntryCount");
_ContentItemCount = dr.GetInt32("ItemCount");
_ContentPartCount = dr.GetInt32("cPartCount");
_ContentRoUsageCount = dr.GetInt32("RoUsageCount");
_ContentTransitionCount = dr.GetInt32("TransitionCount");
_ContentZContentCount = dr.GetInt32("ZContentCount");
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentInfo.ReadData", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("ContentInfo.ReadData", ex);
}
}
}
public partial class ContentInfoList
{

View File

@@ -23,7 +23,7 @@ namespace VEPROMS.CSLA.Library
public partial class Format
{
#region PlantFormat
//[NonSerialized]
[NonSerialized]
private PlantFormat _PlantFormat;
public PlantFormat PlantFormat
{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this)); } }
@@ -37,7 +37,7 @@ namespace VEPROMS.CSLA.Library
public partial class FormatInfo
{
#region PlantFormat
//[NonSerialized]
[NonSerialized]
private PlantFormat _PlantFormat;
public PlantFormat PlantFormat
{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this.Get())); } }

View File

@@ -1,3 +1,5 @@
#define ItemWithContent
using System;
using System.Collections.Generic;
using System.Text;
@@ -15,7 +17,7 @@ namespace VEPROMS.CSLA.Library
{
public override string ToString()
{
return string.Format("{0} {1}", MyContent.Number, MyContent.Text);
return string.Format("{0} {1}", MyContent.Number, MyContent.Text).Trim();
}
// TODO: Move to ItemInfo Extension
@@ -84,8 +86,205 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region ItemInfo
public partial class ItemInfo:IVEDrillDownReadOnly
public partial class ItemInfo:IVEDrillDownReadOnly
{
#region LoadAtOnce2
public static ItemInfo GetItemAndChildren2(int? itemID)
{
try
{
ItemInfo tmp = DataPortal.Fetch<ItemInfo>(new ItemAndChildrenCriteria2(itemID));
//_AllList.Add(tmp);
if (tmp.ErrorMessage == "No Record Found") tmp = null;
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on ItemInfoList.GetItemAndChildren2", ex);
}
}
// Criteria to get Item and children
[Serializable()]
private class ItemAndChildrenCriteria2
{
public ItemAndChildrenCriteria2(int? itemID)
{
_ItemID = itemID;
}
private int? _ItemID;
public int? ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
}
// Data Portal to Get Item and Children
private void DataPortal_Fetch(ItemAndChildrenCriteria2 criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
ApplicationContext.LocalContext["cn"] = cn;
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getItem";
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
if (!dr.Read())
{
_ErrorMessage = "No Record Found";
return;
}
ReadData(dr);
}
}
SpinThroughChildren();
// removing of item only needed for local data portal
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
ApplicationContext.LocalContext.Remove("cn");
}
}
catch (Exception ex)
{
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
}
_AllList.Remove(this);
}
private void SpinThroughChildren()
{
if(MyContent.ContentPartCount > 0)
foreach(PartInfo partInfo in MyContent.ContentParts)
foreach (ItemInfo itemInfo in partInfo.MyItems)
itemInfo.SpinThroughChildren();
}
#endregion
#region LoadAtOnce
// Method to Get Item and children
public static ItemInfo GetItemAndChildren(int? itemID,int? parentID)
{
try
{
ItemInfo tmp = DataPortal.Fetch<ItemInfo>(new ItemAndChildrenCriteria(itemID,parentID));
//_AllList.Add(tmp);
if (tmp.ErrorMessage == "No Record Found") tmp = null;
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
}
}
// Criteria to get Item and children
[Serializable()]
private class ItemAndChildrenCriteria
{
public ItemAndChildrenCriteria(int? itemID, int? parentID)
{
_ItemID = itemID;
_ParentID = parentID;
}
private int? _ItemID;
public int? ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
private int? _ParentID;
public int? ParentID
{
get { return _ParentID; }
set { _ParentID = value; }
}
}
// Data Portal to Get Item and Children
private void DataPortal_Fetch(ItemAndChildrenCriteria criteria)
{
//ItemInfo tmp = null;
Dictionary<int, ItemInfo> lookup = new Dictionary<int, ItemInfo>(); ;
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_ListItemAndChildren";
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
cm.Parameters.AddWithValue("@ParentID", criteria.ParentID);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
while (dr.Read())
{
if (dr.GetInt32("Level")==0)
{
//tmp = itemInfo;
ReadData(dr);
AddContent(dr);
lookup[this.ItemID] = this;
}
else
{
ItemInfo itemInfo = null;
int itemType = dr.GetInt32("Type") / 10000;
switch (itemType)
{
case 0:
itemInfo = new ProcedureInfo(dr);
break;
case 1:
itemInfo = new SectionInfo(dr);
break;
case 2:
itemInfo = new StepInfo(dr);
break;
}
// Load Children
itemInfo.AddContent(dr);
ItemInfo parent = lookup[dr.GetInt32("ParentID")];
itemInfo._ActiveParent = parent;
itemInfo._ActiveSection = (itemInfo.IsSection ? itemInfo : parent._ActiveSection);
parent.AddPart(dr, itemInfo);
lookup.Add(itemInfo.ItemID, itemInfo);
}
}
//Console.WriteLine("I'm here {0}",this.MyContent.ContentPartCount);
}
}
}
}
catch (Exception ex)
{
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
}
}
private void AddPart(SafeDataReader dr, ItemInfo itemInfo)
{
// Either a new PartInfo or an existing PartInfo
if (dr.IsDBNull(dr.GetOrdinal("PreviousID")))
{
//PartInfo prt = new PartInfo(dr, itemInfo);
_MyContent.AddPart(dr, itemInfo);
}
else
{
foreach (PartInfo pi in MyContent.ContentParts)
{
if (dr.GetInt32("FromType") == (int)pi.PartType)
{
if (pi._MyItems == null)
pi._MyItems = new ItemInfoList(itemInfo);
else
pi.MyItems.AddItem(itemInfo);
}
}
}
}
#endregion
public bool IsType(string type)
{
int stepType = ((int)MyContent.Type) % 10000;
@@ -188,7 +387,8 @@ namespace VEPROMS.CSLA.Library
{
// check to see if ActiveParent is a section, if so it is a high level step
if (MyContent.Type / 10000 != 2) return false;
ItemInfo parent = (ItemInfo)ActiveParent;
ItemInfo parent = ActiveParent as ItemInfo;
if (parent == null) return false;
if ((parent.MyContent.Type / 10000) == 1)
return true;
return false;
@@ -215,7 +415,9 @@ namespace VEPROMS.CSLA.Library
{
if (IsHigh) return false;
if (IsRNO) return true;
return ((ItemInfo)ActiveParent).IsInRNO;
ItemInfo parent = ActiveParent as ItemInfo;
if (parent == null) return false;
return parent.IsInRNO;
}
}
public ItemInfo FirstSibling
@@ -241,7 +443,9 @@ namespace VEPROMS.CSLA.Library
{
if (IsHigh) return false;
if (IsSubStep) return true;
return ((ItemInfo)ActiveParent).IsInSubStep;
ItemInfo parent = ActiveParent as ItemInfo;
if (parent == null) return false;
return parent.IsInSubStep;
}
}
public bool IsInFirstLevelSubStep
@@ -249,6 +453,7 @@ namespace VEPROMS.CSLA.Library
get
{
ItemInfo temp = FirstSibling;
if(temp.ActiveParent.GetType() == typeof(VEPROMS.CSLA.Library.DocVersionInfo))return false;
while (((ItemInfo)temp.ActiveParent).IsHigh == false) temp = ((ItemInfo)temp.ActiveParent).FirstSibling;
return temp.IsSubStep;
}
@@ -334,12 +539,14 @@ namespace VEPROMS.CSLA.Library
{
get
{
//int retval = 1;
//for (ItemInfo ii = MyParent; ii != null; ii = ii.MyParent) retval++;
//return retval;
//if (_Ordinal != null) return (int)_Ordinal; // Cache Ordinal
if (MyPrevious != null) return (int)(_Ordinal = MyPrevious.Ordinal + 1);
return (int)(_Ordinal = 1);
if (_Ordinal == null)
{
if (MyPrevious != null)
_Ordinal = MyPrevious.Ordinal + 1;
else
_Ordinal = 1;
}
return (int) _Ordinal;
}
}
public string CslaType
@@ -352,7 +559,7 @@ namespace VEPROMS.CSLA.Library
ContentInfo cont = MyContent;
string number = cont.Number;
if (cont.Type >= 20000) number = Ordinal.ToString() + ".";
return string.Format("{0} {1}", number, cont.Text);
return string.Format("{0} {1}", number, cont.Text).Trim();
//return string.Format("{0} {1}", cont.Number, cont.Text);
//return "Now is the time for all good men to come to the aid of their country!";
}
@@ -544,6 +751,7 @@ namespace VEPROMS.CSLA.Library
}
}
private IVEDrillDownReadOnly _ActiveParent = null;
public IVEDrillDownReadOnly MyActiveParent { get { return _ActiveParent; } }
public IVEDrillDownReadOnly ActiveParent
{
get
@@ -568,14 +776,36 @@ namespace VEPROMS.CSLA.Library
}
return _ActiveParent==this ? null : _ActiveParent;
}
//get
//{
// if (MyPrevious != null) return _MyPrevious.ActiveParent;
// if (ItemDocVersionCount > 0) return ItemDocVersions[0];
// ContentInfo parentContent = ParentContent;
// if (parentContent == null || parentContent.ContentItemCount == 0) return null;
// return parentContent.ContentItems[0];
//}
internal set
{
_ActiveParent = value;
}
}
private ItemInfo _ActiveSection = null;
public ItemInfo MyActiveSection { get { return _ActiveSection; } }
public ItemInfo ActiveSection
{
get
{
if (_ActiveSection == null)
{
if (IsSection)
_ActiveSection = this;
else
{
ItemInfo parent = ActiveParent as ItemInfo;
if (parent != null)
_ActiveSection = parent.ActiveSection;
else
_ActiveSection = this;
}
}
return _ActiveSection.IsSection ? _ActiveSection : null;
}
set
{
_ActiveSection = value;
}
}
private FormatInfo _ActiveFormat = null;
public FormatInfo ActiveFormat
@@ -619,6 +849,24 @@ namespace VEPROMS.CSLA.Library
public Color BackColor
{ get { return (ItemAnnotationCount > 0 ? Color.Yellow : Color.White); } }
#endregion
internal ItemInfo(SafeDataReader dr, bool forItem)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.Constructor", GetHashCode());
try
{
ReadData(dr);
AddContent(dr);
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfo.Constructor", ex);
throw new DbCslaException("ItemInfo.Constructor", ex);
}
}
private void AddContent(SafeDataReader dr)
{
_MyContent = new ContentInfo(dr, true);
}
}
#endregion ItemInfo
#region ItemInfoList
@@ -631,6 +879,10 @@ namespace VEPROMS.CSLA.Library
// itemInfo.ToXml(xn);
// }
//}
internal ItemInfoList(ItemInfo itemInfo)
{
AddItem(itemInfo);
}
public static ItemInfoList GetList(int? itemID,int type)
{
try
@@ -638,7 +890,9 @@ namespace VEPROMS.CSLA.Library
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListCriteria(itemID,type));
ItemInfo.AddList(tmp);
tmp.AddEvents();
ContentInfoList.GetList(itemID);
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
ContentInfoList.GetList(itemID); // Performance - Load All Content
#endif
return tmp;
}
catch (Exception ex)
@@ -677,11 +931,14 @@ namespace VEPROMS.CSLA.Library
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
#if ItemWithContent
cm.CommandText = "vesp_ListItemsAndContent";
#else
cm.CommandText = "vesp_ListItems";
#endif
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())
{
ItemInfo itemInfo = null;
@@ -697,9 +954,10 @@ namespace VEPROMS.CSLA.Library
itemInfo = new StepInfo(dr);
break;
}
IsReadOnly = false;
this.Add(itemInfo);
IsReadOnly = true;
}
IsReadOnly = true;
}
}
}
@@ -711,13 +969,23 @@ namespace VEPROMS.CSLA.Library
}
this.RaiseListChangedEvents = true;
}
internal void AddItem(ItemInfo itemInfo)
{
IsReadOnly = false;
this.Add(itemInfo);
IsReadOnly = true;
}
}
#endregion
#region ProcedureInfo
[Serializable()]
public partial class ProcedureInfo : ItemInfo, IVEDrillDownReadOnly
{
#if ItemWithContent
public ProcedureInfo(SafeDataReader dr) : base(dr, true) { }
#else
public ProcedureInfo(SafeDataReader dr) : base(dr) { }
#endif
public new Procedure Get()
{
return (Procedure) (_Editable = Procedure.Get(ItemID));
@@ -788,7 +1056,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()]
public partial class SectionInfo : ItemInfo, IVEDrillDownReadOnly
{
#if ItemWithContent
public SectionInfo(SafeDataReader dr) : base(dr, true) { }
#else
public SectionInfo(SafeDataReader dr) : base(dr) { }
#endif
public new Section Get()
{
return (Section)(_Editable = Section.Get(ItemID));
@@ -865,7 +1137,11 @@ namespace VEPROMS.CSLA.Library
//{
// return "Step " + base.ToString();
//}
#if ItemWithContent
public StepInfo(SafeDataReader dr) : base(dr, true) { }
#else
public StepInfo(SafeDataReader dr) : base(dr) { }
#endif
public new Step Get()
{
return (Step)(_Editable = Step.Get(ItemID));

View File

@@ -27,8 +27,54 @@ namespace VEPROMS.CSLA.Library
return string.Format("{0} {1}", MyItem.MyContent.Number, MyItem.MyContent.Text);
}
}
public partial class PartInfoList
{
internal PartInfoList(SafeDataReader dr, ItemInfo itemInfo)
{
AddPartInfo(dr,itemInfo);
}
internal void AddPartInfo(SafeDataReader dr, ItemInfo itemInfo)
{
IsReadOnly = false;
this.Add(new PartInfo(dr, itemInfo));
IsReadOnly = true;
}
}
public partial class PartInfo : IVEDrillDownReadOnly
{
internal PartInfo(SafeDataReader dr, ItemInfo itemInfo)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.Constructor", GetHashCode());
try
{
ReadData(dr, itemInfo);
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.Constructor", ex);
throw new DbCslaException("PartInfo.Constructor", ex);
}
}
private void ReadData(SafeDataReader dr, ItemInfo itemInfo)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.ReadData", GetHashCode());
try
{
_ContentID = dr.GetInt32("pContentID");
_FromType = dr.GetInt32("FromType");
_ItemID = dr.GetInt32("ItemID");
_DTS = dr.GetDateTime("pDTS");
_UserID = dr.GetString("pUserID");
_MyItem = itemInfo;
_MyItems = new ItemInfoList(itemInfo);
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.ReadData", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("PartInfo.ReadData", ex);
}
}
public E_FromType PartType
{ get { return (E_FromType)_FromType; } }
public E_FromTypes PartTypes
@@ -44,7 +90,7 @@ namespace VEPROMS.CSLA.Library
#region IVEDrillDownReadOnly
public ItemInfoList _MyItems;
public ItemInfoList MyItems
{ get { return (_MyItems != null? _MyItems : _MyItems = ItemInfoList.GetList(_ItemID,_FromType)); } }
{ get { return (_MyItems != null ? _MyItems : _MyItems = ItemInfoList.GetList(_ItemID, _FromType)); } }
public System.Collections.IList GetChildren()
{
return (_MyItems != null ? _MyItems : _MyItems = ItemInfoList.GetList(_ItemID, _FromType));
@@ -82,12 +128,12 @@ namespace VEPROMS.CSLA.Library
//{ return false; }
#endregion
}
public enum E_FromType : int
{
Procedure = 1, Section = 2, Caution = 3, Note = 4, RNO = 5, Step = 6, Table = 7
}
public enum E_FromTypes : int
{
Procedures = 1, Sections = 2, Cautions = 3, Notes = 4, RNOs = 5, Steps = 6, Tables = 7
}
public enum E_FromType : int
{
Procedure = 1, Section = 2, Caution = 3, Note = 4, RNO = 5, Step = 6, Table = 7
}
public enum E_FromTypes : int
{
Procedures = 1, Sections = 2, Cautions = 3, Notes = 4, RNOs = 5, Steps = 6, Tables = 7
}
}