using System; using System.Data; using HcUtility.Core; namespace HcUtility.Comm { public class DBResult { private bool success = false; public bool Success { get { return success; } set { success = value; } } private string message = String.Empty; public string Message { get { return message; } set { message = value; } } private string message2 = String.Empty; public string Message2 { get { return message2; } set { message2 = value; } } public object Data { get; set; } public DBResult() { success = false; message = ""; Data = null; } public DBResult(bool _success, string _message, object _data) { success = _success; message = _message; Data = _data; } public DBResult(bool _success, string _message) { success = _success; message = _message; } public void setMessage(bool _success, string _message) { success = _success; message += _message+ ";"; } public void OK() { OK(""); } public void OK( string _message) { success = true; message += _message + ";"; } public void OK(string _message,object data) { success = true; message += _message + ";"; Data=data; } public void SetErrorInfo(string message, bool success = false, object data = null) { if (Success != success) Message = ""; Success = success; if (Message.IndexOf(message) >= 0) { } else { if (!string.IsNullOrWhiteSpace(Message) && !string.IsNullOrWhiteSpace(message)) Message += ","; Message += message; Data = data; } } } public class DBDataSetResult : DBResult { public DataSet DataSet {get;set;} } public class DBModelObjectResult : DBResult { public ModelObjectBase ModelObject { get; set; } } }