using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Collections; namespace Sdaleo { /// /// Our Custom Database Error Class that DB Functions Return to External Callers /// public class DBError { /// /// Used internally to quickly create a custom error object for /// default Database Layer Errors /// /// The Error Message to Display internal const int DATABASE_LAYER_ERROR_NUMBER = 1978; /// /// Error number defaulted to -1 /// public int nError { get; set; } /// /// Error message defaulted to "" /// public string ErrorMsg { get; set; } /// /// List of Error IDs (defaulted to null) /// public ICollection Errors { get; set; } #region Construction /// /// Create a defaulted Error Object /// public DBError() { nError = -1; ErrorMsg = String.Empty; Errors = null; } /// /// Create a custom Error Object /// /// /// /// public DBError(int nError, string ErrorMsg, ICollection Errors) { this.nError = nError; this.ErrorMsg = ErrorMsg; this.Errors = Errors; } /// /// Initialize DBError with SDaleo Default Error Info /// public DBError(string ErrorMsg) { this.nError = DATABASE_LAYER_ERROR_NUMBER; this.ErrorMsg = ErrorMsg; this.Errors = null; } #endregion #region Internal Static /// /// Create a Default DatabaseLayer Sdaleo Error /// /// /// internal static DBError Create(string ErrorMsg) { return new DBError(DATABASE_LAYER_ERROR_NUMBER, ErrorMsg, null); } #endregion /// /// Did an error occur? nError != -1 and ErrorMsg != "" /// public bool ErrorOccured { get { return (nError != -1 && !String.IsNullOrEmpty(ErrorMsg)); } } } }