Ejemplo n.º 1
0
        private IEnumerable <IAgent> ReAssignAgents(IList agents)
        {
            IsDirty = false;
            return(agents.ReAssignAgents(_bindableAgents, _attendances, (dirtyAgent =>
            {
                _shiftDispatcherModel.Reload(ref dirtyAgent);

                _laborHoursCountingModel.SummarizeLaborRule(dirtyAgent);
                return dirtyAgent;
            })));

            // var reassignedAgents = new IAgent[agents.Count];

            //agents.ForEach<IAgent>((t, i) =>
            //                           {
            //                               var index = _bindableAgents.IndexOf(t);
            //                               if (index != -1)
            //                               {
            //                                   var agent = (IAgent)_bindableAgents[index];
            //                                   _shiftDispatcherModel.Reload(ref agent);
            //                                   _laborHoursCountingModel.SummarizeLaborRule(agent);

            //                                   _bindableAgents[index] = agent;
            //                                   index = _attendances.IndexOf(agent as Agent);
            //                                   if (index != -1)
            //                                   {
            //                                       _attendances[index] = agent as Agent;
            //                                       reassignedAgents[i] = _attendances[index];
            //                                   }
            //                               }
            //                           });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 计算工时
        /// </summary>
        protected internal void GetLaborRule()
        {
            var terms = GetTerm();

            var exceptions = _laborHoursCountingModel.SummarizeLaborRule(Agent, terms);

            SetLaborRule(exceptions);
            MonthTotals = LaborRuleHours(terms.OfType <AssignmentBase>());

            var start    = SwapingDate.Start.Date;
            var end      = SwapingDate.End.Date;
            var dayrange = (start != end && SwapingDate.Start != start && SwapingDate.End != end) ? new DateRange(start, start.AddDays(2)) : new DateRange(start, start.AddDays(1));

            var         currentdayterms = terms.CollideTerms(dayrange);
            List <Term> inside, outside;

            Term.SliceTerm(currentdayterms, dayrange.Start, dayrange.End, out outside, out inside);

            DayTotals = LaborRuleHours(inside.OfType <AssignmentBase>());

            MonthSwapHour = MonthTotals - MonthHourTotals;
        }