CSLA - Generated - Batch - As
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 AssignmentInfo : ReadOnlyBase<AssignmentInfo>, IDisposable
|
||||
{
|
||||
public event AssignmentInfoEvent 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<AssignmentInfo> _CacheList = new List<AssignmentInfo>();
|
||||
protected static void AddToCache(AssignmentInfo assignmentInfo)
|
||||
{
|
||||
@@ -45,6 +41,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
while (_CacheList.Contains(assignmentInfo)) _CacheList.Remove(assignmentInfo); // In RemoveFromCache
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private static Dictionary<string, List<AssignmentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AssignmentInfo>>();
|
||||
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 Assignment _Editable;
|
||||
private IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_Editable != null)
|
||||
hasBrokenRules = _Editable.HasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
}
|
||||
private int _AID;
|
||||
[System.ComponentModel.DataObjectField(true, true)]
|
||||
public int AID
|
||||
@@ -195,15 +179,6 @@ namespace VEPROMS.CSLA.Library
|
||||
return _UsrID;
|
||||
}
|
||||
}
|
||||
// CSLATODO: Replace base AssignmentInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
/// Overrides Base ToString
|
||||
/// </summary>
|
||||
/// <returns>A string representation of current AssignmentInfo</returns>
|
||||
//public override string ToString()
|
||||
//{
|
||||
// return base.ToString();
|
||||
//}
|
||||
// CSLATODO: Check AssignmentInfo.GetIdValue to assure that the ID returned is unique
|
||||
/// <summary>
|
||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||
@@ -216,11 +191,10 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _AssignmentInfoUnique = 0;
|
||||
private static int AssignmentInfoUnique
|
||||
{ get { return ++_AssignmentInfoUnique; } }
|
||||
private int _MyAssignmentInfoUnique = AssignmentInfoUnique;
|
||||
public int MyAssignmentInfoUnique // Absolutely Unique ID - Info
|
||||
{ get { return _MyAssignmentInfoUnique; } }
|
||||
private static int AssignmentInfoUnique => ++_AssignmentInfoUnique;
|
||||
private readonly int _MyAssignmentInfoUnique = AssignmentInfoUnique;
|
||||
// Absolutely Unique ID - Info
|
||||
public int MyAssignmentInfoUnique => _MyAssignmentInfoUnique;
|
||||
protected AssignmentInfo()
|
||||
{/* require use of factory methods */
|
||||
AddToCache(this);
|
||||
@@ -229,15 +203,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;
|
||||
~AssignmentInfo()
|
||||
{
|
||||
_CountFinalized++;
|
||||
@@ -254,10 +224,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (listAssignmentInfo.Count == 0) // If there are no items left in the list
|
||||
_CacheByPrimaryKey.Remove(AID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Assignment Get()
|
||||
{
|
||||
return _Editable = Assignment.Get(_AID);
|
||||
}
|
||||
public virtual Assignment Get() => _Editable = Assignment.Get(_AID);
|
||||
public static void Refresh(Assignment tmp)
|
||||
{
|
||||
string key = tmp.AID.ToString();
|
||||
@@ -270,25 +237,25 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_GID != tmp.GID)
|
||||
{
|
||||
if (MyGroup != null) MyGroup.RefreshGroupAssignments(); // Update List for old value
|
||||
MyGroup?.RefreshGroupAssignments(); // Update List for old value
|
||||
_GID = tmp.GID; // Update the value
|
||||
}
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
if (MyGroup != null) MyGroup.RefreshGroupAssignments(); // Update List for new value
|
||||
MyGroup?.RefreshGroupAssignments(); // Update List for new value
|
||||
if (_RID != tmp.RID)
|
||||
{
|
||||
if (MyRole != null) MyRole.RefreshRoleAssignments(); // Update List for old value
|
||||
MyRole?.RefreshRoleAssignments(); // Update List for old value
|
||||
_RID = tmp.RID; // Update the value
|
||||
}
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
if (MyRole != null) MyRole.RefreshRoleAssignments(); // Update List for new value
|
||||
MyRole?.RefreshRoleAssignments(); // Update List for new value
|
||||
if (_FolderID != tmp.FolderID)
|
||||
{
|
||||
if (MyFolder != null) MyFolder.RefreshFolderAssignments(); // Update List for old value
|
||||
MyFolder?.RefreshFolderAssignments(); // Update List for old value
|
||||
_FolderID = tmp.FolderID; // Update the value
|
||||
}
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
if (MyFolder != null) MyFolder.RefreshFolderAssignments(); // Update List for new value
|
||||
MyFolder?.RefreshFolderAssignments(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_DTS = tmp.DTS;
|
||||
@@ -308,18 +275,18 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_GID != tmp.GID)
|
||||
{
|
||||
if (MyGroup != null) MyGroup.RefreshGroupAssignments(); // Update List for old value
|
||||
MyGroup?.RefreshGroupAssignments(); // Update List for old value
|
||||
_GID = tmp.GID; // Update the value
|
||||
}
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
if (MyGroup != null) MyGroup.RefreshGroupAssignments(); // Update List for new value
|
||||
MyGroup?.RefreshGroupAssignments(); // Update List for new value
|
||||
if (_RID != tmp.RID)
|
||||
{
|
||||
if (MyRole != null) MyRole.RefreshRoleAssignments(); // Update List for old value
|
||||
MyRole?.RefreshRoleAssignments(); // Update List for old value
|
||||
_RID = tmp.RID; // Update the value
|
||||
}
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
if (MyRole != null) MyRole.RefreshRoleAssignments(); // Update List for new value
|
||||
MyRole?.RefreshRoleAssignments(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_DTS = tmp.DTS;
|
||||
@@ -339,18 +306,18 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_RID != tmp.RID)
|
||||
{
|
||||
if (MyRole != null) MyRole.RefreshRoleAssignments(); // Update List for old value
|
||||
MyRole?.RefreshRoleAssignments(); // Update List for old value
|
||||
_RID = tmp.RID; // Update the value
|
||||
}
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
if (MyRole != null) MyRole.RefreshRoleAssignments(); // Update List for new value
|
||||
MyRole?.RefreshRoleAssignments(); // Update List for new value
|
||||
if (_FolderID != tmp.FolderID)
|
||||
{
|
||||
if (MyFolder != null) MyFolder.RefreshFolderAssignments(); // Update List for old value
|
||||
MyFolder?.RefreshFolderAssignments(); // Update List for old value
|
||||
_FolderID = tmp.FolderID; // Update the value
|
||||
}
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
if (MyFolder != null) MyFolder.RefreshFolderAssignments(); // Update List for new value
|
||||
MyFolder?.RefreshFolderAssignments(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_DTS = tmp.DTS;
|
||||
@@ -370,18 +337,18 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_GID != tmp.GID)
|
||||
{
|
||||
if (MyGroup != null) MyGroup.RefreshGroupAssignments(); // Update List for old value
|
||||
MyGroup?.RefreshGroupAssignments(); // Update List for old value
|
||||
_GID = tmp.GID; // Update the value
|
||||
}
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
if (MyGroup != null) MyGroup.RefreshGroupAssignments(); // Update List for new value
|
||||
MyGroup?.RefreshGroupAssignments(); // Update List for new value
|
||||
if (_FolderID != tmp.FolderID)
|
||||
{
|
||||
if (MyFolder != null) MyFolder.RefreshFolderAssignments(); // Update List for old value
|
||||
MyFolder?.RefreshFolderAssignments(); // Update List for old value
|
||||
_FolderID = tmp.FolderID; // Update the value
|
||||
}
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
if (MyFolder != null) MyFolder.RefreshFolderAssignments(); // Update List for new value
|
||||
MyFolder?.RefreshFolderAssignments(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_DTS = tmp.DTS;
|
||||
@@ -391,8 +358,6 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static AssignmentInfo Get(int aid)
|
||||
{
|
||||
//if (!CanGetObject())
|
||||
// throw new System.Security.SecurityException("User not authorized to view a Assignment");
|
||||
try
|
||||
{
|
||||
AssignmentInfo tmp = GetCachedByPrimaryKey(aid);
|
||||
@@ -431,13 +396,9 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
protected class PKCriteria
|
||||
{
|
||||
private int _AID;
|
||||
public int AID
|
||||
{ get { return _AID; } }
|
||||
public PKCriteria(int aid)
|
||||
{
|
||||
_AID = aid;
|
||||
}
|
||||
private readonly int _AID;
|
||||
public int AID => _AID;
|
||||
public PKCriteria(int aid) => _AID = aid;
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
@@ -499,7 +460,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
// Standard Refresh
|
||||
#region extension
|
||||
AssignmentInfoExtension _AssignmentInfoExtension = new AssignmentInfoExtension();
|
||||
readonly AssignmentInfoExtension _AssignmentInfoExtension = new AssignmentInfoExtension();
|
||||
[Serializable()]
|
||||
partial class AssignmentInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
@@ -515,10 +476,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 AssignmentInfo)
|
||||
if (destType == typeof(string) && value is AssignmentInfo info)
|
||||
{
|
||||
// Return the ToString value
|
||||
return ((AssignmentInfo)value).ToString();
|
||||
return info.ToString();
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user