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