40 lines
1.2 KiB
C#
40 lines
1.2 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()
|
|
{
|
|
using var db = new ErpBaseContext();
|
|
var dictionaryId = db.Dictionaries
|
|
.Where(item => item.Name == DictionaryName)
|
|
.Select(item => item.Id)
|
|
.FirstOrDefault();
|
|
var items = db.DictionaryItems
|
|
.Where(item => item.DictId == dictionaryId && !string.IsNullOrWhiteSpace(item.Name))
|
|
.OrderBy(item => item.IndexNum)
|
|
.Select(item => new SelectItem { Text = item.Name, Value = item.Name })
|
|
.ToArray();
|
|
|
|
return new SwapMarginTemplateConfig
|
|
{
|
|
options = items,
|
|
defaultValue = items.FirstOrDefault()?.Value
|
|
};
|
|
}
|
|
}
|
|
|
|
public class SwapMarginTemplateConfig
|
|
{
|
|
public IEnumerable<SelectItem> options { get; set; }
|
|
|
|
public string defaultValue { get; set; }
|
|
}
|
|
}
|