C2018-039: Upgrade – User Control of Format

This commit is contained in:
2018-12-12 15:34:25 +00:00
parent ddf01e9f9a
commit bbcb638024
29 changed files with 4656 additions and 133 deletions

View File

@@ -262,6 +262,27 @@ namespace VEPROMS.CSLA.Library
}
}
}
private string _Config = string.Empty;
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("Config", true);
return _Config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("Config", true);
if (value == null) value = string.Empty;
if (_Config != value)
{
_Config = value;
PropertyHasChanged();
}
}
}
private string _GenMac = string.Empty;
public string GenMac
{
@@ -559,15 +580,18 @@ namespace VEPROMS.CSLA.Library
Csla.Validation.CommonRules.StringRequired, "Name");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 20));
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Description", 250));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "Data");
//ValidationRules.AddRule(
// Csla.Validation.CommonRules.StringRequired, "Data");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Data", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("GenMac", 1073741823));
@@ -747,13 +771,14 @@ namespace VEPROMS.CSLA.Library
tmp.Data = data;
return tmp;
}
public static Format New(Format myParent, string name, string description, string data, string genMac, DateTime dts, string userID)
public static Format New(Format myParent, string name, string description, string data, string config, string genMac, DateTime dts, string userID)
{
Format tmp = Format.New();
tmp.MyParent = myParent;
tmp.Name = name;
tmp.Description = description;
tmp.Data = data;
tmp.Config = config;
tmp.GenMac = genMac;
tmp.DTS = dts;
tmp.UserID = userID;
@@ -761,7 +786,7 @@ namespace VEPROMS.CSLA.Library
}
public static Format MakeFormat(Format myParent, string name, string description, string data, string genMac, DateTime dts, string userID)
{
Format tmp = Format.New(myParent, name, description, data, genMac, dts, userID);
Format tmp = Format.New(myParent, name, description, data, null, genMac, dts, userID);
if (tmp.IsSavable)
tmp = tmp.Save();
else
@@ -775,19 +800,20 @@ namespace VEPROMS.CSLA.Library
}
return tmp;
}
public static Format New(Format myParent, string name, string description, string data, string genMac)
public static Format New(Format myParent, string name, string description, string data, string config, string genMac)
{
Format tmp = Format.New();
tmp.MyParent = myParent;
tmp.Name = name;
tmp.Description = description;
tmp.Data = data;
tmp.Config = config;
tmp.GenMac = genMac;
return tmp;
}
public static Format MakeFormat(Format myParent, string name, string description, string data, string genMac)
{
Format tmp = Format.New(myParent, name, description, data, genMac);
Format tmp = Format.New(myParent, name, description, data, null, genMac);
if (tmp.IsSavable)
tmp = tmp.Save();
else
@@ -953,6 +979,7 @@ namespace VEPROMS.CSLA.Library
_Name = dr.GetString("Name");
_Description = dr.GetString("Description");
_Data = dr.GetString("Data");
_Config = dr.GetString("Config");
_GenMac = dr.GetString("GenMac");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
@@ -1094,6 +1121,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", _Name);
cm.Parameters.AddWithValue("@Description", _Description);
cm.Parameters.AddWithValue("@Data", _Data);
cm.Parameters.AddWithValue("@Config", _Config);
cm.Parameters.AddWithValue("@GenMac", _GenMac);
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
@@ -1126,7 +1154,7 @@ namespace VEPROMS.CSLA.Library
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn, ref int formatID, Format myParent, string name, string description, string data, string genMac, DateTime dts, string userID)
public static byte[] Add(SqlConnection cn, ref int formatID, Format myParent, string name, string description, string data, string config, string genMac, DateTime dts, string userID)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.Add", 0);
try
@@ -1141,6 +1169,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", name);
cm.Parameters.AddWithValue("@Description", description);
cm.Parameters.AddWithValue("@Data", data);
cm.Parameters.AddWithValue("@Config", config);
cm.Parameters.AddWithValue("@GenMac", genMac);
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
@@ -1208,6 +1237,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", _Name);
cm.Parameters.AddWithValue("@Description", _Description);
cm.Parameters.AddWithValue("@Data", _Data);
cm.Parameters.AddWithValue("@Config", _Config);
cm.Parameters.AddWithValue("@GenMac", _GenMac);
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
@@ -1243,9 +1273,9 @@ namespace VEPROMS.CSLA.Library
{
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
if (IsNew)
_LastChanged = Format.Add(cn, ref _FormatID, _MyParent, _Name, _Description, _Data, _GenMac, _DTS, _UserID);
_LastChanged = Format.Add(cn, ref _FormatID, _MyParent, _Name, _Description, _Data, _Config, _GenMac, _DTS, _UserID);
else
_LastChanged = Format.Update(cn, ref _FormatID, _ParentID, _Name, _Description, _Data, _GenMac, _DTS, _UserID, ref _LastChanged);
_LastChanged = Format.Update(cn, ref _FormatID, _ParentID, _Name, _Description, _Data, _Config, _GenMac, _DTS, _UserID, ref _LastChanged);
MarkOld();
}
if (_FormatFolders != null) _FormatFolders.Update(this);
@@ -1264,7 +1294,7 @@ namespace VEPROMS.CSLA.Library
MarkNew();
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn, ref int formatID, int parentID, string name, string description, string data, string genMac, DateTime dts, string userID, ref byte[] lastChanged)
public static byte[] Update(SqlConnection cn, ref int formatID, int parentID, string name, string description, string data, string config, string genMac, DateTime dts, string userID, ref byte[] lastChanged)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.Update", 0);
try
@@ -1280,6 +1310,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", name);
cm.Parameters.AddWithValue("@Description", description);
cm.Parameters.AddWithValue("@Data", data);
cm.Parameters.AddWithValue("@Config", config);
cm.Parameters.AddWithValue("@GenMac", genMac);
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);

View File

@@ -152,6 +152,16 @@ namespace VEPROMS.CSLA.Library
return _Data;
}
}
private string _Config = string.Empty;
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("Config", true);
return _Config;
}
}
private string _GenMac = string.Empty;
public string GenMac
{
@@ -417,6 +427,7 @@ namespace VEPROMS.CSLA.Library
_Name = tmp.Name;
_Description = tmp.Description;
_Data = tmp.Data;
_Config = tmp.Config;
_GenMac = tmp.GenMac;
_DTS = tmp.DTS;
_UserID = tmp.UserID;
@@ -483,6 +494,7 @@ namespace VEPROMS.CSLA.Library
_Name = dr.GetString("Name");
_Description = dr.GetString("Description");
_Data = dr.GetString("Data");
_Config = dr.GetString("Config");
_GenMac = dr.GetString("GenMac");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");

View File

@@ -103,6 +103,7 @@ namespace VEPROMS.CSLA.Library
public static void Reset()
{
_FormatInfoList = null;
_SortedFormatInfoList = null;
}
// CSLATODO: Add alternative gets -
//public static FormatInfoList Get(<criteria>)