FIC_Solar/SolarPower/Models/ErrorCode.cs
2021-06-09 15:03:24 +08:00

45 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SolarPower.Models
{
//public enum ErrorCode : byte
//{
// Normal = 0, //正常
// Suspend = 1 //停權
//}
public class ErrorCode
{
Dictionary<string, string> errorrCode = new Dictionary<string, string>()
{
{ "0000", "OK" },
{ "0001", "傳入參數錯誤。" },
{ "9995", "該統一編號已被使用。" },
{ "9996", "查無該公司資訊。" },
{ "9997", "帳號或密碼輸入錯誤。"},
{ "9998", "查無該使用者。"},
{ "9999", "系統內部錯誤,請聯絡管理者。"}
};
/// <summary>
/// 取得錯誤代碼字串
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public string GetString(string code)
{
if (true == (errorrCode.ContainsKey(code)))
{
return errorrCode[code];
}
else
{
return "查無代碼";
}
}
}
}