using System.ComponentModel.DataAnnotations.Schema; using YLErp.Enums; namespace YLErp.DBModels { [Table("quotasetting")] public class QuotaSetting : DBModelWithOperator, IClonable { /// /// 限额维度 /// public QuotaTypeEnum QuotaType { get; set; } /// /// 包含事前检查 /// 确认成交时检查 /// public bool Precheck { get; set; } /// /// 挂钩标的、客户id或个股流动性天数 /// 0=全部 /// public int QuotaRange { get; set; } /// /// 挂钩标的、客户或个股流动性天数用来显示的信息 /// [NotMapped] public string QuotaRangeStr { get; set; } /// /// 限额指标 /// public string QuotaIndex { get; set; } /// /// 限额上限 /// public double? QuotaUpperLimit { get; set; } /// /// 限额下限 /// public double? QuotaLowerLimit { get; set; } /// /// 预警上限 /// public double? WarningUpperLimit { get; set; } /// /// 预警下限 /// public double? WarningLowerLimit { get; set; } /// /// 是否有效 /// public bool IsValid { get; set; } /// /// 审批状态 /// public QuotaSettingApprovalStatus Status { get; set; } /// /// 百分比还是绝对值 /// public bool Percent { get; set; } public QuotaSetting Clone() { return (QuotaSetting)MemberwiseClone(); } public void ConvertToAbs(double baseNumber) { if (Percent) { QuotaUpperLimit = QuotaUpperLimit * baseNumber; QuotaLowerLimit = QuotaLowerLimit * baseNumber; WarningUpperLimit = WarningUpperLimit * baseNumber; WarningLowerLimit = WarningLowerLimit * baseNumber; Percent = false; } } } }