B2019-107 Added Error Handling for missing Config field

This commit is contained in:
Rich 2019-08-06 19:38:43 +00:00
parent 3bcfbffc5d
commit cc1ccb37d7
2 changed files with 33 additions and 2 deletions

View File

@ -969,6 +969,11 @@ namespace VEPROMS.CSLA.Library
// CSLATODO: Add any defaults that are necessary // CSLATODO: Add any defaults that are necessary
ValidationRules.CheckRules(); ValidationRules.CheckRules();
} }
public static string Failed
{
get { return FormatInfo._Failed; }
set { FormatInfo._Failed = value; }
}
private void ReadData(SafeDataReader dr) private void ReadData(SafeDataReader dr)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.ReadData", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.ReadData", GetHashCode());
@ -979,7 +984,17 @@ namespace VEPROMS.CSLA.Library
_Name = dr.GetString("Name"); _Name = dr.GetString("Name");
_Description = dr.GetString("Description"); _Description = dr.GetString("Description");
_Data = dr.GetString("Data"); _Data = dr.GetString("Data");
_Config = dr.GetString("Config"); try // B2019-107 Added Error Handling for missing Config field
{
_Config = dr.GetString("Config");
}
catch(Exception ex)
{
if (Failed==null)
{
Failed = string.Format("\r\n*** PromsFixes.SQL may not be up to date - {0} - {1}", ex.GetType().Name, ex.Message);
}
}
_GenMac = dr.GetString("GenMac"); _GenMac = dr.GetString("GenMac");
_DTS = dr.GetDateTime("DTS"); _DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID"); _UserID = dr.GetString("UserID");

View File

@ -484,6 +484,12 @@ namespace VEPROMS.CSLA.Library
_FormatID = formatID; _FormatID = formatID;
} }
} }
public static string _Failed = null;
public static string Failed
{
get { return FormatInfo._Failed; }
set { FormatInfo._Failed = value; }
}
private void ReadData(SafeDataReader dr) private void ReadData(SafeDataReader dr)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.ReadData", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.ReadData", GetHashCode());
@ -494,7 +500,17 @@ namespace VEPROMS.CSLA.Library
_Name = dr.GetString("Name"); _Name = dr.GetString("Name");
_Description = dr.GetString("Description"); _Description = dr.GetString("Description");
_Data = dr.GetString("Data"); _Data = dr.GetString("Data");
_Config = dr.GetString("Config"); try // B2019-107 Added Error Handling for missing Config field
{
_Config = dr.GetString("Config");
}
catch (Exception ex)
{
if (Failed == null)
{
Failed = string.Format("\r\n*** PromsFixes.SQL may not be up to date - {0} - {1}", ex.GetType().Name, ex.Message);
}
}
_GenMac = dr.GetString("GenMac"); _GenMac = dr.GetString("GenMac");
_DTS = dr.GetDateTime("DTS"); _DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID"); _UserID = dr.GetString("UserID");