using DocumentFormat.OpenXml.Wordprocessing; using System; using System.Collections.Generic; using System.Linq; using System.Web; /// /// Region 的摘要描述 /// namespace Model { public partial class Region { public bool IsAvailable() { //判断当前区域是否可用,需要判断父区域是否可用,如果父区域不可用,则所有字区域都不可用 if (!this.IsActive) { return false; } Region region = this.Region2; while (region != null) { if (!region.IsActive) { return false; } region = region.Region2; } return true; //这里增加根据区域排程判定在指定时间段内区域是否可用 } public bool? IsMaleOrFemale() { if (this.Gender.HasValue) return this.Gender.Value; Region currentRegion = this.Region2; while (currentRegion != null) { if (currentRegion.Gender.HasValue) return currentRegion.Gender.Value; currentRegion = currentRegion.Region2; // 上级区域 } // 都没有定义性别 return null; } } }