Checking in latest SDALEO changes optimizing Advantage really only.
This commit is contained in:
85
DBError.cs
85
DBError.cs
@@ -11,17 +11,47 @@ namespace Sdaleo
|
||||
/// Our Custom Database Error Class that DB Functions Return to External Callers
|
||||
/// </summary>
|
||||
public class DBError
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Used internally to quickly create a custom error object for
|
||||
/// default Database Layer Errors
|
||||
/// </summary>
|
||||
/// <param name="ErrorMsg">The Error Message to Display</param>
|
||||
internal const int DATABASE_LAYER_ERROR_NUMBER = 1978;
|
||||
|
||||
/// <summary>
|
||||
/// Error number defaulted to -1
|
||||
/// </summary>
|
||||
public int nError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Error message defaulted to ""
|
||||
/// </summary>
|
||||
public string ErrorMsg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of Error IDs (defaulted to null)
|
||||
/// </summary>
|
||||
public ICollection Errors { get; set; }
|
||||
|
||||
#region Construction
|
||||
|
||||
/// <summary>
|
||||
/// Create a defaulted Error Object
|
||||
/// </summary>
|
||||
public DBError()
|
||||
{
|
||||
nError = -1;
|
||||
ErrorMsg = String.Empty;
|
||||
Errors = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a custom Error Object
|
||||
/// </summary>
|
||||
/// <param name="nError"></param>
|
||||
/// <param name="ErrorMsg"></param>
|
||||
/// <param name="Errors"></param>
|
||||
public DBError(int nError, string ErrorMsg, ICollection Errors)
|
||||
{
|
||||
this.nError = nError;
|
||||
@@ -30,35 +60,40 @@ namespace Sdaleo
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used internally to quickly create a custom error object
|
||||
/// Initialize DBError with SDaleo Default Error Info
|
||||
/// </summary>
|
||||
/// <param name="ErrorMsg">The Error Message to Display</param>
|
||||
private const int DATABASE_LAYER_ERROR_NUMBER = 1978;
|
||||
public DBError(string ErrorMsg)
|
||||
{
|
||||
this.nError = DATABASE_LAYER_ERROR_NUMBER;
|
||||
this.ErrorMsg = ErrorMsg;
|
||||
this.Errors = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Static
|
||||
|
||||
/// <summary>
|
||||
/// Create a Default DatabaseLayer Sdaleo Error
|
||||
/// </summary>
|
||||
/// <param name="ErrorMsg"></param>
|
||||
/// <returns></returns>
|
||||
internal static DBError Create(string ErrorMsg)
|
||||
{
|
||||
return new DBError(DATABASE_LAYER_ERROR_NUMBER, ErrorMsg, null);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ErrorOccured { get { return (nError != -1 && !String.IsNullOrEmpty(ErrorMsg)); } }
|
||||
public int GetErrorCount { get { if (Errors != null) { return Errors.Count; } return 0; } }
|
||||
public List<int> GetAllErrorNumbers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Errors != null)
|
||||
{
|
||||
List<int> list = new List<int>();
|
||||
#endregion
|
||||
|
||||
// * DBMS SPECIFIC *
|
||||
// TO DO
|
||||
foreach (SqlError error in Errors)
|
||||
list.Add(error.Number);
|
||||
//
|
||||
|
||||
return list;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Did an error occur? nError != -1 and ErrorMsg != ""
|
||||
/// </summary>
|
||||
public bool ErrorOccured
|
||||
{
|
||||
get
|
||||
{
|
||||
return (nError != -1 && !String.IsNullOrEmpty(ErrorMsg));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user