//If this table type will exist as cached data, uncomment the CachePattern region below and edit. /* #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 MedLabSpecimens.</summary> private static List<MedLabSpecimen> listt; ///<summary>A list of all MedLabSpecimens.</summary> public static List<MedLabSpecimen> 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 medlabspecimen ORDER BY ItemOrder";//stub query probably needs to be changed DataTable table=Cache.GetTableRemotelyIfNeeded(MethodBase.GetCurrentMethod(),command); table.TableName="MedLabSpecimen"; FillCache(table); return table; } ///<summary></summary> public static void FillCache(DataTable table){ //No need to check RemotingRole; no call to db. listt=Crud.MedLabSpecimenCrud.TableToList(table); } #endregion */ ///<summary></summary> public static long Insert(MedLabSpecimen medLabSpecimen) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { medLabSpecimen.MedLabSpecimenNum=Meth.GetLong(MethodBase.GetCurrentMethod(),medLabSpecimen); return medLabSpecimen.MedLabSpecimenNum; } return Crud.MedLabSpecimenCrud.Insert(medLabSpecimen); }
//If this table type will exist as cached data, uncomment the CachePattern region below and edit. /* #region CachePattern * * private class MedLabSpecimenCache : CacheListAbs<MedLabSpecimen> { * protected override List<MedLabSpecimen> GetCacheFromDb() { * string command="SELECT * FROM MedLabSpecimen ORDER BY ItemOrder"; * return Crud.MedLabSpecimenCrud.SelectMany(command); * } * protected override List<MedLabSpecimen> TableToList(DataTable table) { * return Crud.MedLabSpecimenCrud.TableToList(table); * } * protected override MedLabSpecimen Copy(MedLabSpecimen MedLabSpecimen) { * return MedLabSpecimen.Clone(); * } * protected override DataTable ListToTable(List<MedLabSpecimen> listMedLabSpecimens) { * return Crud.MedLabSpecimenCrud.ListToTable(listMedLabSpecimens,"MedLabSpecimen"); * } * protected override void FillCacheIfNeeded() { * MedLabSpecimens.GetTableFromCache(false); * } * protected override bool IsInListShort(MedLabSpecimen MedLabSpecimen) { * return !MedLabSpecimen.IsHidden; * } * } * * ///<summary>The object that accesses the cache in a thread-safe manner.</summary> * private static MedLabSpecimenCache _MedLabSpecimenCache=new MedLabSpecimenCache(); * * ///<summary>A list of all MedLabSpecimens. Returns a deep copy.</summary> * public static List<MedLabSpecimen> ListDeep { * get { * return _MedLabSpecimenCache.ListDeep; * } * } * * ///<summary>A list of all visible MedLabSpecimens. Returns a deep copy.</summary> * public static List<MedLabSpecimen> ListShortDeep { * get { * return _MedLabSpecimenCache.ListShortDeep; * } * } * * ///<summary>A list of all MedLabSpecimens. Returns a shallow copy.</summary> * public static List<MedLabSpecimen> ListShallow { * get { * return _MedLabSpecimenCache.ListShallow; * } * } * * ///<summary>A list of all visible MedLabSpecimens. Returns a shallow copy.</summary> * public static List<MedLabSpecimen> ListShort { * get { * return _MedLabSpecimenCache.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) { * _MedLabSpecimenCache.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); * _MedLabSpecimenCache.FillCacheFromTable(table); * return table; * } * return _MedLabSpecimenCache.GetTableFromCache(doRefreshCache); * } * #endregion */ ///<summary></summary> public static long Insert(MedLabSpecimen medLabSpecimen) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { medLabSpecimen.MedLabSpecimenNum = Meth.GetLong(MethodBase.GetCurrentMethod(), medLabSpecimen); return(medLabSpecimen.MedLabSpecimenNum); } return(Crud.MedLabSpecimenCrud.Insert(medLabSpecimen)); }