From e81c993675ebd2369f6e362c47dc8bab5df6b319 Mon Sep 17 00:00:00 2001 From: Rich Date: Sat, 1 May 2010 12:04:49 +0000 Subject: [PATCH] Changed library document indicator on the tab. Added search by type and MyDocStyle. --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 95 ++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index afc90e53..31565fe4 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -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(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;