当前位置: 首页>>代码示例>>C#>>正文


C# Term.SeatIsEmpty方法代码示例

本文整理汇总了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);
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:64,代码来源:SeatDispatcherPresenter.Action.cs


注:本文中的Term.SeatIsEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。