38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using BaseOUDAL;
|
|
using YLErp.Models;
|
|
|
|
namespace YLErp.Modules.SwapModule
|
|
{
|
|
public static class SwapMarginTemplateConfigService
|
|
{
|
|
public const string DictionaryName = "保证金模板名称";
|
|
|
|
public static readonly string[] InitialTemplateNames = { "现金保证金", "授信保证金" };
|
|
|
|
public static SwapMarginTemplateConfig GetConfig()
|
|
{
|
|
//保证金模板V2迁移:交易页"保证金模板"下拉的选项改为"预付金模板V2"页面维护的模板(自定义+全局默认,存模板名称),不再使用数据字典
|
|
using var db = new YLErp.BLL.YLContext();
|
|
var items = db.margin_template_v2
|
|
.Where(item => !item.IsForClient && item.IsValid)
|
|
.OrderBy(item => item.IsDefault).ThenBy(item => item.id)
|
|
.Select(item => new SelectItem { Text = item.Name, Value = item.Name })
|
|
.ToArray();
|
|
|
|
return new SwapMarginTemplateConfig
|
|
{
|
|
options = items,
|
|
//不再默认选中任何模板,由用户在交易上显式选择;未选择则不绑定模板
|
|
defaultValue = null
|
|
};
|
|
}
|
|
}
|
|
|
|
public class SwapMarginTemplateConfig
|
|
{
|
|
public IEnumerable<SelectItem> options { get; set; }
|
|
|
|
public string defaultValue { get; set; }
|
|
}
|
|
}
|