Rich e42c3cea5c 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.
2008-05-21 21:00:07 +00:00

158 lines
4.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using Csla;
using Csla.Data;
using System.Xml;
using System.Data.SqlClient;
using System.Data;
namespace VEPROMS.CSLA.Library
{
public partial class Content
{
public override string ToString()
{
return string.Format("{0} {1}", Number, Text);
}
}
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);
}
//public XmlNode ToXml(XmlNode xn)
//{
// XmlNode nd = xn.OwnerDocument.CreateElement("Content");
// xn.AppendChild(nd);
// AddAttribute(nd, "Number", _Number);
// AddAttribute(nd, "Text", _Text);
// AddAttribute(nd, "FormatID", _FormatID);
// AddAttribute(nd, "Config", _Config);
// return nd;
//}
//public void AddAttribute(XmlNode xn, string name, object o)
//{
// if (o != null && o.ToString() != "")
// {
// XmlAttribute xa = xn.OwnerDocument.CreateAttribute(name);
// xa.Value = o.ToString();
// 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
{
public static ContentInfoList GetList(int? itemID)
{
try
{
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ContentListCriteria(itemID));
ContentInfo.AddList(tmp);
tmp.AddEvents();
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
}
}
[Serializable()]
private class ContentListCriteria
{
public ContentListCriteria(int? itemID)
{
_ItemID = itemID;
}
private int? _ItemID;
public int? ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
}
private void DataPortal_Fetch(ContentListCriteria criteria)
{
this.RaiseListChangedEvents = false;
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_ListContentsByItemID";
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())
{
ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo);
}
IsReadOnly = true;
}
}
}
}
catch (Exception ex)
{
Database.LogException("ContentInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("ContentInfoList.DataPortal_Fetch", ex);
}
this.RaiseListChangedEvents = true;
}
}
}