Changed library document indicator on the tab. Added search by type and MyDocStyle.

This commit is contained in:
Rich 2010-05-01 12:04:49 +00:00
parent 4f35ce3f69
commit e81c993675

View File

@ -1334,7 +1334,7 @@ namespace VEPROMS.CSLA.Library
if (MyContent.MyEntry == null)
return DisplayNumber.Replace("\u2011","-");
if (MyContent.Number != "")
return ((MyContent.MyEntry.MyDocument.LibTitle ?? "")== "" ? "" : "\xA3 ") + DisplayNumber;
return ((MyContent.MyEntry.MyDocument.LibTitle ?? "") == "" ? "" : "\u1D38\u1D35\u1D2E ") + DisplayNumber;
if (DisplayText.Length <= 10)
return DisplayText.Replace("\u2011", "-");
return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0]+ "...";
@ -1491,6 +1491,20 @@ namespace VEPROMS.CSLA.Library
_ActiveSection = value;
}
}
private DocStyle _MyDocStyle;
public DocStyle MyDocStyle
{
get
{
if (_MyDocStyle == null)
{
int typ = (int)ActiveSection.MyContent.Type;
int subtyp = typ % 10000;
_MyDocStyle = ActiveFormat.PlantFormat.DocStyles.DocStyleList[subtyp];
}
return _MyDocStyle;
}
}
private FormatInfo _ActiveFormat = null;
public FormatInfo ActiveFormat
{
@ -1919,6 +1933,23 @@ namespace VEPROMS.CSLA.Library
tmp.AddEvents();
#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)
{
throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
}
}
public static ItemInfoList GetListByPartType(E_FromType fromType)
{
try
{
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListPartTypeCriteria(fromType));
ItemInfo.AddList(tmp);
tmp.AddEvents();
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
ContentInfoList.GetList(itemID); // Performance - Load All Content
#endif
return tmp;
}
@ -1948,6 +1979,20 @@ namespace VEPROMS.CSLA.Library
set { _Type = value; }
}
}
[Serializable()]
private class ItemListPartTypeCriteria
{
public ItemListPartTypeCriteria(E_FromType type)
{
_Type = type;
}
private E_FromType _Type;
public E_FromType Type
{
get { return _Type; }
set { _Type = value; }
}
}
private void DataPortal_Fetch(ItemListCriteria criteria)
{
this.RaiseListChangedEvents = false;
@ -1996,6 +2041,54 @@ namespace VEPROMS.CSLA.Library
}
this.RaiseListChangedEvents = true;
}
private void DataPortal_Fetch(ItemListPartTypeCriteria criteria)
{
this.RaiseListChangedEvents = false;
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
#if ItemWithContent
cm.CommandText = "getItemsByPartTypeAndContent";
#else
cm.CommandText = "getItemsByPartType";
#endif
cm.Parameters.AddWithValue("@FromType", (int) criteria.Type);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
while (dr.Read())
{
ItemInfo itemInfo = null;
switch (criteria.Type)
{
case E_FromType.Procedure:
itemInfo = new ProcedureInfo(dr);
break;
case E_FromType.Section:
itemInfo = new SectionInfo(dr);
break;
default:
itemInfo = new StepInfo(dr);
break;
}
IsReadOnly = false;
this.Add(itemInfo);
IsReadOnly = true;
}
}
}
}
}
catch (Exception ex)
{
Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
}
this.RaiseListChangedEvents = true;
}
internal void AddItem(ItemInfo itemInfo)
{
IsReadOnly = false;