FIC_Solar/SolarPower/Models/ErrorCode.cs
2021-10-01 17:05:05 +08:00

59 lines
1.9 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", "傳入參數錯誤。" },
{ "0002", "請先刪除相關逆變器"},
{ "0003", "請先刪除相關設備"},
{ "0004", "請先移除相關逆變器綁定"},
{ "9984", "連線逾時"},
{ "9985", "該電站尚無逆變器資料"},
{ "9986", "該帳號已被註冊,請重新輸入"},
{ "9987", "查無該運維作業記錄檔案"},
{ "9988", "查無該資料紀錄"},
{ "9989", "查無該運維作業記錄"},
{ "9990", "查無該圖片"},
{ "9991", "查無該土地房屋資訊"},
{ "9992", "查無該電站資訊"},
{ "9993", "無此權限操作"},
{ "9994", "查無該公司角色"},
{ "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 "查無代碼";
}
}
}
}