using System.ComponentModel.DataAnnotations.Schema; namespace YLErp.DBModels { [Table("exchange_account")] public class ExchangeAccount : DBModelBase, IDataEntity, IDataTraceV2, IClonable { public static string LogClass = "exchange_account"; [NotMapped] public List TraderIntIds { get { if (string.IsNullOrEmpty(TraderIds)) { return new List(); } return TraderIds.Split(","[0]).Select(t => Convert.ToInt32(t)).ToList(); } } [DisplayName("账户名称")] public string AccountName { set; get; } /// /// 账户 /// [DisplayName("账户")] public string AccountCode { set; get; } /// /// 目前账户类型只有 Stock CommodityFutures /// 如果加了其他类型,需要对应的修改AccountTypeName展示逻辑 /// [DisplayName("账户类型 ")] public string AccountType { set; get; } /// /// 目前只有股票 商品期货 /// [DisplayName("账户类型")] public string AccountTypeName { get { return AccountType == "Stock" ? "股票" : (AccountType == "CommodityFutures" ? "商品期货" : "其他"); } } /// /// 交易员id /// [DisplayName("交易员名称")] public string TraderIds { set; get; } /// /// 交易员名称 /// [DisplayName("交易员名称")] public string TraderNames { set; get; } /// /// 状态 /// [DisplayName("状态")] public int? Status { set; get; } [DisplayName("状态")] [NotMapped] public string StatusCN { get { if (Status == 1) { return "正常"; } else { return "停用"; } } } /// /// 初始成本 /// [DisplayName("初始成本")] public double? InitialCost { get; set; } /// /// 总资金 /// [DisplayName("总资金")] public double Total { set; get; } /// /// 可用资金 /// [DisplayName("可用资金")] public double Available { set; get; } /// /// 动态权益 /// [DisplayName("动态权益")] public double CurrFund { set; get; } /// /// 当前预付金 /// [DisplayName("当前预付金")] public double CurrMargin { set; get; } /// /// 描述 /// [DisplayName("描述")] public string Description { set; get; } /// /// 默认簿记账户Id /// [DisplayName("默认簿记账户")] public int? DefaultBookId { set; get; } /// /// 品种 /// [DisplayName("品种")] public string VarietyIds { get; set; } [NotMapped] [DisplayName("品种")] public string VarietyNames { get; set; } public ExchangeAccount Clone() { return (ExchangeAccount)MemberwiseClone(); } public string GetDataTraceKeyId() { return id.ToString(); } public string GetDataTraceKeyInfo() { return "对冲账户:" + AccountName; } } [NotMapped] public class ExchangeAccountDto : ExchangeAccount { public string AssetBookName { get; set; } } }