diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ContentRoUsage.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ContentRoUsage.cs
index 715d5769..73174519 100644
--- a/PROMS/VEPROMS.CSLA.Library/Generated/ContentRoUsage.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ContentRoUsage.cs
@@ -143,6 +143,107 @@ namespace VEPROMS.CSLA.Library
}
}
private byte[] _LastChanged = new byte[8];//timestamp
+ private int _RODbID;
+ public int RODbID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODbID", true);
+ if (_MyRODb != null) _RODbID = _MyRODb.RODbID;
+ return _RODbID;
+ }
+ }
+ private RODb _MyRODb;
+ public RODb MyRODb
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyRODb", true);
+ if (_MyRODb == null && _RODbID != 0) _MyRODb = RODb.Get(_RODbID);
+ return _MyRODb;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("MyRODb", true);
+ if (_MyRODb != value)
+ {
+ _MyRODb = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _RODb_ROName = string.Empty;
+ ///
+ /// Hook for future - to allow the user to select multiple RO Databases assocaiated with on DocVersion
+ ///
+ public string RODb_ROName
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODb_ROName", true);
+ return _RODb_ROName;
+ }
+ }
+ private string _RODb_FolderPath = string.Empty;
+ ///
+ /// Path to the RO database
+ ///
+ public string RODb_FolderPath
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODb_FolderPath", true);
+ return _RODb_FolderPath;
+ }
+ }
+ private string _RODb_DBConnectionString = string.Empty;
+ ///
+ /// Connection String - Default could just be the full path and name of the database
+ ///
+ public string RODb_DBConnectionString
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODb_DBConnectionString", true);
+ return _RODb_DBConnectionString;
+ }
+ }
+ private string _RODb_Config = string.Empty;
+ public string RODb_Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODb_Config", true);
+ return _RODb_Config;
+ }
+ }
+ private DateTime _RODb_DTS = new DateTime();
+ public DateTime RODb_DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODb_DTS", true);
+ return _RODb_DTS;
+ }
+ }
+ private string _RODb_UserID = string.Empty;
+ public string RODb_UserID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODb_UserID", true);
+ return _RODb_UserID;
+ }
+ }
// TODO: Check ContentRoUsage.GetIdValue to assure that the ID returned is unique
///
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
@@ -161,6 +262,14 @@ namespace VEPROMS.CSLA.Library
//{
// return base.ToString();
//}
+ public override bool IsDirty
+ {
+ get { return base.IsDirty || (_MyRODb == null ? false : _MyRODb.IsDirty); }
+ }
+ public override bool IsValid
+ {
+ get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyRODb == null ? true : _MyRODb.IsValid); }
+ }
#endregion
#region ValidationRules
[NonSerialized]
@@ -175,6 +284,7 @@ namespace VEPROMS.CSLA.Library
{
_CheckingBrokenRules = true;
IVEHasBrokenRules hasBrokenRules = null;
+ if (_MyRODb != null && (hasBrokenRules = _MyRODb.HasBrokenRules) != null) return hasBrokenRules;
return hasBrokenRules;
}
finally
@@ -207,8 +317,18 @@ namespace VEPROMS.CSLA.Library
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ ValidationRules.AddRule(MyRODbRequired, "MyRODb");
// TODO: Add other validation rules
}
+ private static bool MyRODbRequired(ContentRoUsage target, Csla.Validation.RuleArgs e)
+ {
+ if (target._RODbID == 0 && target._MyRODb == null) // Required field missing
+ {
+ e.Description = "Required";
+ return false;
+ }
+ return true;
+ }
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
@@ -234,6 +354,8 @@ namespace VEPROMS.CSLA.Library
//AuthorizationRules.AllowWrite(DTS, "");
//AuthorizationRules.AllowRead(UserID, "");
//AuthorizationRules.AllowWrite(UserID, "");
+ //AuthorizationRules.AllowRead(RODbID, "");
+ //AuthorizationRules.AllowWrite(RODbID, "");
}
public static bool CanAddObject()
{
@@ -265,9 +387,9 @@ namespace VEPROMS.CSLA.Library
#region Factory Methods
public int CurrentEditLevel
{ get { return EditLevel; } }
- internal static ContentRoUsage New(string roid)
+ internal static ContentRoUsage New(string roid, RODb myRODb)
{
- return new ContentRoUsage(roid);
+ return new ContentRoUsage(roid, myRODb);
}
internal static ContentRoUsage Get(SafeDataReader dr)
{
@@ -281,13 +403,14 @@ namespace VEPROMS.CSLA.Library
_UserID = _ContentRoUsageExtension.DefaultUserID;
ValidationRules.CheckRules();
}
- private ContentRoUsage(string roid)
+ private ContentRoUsage(string roid, RODb myRODb)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_DTS = _ContentRoUsageExtension.DefaultDTS;
_UserID = _ContentRoUsageExtension.DefaultUserID;
_ROID = roid;
+ _MyRODb = myRODb;
ValidationRules.CheckRules();
}
internal ContentRoUsage(SafeDataReader dr)
@@ -308,6 +431,13 @@ namespace VEPROMS.CSLA.Library
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ _RODbID = dr.GetInt32("RODbID");
+ _RODb_ROName = dr.GetString("RODb_ROName");
+ _RODb_FolderPath = dr.GetString("RODb_FolderPath");
+ _RODb_DBConnectionString = dr.GetString("RODb_DBConnectionString");
+ _RODb_Config = dr.GetString("RODb_Config");
+ _RODb_DTS = dr.GetDateTime("RODb_DTS");
+ _RODb_UserID = dr.GetString("RODb_UserID");
}
catch (Exception ex) // FKItem Fetch
{
@@ -321,7 +451,7 @@ namespace VEPROMS.CSLA.Library
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
- _LastChanged = RoUsage.Add(cn, ref _ROUsageID, myContent, _ROID, _Config, _DTS, _UserID);
+ _LastChanged = RoUsage.Add(cn, ref _ROUsageID, myContent, _ROID, _Config, _DTS, _UserID, _MyRODb);
MarkOld();
}
internal void Update(Content myContent)
@@ -329,7 +459,7 @@ namespace VEPROMS.CSLA.Library
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
- _LastChanged = RoUsage.Update(cn, ref _ROUsageID, myContent, _ROID, _Config, _DTS, _UserID, ref _LastChanged);
+ _LastChanged = RoUsage.Update(cn, ref _ROUsageID, myContent, _ROID, _Config, _DTS, _UserID, ref _LastChanged, _MyRODb);
MarkOld();
}
internal void DeleteSelf(Content myContent)
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ContentRoUsages.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ContentRoUsages.cs
index 88e81e9e..ecac510e 100644
--- a/PROMS/VEPROMS.CSLA.Library/Generated/ContentRoUsages.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ContentRoUsages.cs
@@ -57,9 +57,9 @@ namespace VEPROMS.CSLA.Library
return roUsage;
return null;
}
- public ContentRoUsage Add(string roid) // One to Many
+ public ContentRoUsage Add(string roid, RODb myRODb) // One to Many
{
- ContentRoUsage roUsage = ContentRoUsage.New(roid);
+ ContentRoUsage roUsage = ContentRoUsage.New(roid, myRODb);
this.Add(roUsage);
return roUsage;
}