73 lines
1.9 KiB
C#
73 lines
1.9 KiB
C#
namespace YLErp.DBModels
|
|
{
|
|
/// <summary>
|
|
/// 保证金配置期限常量定义
|
|
/// </summary>
|
|
public static class ConsMarginTerm
|
|
{
|
|
/// <summary>
|
|
/// 默认期限(空字符串)
|
|
/// </summary>
|
|
public const string Default = "";
|
|
|
|
/// <summary>
|
|
/// 2年期
|
|
/// </summary>
|
|
public const string TwoYear = "2Y";
|
|
|
|
/// <summary>
|
|
/// 5年期
|
|
/// </summary>
|
|
public const string FiveYear = "5Y";
|
|
|
|
/// <summary>
|
|
/// 10年期
|
|
/// </summary>
|
|
public const string TenYear = "10Y";
|
|
|
|
/// <summary>
|
|
/// 30年期
|
|
/// </summary>
|
|
public const string ThirtyYear = "30Y";
|
|
|
|
/// <summary>
|
|
/// 所有允许的期限值
|
|
/// </summary>
|
|
public static readonly List<string> AllowedTerms = new List<string>
|
|
{
|
|
Default,
|
|
TwoYear,
|
|
FiveYear,
|
|
TenYear,
|
|
ThirtyYear
|
|
};
|
|
|
|
/// <summary>
|
|
/// 验证期限是否有效
|
|
/// </summary>
|
|
/// <param name="term">期限值</param>
|
|
/// <returns>是否有效</returns>
|
|
public static bool IsValidTerm(string term)
|
|
{
|
|
return AllowedTerms.Contains(term ?? string.Empty);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取期限的显示名称
|
|
/// </summary>
|
|
/// <param name="term">期限值</param>
|
|
/// <returns>显示名称</returns>
|
|
public static string GetDisplayName(string term)
|
|
{
|
|
return term switch
|
|
{
|
|
Default => "默认",
|
|
TwoYear => "2年",
|
|
FiveYear => "5年",
|
|
TenYear => "10年",
|
|
ThirtyYear => "30年",
|
|
_ => term?.Replace("Y", "年") ?? "默认"
|
|
};
|
|
}
|
|
}
|
|
} |