CSLA - Generated - C Items
This commit is contained in:
@@ -13,8 +13,6 @@ using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using Csla;
|
||||
using Csla.Data;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
namespace VEPROMS.CSLA.Library
|
||||
@@ -28,14 +26,12 @@ namespace VEPROMS.CSLA.Library
|
||||
public partial class CheckInfo : ReadOnlyBase<CheckInfo>, IDisposable
|
||||
{
|
||||
public event CheckInfoEvent Changed;
|
||||
private void OnChange()
|
||||
{
|
||||
if (Changed != null) Changed(this);
|
||||
}
|
||||
private void OnChange() => Changed?.Invoke(this);
|
||||
#region Log4Net
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
#region Collection
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private static List<CheckInfo> _CacheList = new List<CheckInfo>();
|
||||
protected static void AddToCache(CheckInfo checkInfo)
|
||||
{
|
||||
@@ -45,6 +41,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
while (_CacheList.Contains(checkInfo)) _CacheList.Remove(checkInfo); // In RemoveFromCache
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private static Dictionary<string, List<CheckInfo>> _CacheByPrimaryKey = new Dictionary<string, List<CheckInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
@@ -74,21 +71,8 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Business Methods
|
||||
private string _ErrorMessage = string.Empty;
|
||||
public string ErrorMessage
|
||||
{
|
||||
get { return _ErrorMessage; }
|
||||
}
|
||||
public string ErrorMessage => _ErrorMessage;
|
||||
protected Check _Editable;
|
||||
private IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_Editable != null)
|
||||
hasBrokenRules = _Editable.HasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
}
|
||||
private int _CheckID;
|
||||
[System.ComponentModel.DataObjectField(true, true)]
|
||||
public int CheckID
|
||||
@@ -166,32 +150,18 @@ namespace VEPROMS.CSLA.Library
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
// CSLATODO: Replace base CheckInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
/// Overrides Base ToString
|
||||
/// </summary>
|
||||
/// <returns>A string representation of current CheckInfo</returns>
|
||||
//public override string ToString()
|
||||
//{
|
||||
// return base.ToString();
|
||||
//}
|
||||
// CSLATODO: Check CheckInfo.GetIdValue to assure that the ID returned is unique
|
||||
/// <summary>
|
||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||
/// </summary>
|
||||
/// <returns>A Unique ID for the current CheckInfo</returns>
|
||||
protected override object GetIdValue()
|
||||
{
|
||||
return MyCheckInfoUnique; // Absolutely Unique ID
|
||||
}
|
||||
protected override object GetIdValue() => MyCheckInfoUnique; // Absolutely Unique ID
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _CheckInfoUnique = 0;
|
||||
private static int CheckInfoUnique
|
||||
{ get { return ++_CheckInfoUnique; } }
|
||||
private int _MyCheckInfoUnique = CheckInfoUnique;
|
||||
public int MyCheckInfoUnique // Absolutely Unique ID - Info
|
||||
{ get { return _MyCheckInfoUnique; } }
|
||||
private static int CheckInfoUnique => ++_CheckInfoUnique;
|
||||
private readonly int _MyCheckInfoUnique = CheckInfoUnique;
|
||||
// Absolutely Unique ID - Info
|
||||
public int MyCheckInfoUnique => _MyCheckInfoUnique;
|
||||
protected CheckInfo()
|
||||
{/* require use of factory methods */
|
||||
AddToCache(this);
|
||||
@@ -200,15 +170,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private static int _CountCreated = 0;
|
||||
private static int _CountDisposed = 0;
|
||||
private static int _CountFinalized = 0;
|
||||
private static int IncrementCountCreated
|
||||
{ get { return ++_CountCreated; } }
|
||||
private int _CountWhenCreated = IncrementCountCreated;
|
||||
public static int CountCreated
|
||||
{ get { return _CountCreated; } }
|
||||
public static int CountNotDisposed
|
||||
{ get { return _CountCreated - _CountDisposed; } }
|
||||
public static int CountNotFinalized
|
||||
{ get { return _CountCreated - _CountFinalized; } }
|
||||
private static int IncrementCountCreated => ++_CountCreated;
|
||||
private readonly int _CountWhenCreated = IncrementCountCreated;
|
||||
public static int CountCreated => _CountCreated;
|
||||
public static int CountNotDisposed => _CountCreated - _CountDisposed;
|
||||
public static int CountNotFinalized => _CountCreated - _CountFinalized;
|
||||
~CheckInfo()
|
||||
{
|
||||
_CountFinalized++;
|
||||
@@ -225,10 +191,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (listCheckInfo.Count == 0) // If there are no items left in the list
|
||||
_CacheByPrimaryKey.Remove(CheckID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Check Get()
|
||||
{
|
||||
return _Editable = Check.Get(_CheckID);
|
||||
}
|
||||
public virtual Check Get() => _Editable = Check.Get(_CheckID);
|
||||
public static void Refresh(Check tmp)
|
||||
{
|
||||
string key = tmp.CheckID.ToString();
|
||||
@@ -241,18 +204,18 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_RevisionID != tmp.RevisionID)
|
||||
{
|
||||
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for old value
|
||||
MyRevision?.RefreshRevisionChecks(); // Update List for old value
|
||||
_RevisionID = tmp.RevisionID; // Update the value
|
||||
}
|
||||
_MyRevision = null; // Reset list so that the next line gets a new list
|
||||
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for new value
|
||||
MyRevision?.RefreshRevisionChecks(); // Update List for new value
|
||||
if (_StageID != tmp.StageID)
|
||||
{
|
||||
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for old value
|
||||
MyStage?.RefreshStageChecks(); // Update List for old value
|
||||
_StageID = tmp.StageID; // Update the value
|
||||
}
|
||||
_MyStage = null; // Reset list so that the next line gets a new list
|
||||
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for new value
|
||||
MyStage?.RefreshStageChecks(); // Update List for new value
|
||||
_ConsistencyChecks = tmp.ConsistencyChecks;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@@ -271,11 +234,11 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_StageID != tmp.StageID)
|
||||
{
|
||||
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for old value
|
||||
MyStage?.RefreshStageChecks(); // Update List for old value
|
||||
_StageID = tmp.StageID; // Update the value
|
||||
}
|
||||
_MyStage = null; // Reset list so that the next line gets a new list
|
||||
if (MyStage != null) MyStage.RefreshStageChecks(); // Update List for new value
|
||||
MyStage?.RefreshStageChecks(); // Update List for new value
|
||||
_ConsistencyChecks = tmp.ConsistencyChecks;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@@ -294,11 +257,11 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_RevisionID != tmp.RevisionID)
|
||||
{
|
||||
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for old value
|
||||
MyRevision?.RefreshRevisionChecks(); // Update List for old value
|
||||
_RevisionID = tmp.RevisionID; // Update the value
|
||||
}
|
||||
_MyRevision = null; // Reset list so that the next line gets a new list
|
||||
if (MyRevision != null) MyRevision.RefreshRevisionChecks(); // Update List for new value
|
||||
MyRevision?.RefreshRevisionChecks(); // Update List for new value
|
||||
_ConsistencyChecks = tmp.ConsistencyChecks;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@@ -307,8 +270,6 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static CheckInfo Get(int checkID)
|
||||
{
|
||||
//if (!CanGetObject())
|
||||
// throw new System.Security.SecurityException("User not authorized to view a Check");
|
||||
try
|
||||
{
|
||||
CheckInfo tmp = GetCachedByPrimaryKey(checkID);
|
||||
@@ -347,13 +308,9 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
protected class PKCriteria
|
||||
{
|
||||
private int _CheckID;
|
||||
public int CheckID
|
||||
{ get { return _CheckID; } }
|
||||
public PKCriteria(int checkID)
|
||||
{
|
||||
_CheckID = checkID;
|
||||
}
|
||||
private readonly int _CheckID;
|
||||
public int CheckID => _CheckID;
|
||||
public PKCriteria(int checkID) => _CheckID = checkID;
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
@@ -413,7 +370,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
// Standard Refresh
|
||||
#region extension
|
||||
CheckInfoExtension _CheckInfoExtension = new CheckInfoExtension();
|
||||
readonly CheckInfoExtension _CheckInfoExtension = new CheckInfoExtension();
|
||||
[Serializable()]
|
||||
partial class CheckInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
@@ -429,10 +386,10 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||
{
|
||||
if (destType == typeof(string) && value is CheckInfo)
|
||||
if (destType == typeof(string) && value is CheckInfo info)
|
||||
{
|
||||
// Return the ToString value
|
||||
return ((CheckInfo)value).ToString();
|
||||
return info.ToString();
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user