You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

86 lines
2.6 KiB

using System;
using System.Text;
using ChangKeTec.Wms.Models.Enums;
using CK.SCP.Utils;
//using ChangKeTec.Utils;
namespace ChangKeTec.Wms.Models
{
/*
public class ReturnResult
{
private const string SP = ";";
public ResultCode ResultCode { get; set; }
public string IndexString { get; set; }
public string ResultString { get; set; }
public ReturnResult()
{
ResultCode = Enums.ResultCode.Success;
IndexString = "";
ResultString = "";
}
public ReturnResult(ResultCode code,string index,string text)
{
ResultCode = code;
IndexString = index;
ResultString = text;
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append(EnumHelper.GetDesc(ResultCode)+SP);
sb.Append(IndexString+SP);
sb.Append(ResultString+SP);
return sb.ToString();
}
}
*/
[Serializable] //声明为可序列化的 因为要写入文件中
public class WmsException : ApplicationException//由用户程序引发,用于派生自定义的异常类型
{
private const string SP = ";";
// private ResultCode _code;
// private string _indexString;
public ErrorCode Code { get; set; }
public string IndexString { get; set; }
public Exception Ex { get; set; }
/// <summary>
/// 默认构造函数
/// </summary>
public WmsException()
{
}
public WmsException(ErrorCode code, string indexString = null, string message = null, Exception inner = null)
: base(message, inner)
{
Code = code;
IndexString = indexString;
Ex = inner;
}
// public WmsException(System.Runtime.Serialization.SerializationInfo info,
// System.Runtime.Serialization.StreamingContext context) : base(info, context)
// {
// _indexString = info.GetString(IndexString);
// }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append(EnumHelper.GetDesc(Code) + SP);
if (!string.IsNullOrEmpty(IndexString))
sb.Append(IndexString + SP);
if (!string.IsNullOrEmpty(Message))
sb.Append(Message + SP);
if (Ex != null)
sb.Append(Ex);
return sb.ToString();
}
}
}