update from old git
This commit is contained in:
49
web/App_Code/Model/Partial/Region.cs
Normal file
49
web/App_Code/Model/Partial/Region.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
/// <summary>
|
||||
/// Region 的摘要描述
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user