本文整理汇总了C#中Term.Is方法的典型用法代码示例。如果您正苦于以下问题:C# Term.Is方法的具体用法?C# Term.Is怎么用?C# Term.Is使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term.Is方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Delete
private bool Delete(Term target, bool trying, Action<IEnumerable<Term>> callback)
{
if (target.Is<IImmutableTerm>() || (target.Locked && target.IsNot<AbsentEvent>())) return false;
Term[] coverdTerms;
if (target.IsNew()) // unsaved term deleting
coverdTerms = GetCoveredTermsWithAbsent(target).Where(o => o.Id == 0).ToArray();
else
coverdTerms = GetCoveredTermsWithAbsent(target).ToArray();
if (coverdTerms.Any(t => !(t is AbsentEvent) && t.Locked)) return false; // 有任何请假不准删除
if (coverdTerms.Length != GetDeletableCoveredTerms(target).Count()) return false;
if (trying) return true;
bool result;
List<Term> deletedTerms;
if (coverdTerms.Length == 0)
{
result = _termSet.Remove(target);
deletedTerms = new List<Term>(new[] { target });
}
else
{
result = _termSet.RemoveAll(coverdTerms) && _termSet.Remove(target);
deletedTerms = new List<Term>(coverdTerms) { target };
}
if (result)
{
if (target.IsNot<IAssignment>())
Reporting(target);
EmptySeatArrangment<AbsentEvent>(target);
if (callback != null)
callback(deletedTerms);
}
return result;
}
示例2: TermWhere
private static bool TermWhere(Term o, TimeBox timeBox, Dictionary<int, IList<Term>> groupByLevelTerms, int termCapacity, bool lockedTermIncluded)
{
if (o.Is<IImmutableTerm>()) return false;
bool? locked = null;
var inside = !o.IsOutOfBoundary(t =>
{
if (lockedTermIncluded) return;
locked = t.SaftyGetProperty<bool, Term>(x => x.Locked);
}, timeBox);
var result = inside && (locked == null || locked.Value == false);
if (result)
{
if (!groupByLevelTerms.ContainsKey(o.Level))
groupByLevelTerms[o.Level] = new List<Term>(termCapacity);
groupByLevelTerms[o.Level].Add(o);
}
return result;
}