?? blexception.cs
字號:
using System;
namespace DingHaokai.BussinessLogic
{
public enum ExceptionType {None, Normal, Serious, Fatal, DataLoadFailed, DataValidateFailed, RecordNotFound, UpdateFailed, FieldLengthUnmatched, BillStateUnmatched}
/// <summary>
/// BLException 的摘要說明。
/// </summary>
public class BLException : Exception
{
private ExceptionType exceptionType;
private string message;
public BLException(ExceptionType exType, string message)
{
this.exceptionType = exType;
this.message = message;
}
public BLException(ExceptionType exType): this(exType, null)
{
}
public override string Message
{
get
{
string typeText = "";
if (exceptionType != ExceptionType.None)
typeText = /*CDMS.Utility.*/MessagesFactory.ExceptionMessages[exceptionType.ToString()]+":\r\n";
return typeText+message;
}
}
}
public class MessagesFactory
{
public static ExceptionMessages ExceptionMessages
{
get
{
return ExceptionMessages.Instance;
}
}
}
public class ExceptionMessages
{
private static ExceptionMessages msg;
private ExceptionMessages()
{
}
public static ExceptionMessages Instance
{
get
{
if (msg==null)
msg = new ExceptionMessages();
return msg;
}
}
public string this[string msgID]
{
get { return GetMessageText(msgID); }
set { SetMessageText(msgID, value); }
}
public string GetMessageText(string msgID)
{
string text=null;
switch (msgID)
{
case "None":
text = "";
break;
case "Normal":
text = "一般性錯誤";
break;
case "Serious":
text = "嚴重錯誤";
break;
case "Fatal":
text = "致命性錯誤";
break;
case "DataLoadFailed":
text = "加載數據失敗";
break;
case "DataValidateFailed":
text = "數據驗證失敗";
break;
case "RecordNotFound":
text = "記錄未找到";
break;
case "UpdateFailed":
text = "數據更新失敗";
break;
case "FieldLengthUnmatched":
text = "在字段[{0}]中輸入的值超出該字段最大長度:{1}";
break;
case "BillStateUnmatched":
text = "單據狀態不符";
break;
default:
text = "未知錯誤";
break;
}
return text;
}
public void SetMessageText(string msgID, string msgText)
{
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -