C2025-027-Develop-a-way-to-filter-annotations-so-the-user-can-view-only-the-types-they-want-to-see-EP
This commit is contained in:
@@ -105,6 +105,33 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on AnnotationTypeInfoList.Get", ex);
|
||||
}
|
||||
}
|
||||
|
||||
//AnnotationTypeInfoList AnnotationTypeInfoList2 = new AnnotationTypeInfoList();
|
||||
|
||||
public static AnnotationTypeInfoList AnnotationSelectByItem(int itemID)
|
||||
{
|
||||
try
|
||||
{ // C2025-027 This method needs to be refreshed everytime.
|
||||
//if (_AnnotationTypeInfoList != null)
|
||||
// return _AnnotationTypeInfoList;
|
||||
AnnotationTypeInfoList tmp = (AnnotationTypeInfoList)DataPortal.Fetch(new AnnotationSelectByItemIDCriteria(itemID));
|
||||
if (tmp.Count < 1)
|
||||
{
|
||||
tmp = DataPortal.Fetch<AnnotationTypeInfoList>();
|
||||
}
|
||||
AnnotationTypeInfo.AddList(tmp);
|
||||
tmp.AddEvents();
|
||||
_AnnotationTypeInfoList = tmp;
|
||||
OnListChanged();
|
||||
return tmp;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on AnnotationTypeInfoList.Get", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the list of all AnnotationTypeInfo.
|
||||
/// </summary>
|
||||
@@ -157,6 +184,50 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
|
||||
[Serializable()]
|
||||
protected class AnnotationSelectByItemIDCriteria
|
||||
{
|
||||
private int _itemID;
|
||||
public int ItemID
|
||||
{ get { return _itemID; } }
|
||||
|
||||
public AnnotationSelectByItemIDCriteria(int itemID)
|
||||
{
|
||||
_itemID = itemID;
|
||||
}
|
||||
}
|
||||
|
||||
private void DataPortal_Fetch(AnnotationSelectByItemIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "getAnnotationTypes2";
|
||||
cm.Parameters.AddWithValue("@itemID", criteria.ItemID);
|
||||
cm.CommandTimeout = Database.DefaultTimeout;
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read()) this.Add(new AnnotationTypeInfo(dr));
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("AnnotationTypeInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
#endregion
|
||||
#region ICustomTypeDescriptor impl
|
||||
public String GetClassName()
|
||||
|
||||
Reference in New Issue
Block a user