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 { public int nError { get; set; } public string ErrorMsg { get; set; } public ICollection Errors { get; set; } public DBError() { nError = -1; ErrorMsg = String.Empty; Errors = null; } public DBError(int nError, string ErrorMsg, ICollection Errors) { this.nError = nError; this.ErrorMsg = ErrorMsg; this.Errors = Errors; } /// /// Used internally to quickly create a custom error object /// /// The Error Message to Display private const int DATABASE_LAYER_ERROR_NUMBER = 1978; 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 GetAllErrorNumbers { get { if (Errors != null) { List list = new List(); // * DBMS SPECIFIC * // TO DO foreach (SqlError error in Errors) list.Add(error.Number); // return list; } return null; } } } }