using System.ComponentModel.DataAnnotations.Schema; namespace YLErp.DBModels { /// /// 日历 /// [Table("calendar")] public class calendar : DBModelBase { /// /// 货币 /// [DisplayName("日历名称")] public string Country { get; set; } /// /// 年份 /// [DisplayName("年份")] public int? Year { get; set; } /// /// 非交易日数据 /// [DisplayName("非交易日数据")] public string HolidayJson { get; set; } /// /// 操作人_optid /// [DisplayName("操作人")] public int? OptId { get; set; } /// /// 操作人_optname /// [DisplayName("操作人")] public string OptName { get; set; } /// /// 更新时间_updatedate /// [DisplayName("更新时间")] public DateTime? UpdateDate { get; set; } /// /// 创建时间_createdate /// [DisplayName("创建时间")] public DateTime? CreateDate { get; set; } /// /// 是否有效_validstate /// [DisplayName("是否有效")] public string ValidState { get; set; } /// /// 加密主键 /// [NotMapped] public int WorkingDays { get; set; } public int GetWorkingDays() { var set = (HolidayJson ?? string.Empty).Trim().Trim(new char[] { '[', ']' }).Split(new string[] { "\",", "\"" }, StringSplitOptions.RemoveEmptyEntries).ToHashSet(); return (DateTime.IsLeapYear(DateTime.Now.Year) ? 366 : 365) - set.Count; } } }