本文整理汇总了C#中Term.SeatIsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# Term.SeatIsEmpty方法的具体用法?C# Term.SeatIsEmpty怎么用?C# Term.SeatIsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term.SeatIsEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssignSeat
public void AssignSeat(Term shift, IWorkingAgent selectedAgent)
{
var affectedRows = new[] { SelectedSeat };
if (!shift.SeatIsEmpty())
{
var removeDelegates = new Action(() => { });
affectedRows = selectedAgent.Schedule.GetCoveredTermsWithAbsent(shift).Add(shift)
.Where(o => !o.SeatIsEmpty() && _seatBoxes.ContainsKey(o.Seat))
.Select(o =>
{
var seatBox = (SeatBox)_seatBoxes[o.Seat];
foreach (var c in seatBox.Occupations.Where(c => c.If<SeatArrangement>(a => a.Source.Equals(o))))
{
var occupation = c;
removeDelegates += () =>
{
seatBox.RemoveOccupation(occupation);
selectedAgent.Occupations.Remove(occupation);
};
}
return seatBox;
})
.ToArray();
removeDelegates();
//var originalSeat = (SeatBox)_seatBoxes[shift.Seat];
//var seatArrangement = originalSeat.Occupations.OfType<SeatArrangement>().FirstOrDefault(o => o.Source == shift && o.TimeEquals(shift));
//if (seatArrangement != null)
// originalSeat.RemoveOccupation(seatArrangement);
//affectedRows = new[] { SelectedSeat, originalSeat };
}
var prv = default(Term);
var seatId = SelectedSeat.Id.ToString();
shift.Seat = seatId;
var coveredTerms = selectedAgent.Schedule.GetCoveredTermsWithAbsent(shift);
coveredTerms.ForEach(o => o.Seat = null).Add(shift)
.SliceOccupied((dateRange, term) =>
{
if (!term.IsNeedSeat)
{
term.Seat = seatId;
prv = term;
return default(SeatArrangement);
}
if (prv != null && !ReferenceEquals(prv, term) && prv.Level == 0 && term.Level == 0)
{
prv = null;
}
var source = default(Term);
TermExt.X(prv, term, ref source);
var instance = new SeatArrangement(selectedAgent.Profile, dateRange.Start, dateRange.End, SelectedSeat.Seat) { Source = source };
source.Seat = seatId;
SelectedSeat.AddOccupation(instance);
selectedAgent.Occupations.Add(instance);
prv = term;
return instance;
}, t => t.IsNeedSeat);
//shift.SaftyInvoke<AssignmentBase>(o => { o.OccupyStatus = "C"; });
Reload(affectedRows);
OccupationsChanged(-1);
}