///<summary></summary> public static void Update(Intervention intervention) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),intervention); return; } Crud.InterventionCrud.Update(intervention); }
//If this table type will exist as cached data, uncomment the CachePattern region below. /* #region CachePattern //This region can be eliminated if this is not a table type with cached data. //If leaving this region in place, be sure to add RefreshCache and FillCache //to the Cache.cs file with all the other Cache types. ///<summary>A list of all Interventions.</summary> private static List<Intervention> listt; ///<summary>A list of all Interventions.</summary> public static List<Intervention> Listt{ get { if(listt==null) { RefreshCache(); } return listt; } set { listt=value; } } ///<summary></summary> public static DataTable RefreshCache(){ //No need to check RemotingRole; Calls GetTableRemotelyIfNeeded(). string command="SELECT * FROM intervention ORDER BY ItemOrder";//stub query probably needs to be changed DataTable table=Cache.GetTableRemotelyIfNeeded(MethodBase.GetCurrentMethod(),command); table.TableName="Intervention"; FillCache(table); return table; } ///<summary></summary> public static void FillCache(DataTable table){ //No need to check RemotingRole; no call to db. listt=Crud.InterventionCrud.TableToList(table); } #endregion */ ///<summary></summary> public static long Insert(Intervention intervention) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { intervention.InterventionNum=Meth.GetLong(MethodBase.GetCurrentMethod(),intervention); return intervention.InterventionNum; } return Crud.InterventionCrud.Insert(intervention); }
///<summary></summary> public static void Update(Intervention intervention) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), intervention); return; } Crud.InterventionCrud.Update(intervention); }
//If this table type will exist as cached data, uncomment the CachePattern region below. /* #region CachePattern * private class InterventionCache : CacheListAbs<Intervention> { * protected override List<Intervention> GetCacheFromDb() { * string command="SELECT * FROM Intervention ORDER BY ItemOrder"; * return Crud.InterventionCrud.SelectMany(command); * } * protected override List<Intervention> TableToList(DataTable table) { * return Crud.InterventionCrud.TableToList(table); * } * protected override Intervention Copy(Intervention Intervention) { * return Intervention.Clone(); * } * protected override DataTable ListToTable(List<Intervention> listInterventions) { * return Crud.InterventionCrud.ListToTable(listInterventions,"Intervention"); * } * protected override void FillCacheIfNeeded() { * Interventions.GetTableFromCache(false); * } * protected override bool IsInListShort(Intervention Intervention) { * return !Intervention.IsHidden; * } * } * * ///<summary>The object that accesses the cache in a thread-safe manner.</summary> * private static InterventionCache _InterventionCache=new InterventionCache(); * * ///<summary>A list of all Interventions. Returns a deep copy.</summary> * public static List<Intervention> ListDeep { * get { * return _InterventionCache.ListDeep; * } * } * * ///<summary>A list of all visible Interventions. Returns a deep copy.</summary> * public static List<Intervention> ListShortDeep { * get { * return _InterventionCache.ListShortDeep; * } * } * * ///<summary>A list of all Interventions. Returns a shallow copy.</summary> * public static List<Intervention> ListShallow { * get { * return _InterventionCache.ListShallow; * } * } * * ///<summary>A list of all visible Interventions. Returns a shallow copy.</summary> * public static List<Intervention> ListShort { * get { * return _InterventionCache.ListShallowShort; * } * } * * ///<summary>Refreshes the cache and returns it as a DataTable. This will refresh the ClientWeb's cache and the ServerWeb's cache.</summary> * public static DataTable RefreshCache() { * return GetTableFromCache(true); * } * * ///<summary>Fills the local cache with the passed in DataTable.</summary> * public static void FillCacheFromTable(DataTable table) { * _InterventionCache.FillCacheFromTable(table); * } * * ///<summary>Always refreshes the ClientWeb's cache.</summary> * public static DataTable GetTableFromCache(bool doRefreshCache) { * if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { * DataTable table=Meth.GetTable(MethodBase.GetCurrentMethod(),doRefreshCache); * _InterventionCache.FillCacheFromTable(table); * return table; * } * return _InterventionCache.GetTableFromCache(doRefreshCache); * } * #endregion */ ///<summary></summary> public static long Insert(Intervention intervention) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { intervention.InterventionNum = Meth.GetLong(MethodBase.GetCurrentMethod(), intervention); return(intervention.InterventionNum); } return(Crud.InterventionCrud.Insert(intervention)); }