Example #1
0
 public SeatArrangement(Term source,ISimpleEmployee agent, DateTime start, DateTime end)
 {
     Agent = agent;
     Start = start;
     End = end;
     Source = source;
 }
Example #2
0
 public SeatArrangement( ISimpleEmployee agent, DateTime start, DateTime end, ISeat seat)
 {
     Agent = agent;
     Start = start;
     End = end;
     this.Seat = seat;
 }
Example #3
0
 public SeatArrangement(Term source, ISimpleEmployee agent, DateTime start, DateTime end)
 {
     Agent  = agent;
     Start  = start;
     End    = end;
     Source = source;
 }
Example #4
0
 public SeatArrangement(ISimpleEmployee agent, DateTime start, DateTime end, ISeat seat)
 {
     Agent     = agent;
     Start     = start;
     End       = end;
     this.Seat = seat;
 }
Example #5
0
        public static IList<SeatArrangement> GenSeatArrangements(this IEnumerable<Term> terms, ISimpleEmployee agent, Func<string, Seat> getSeat, Func<string, SeatArrangement, bool> add)
        {
            var prv = default(Term);
            return terms.GetSeatArrangement((dateRange, term, isNeedSeat) =>
            {
                if (term == null || !term.IsNeedSeat)
                {
                    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 = default(SeatArrangement);

                var seatObj = source.If(o => o.SeatIsEmpty()) == true ? default(Seat) : getSeat(source.Seat);
                if (seatObj != null)
                {
                    instance = new SeatArrangement(agent, dateRange.Start, dateRange.End, seatObj) { Source = source };
                    add(source.Seat, instance);
                }

                prv = term; 
                return instance;
            });
        }
Example #6
0
        public static Attendance CopyRule(this Attendance attendance, ISimpleEmployee employee)
        {
            if (employee == null)
            {
                return(attendance);
            }

            var rule = employee.LaborRule;

            if (rule != null)
            {
                attendance.MaxOvertimeThreshold = rule.MaxOvertime;
                attendance.MaxShrinkedThreshold = rule.MaxShrinked;
                attendance.MCDO              = rule.MCDO;
                attendance.MCWD              = rule.MCWD;
                attendance.MinIdleGap        = rule.MinIdleGap;
                attendance.StdDailyLaborHour = rule.StdDailyLaborHour;
                attendance.MaxLaborHour      = rule.MaxLaborHour;
                attendance.MinLaborHour      = rule.MinLaborHour;
                attendance.MaxSwapTimes      = rule.MaxSwapTimes;


                //addtional properties for schduling
                attendance.DayOffRule = new DayOffRule()
                {
                    SystemAccumulate           = rule.DayOffRule.SystemAccumulate,
                    Add1DayOffEachSaturdayInCS = rule.DayOffRule.Add1DayOffEachSaturdayInCS,
                    Add1DayOffEachHolidayInCS  = rule.DayOffRule.Add1DayOffEachHolidayInCS,
                    Add1DayOffEachSundayInCS   = rule.DayOffRule.Add1DayOffEachSundayInCS,
                    HolidayShiftRule           = rule.DayOffRule.HolidayShiftRule,
                    SpecifiedNumberOfDays      = rule.DayOffRule.SpecifiedNumberOfDays,
                    MaxFWTimes = rule.DayOffRule.MaxFWTimes,
                    MaxPWTimes = rule.DayOffRule.MaxPWTimes,
                    MinFWTimes = rule.DayOffRule.MinFWTimes,
                    MinPWTimes = rule.DayOffRule.MinPWTimes
                };

                attendance.SchedulingPayload.DayOffMask = new MaskOfDay()
                {
                    Monthdays = rule.DayOffMask.Monthdays,
                    Weekdays  = rule.DayOffMask.Weekdays
                };

                /*attendance.SchedulingPayload.GroupingArrangeShift = new GroupingArrangeShift()
                 * {
                 *  IsGrouping = rule.GroupingArrangeShift.IsGrouping,
                 *  IsMappingEvent = rule.GroupingArrangeShift.IsMappingEvent
                 * };*/

                attendance.AmountDayOff = attendance.InitialDayOffCount();
            }
            return(attendance);
        }
Example #7
0
        public static Attendance CopyRule(this Attendance attendance, ISimpleEmployee employee)
        {
            if (employee == null)
                return attendance;

            var rule = employee.LaborRule;
            if (rule != null)
            {
                attendance.MaxOvertimeThreshold = rule.MaxOvertime;
                attendance.MaxShrinkedThreshold = rule.MaxShrinked;
                attendance.MCDO = rule.MCDO;
                attendance.MCWD = rule.MCWD;
                attendance.MinIdleGap = rule.MinIdleGap;
                attendance.StdDailyLaborHour = rule.StdDailyLaborHour;
                attendance.MaxLaborHour = rule.MaxLaborHour;
                attendance.MinLaborHour = rule.MinLaborHour;
                attendance.MaxSwapTimes = rule.MaxSwapTimes;


                //addtional properties for schduling
                attendance.DayOffRule = new DayOffRule()
                {
                    SystemAccumulate = rule.DayOffRule.SystemAccumulate,
                    Add1DayOffEachSaturdayInCS = rule.DayOffRule.Add1DayOffEachSaturdayInCS,
                    Add1DayOffEachHolidayInCS = rule.DayOffRule.Add1DayOffEachHolidayInCS,
                    Add1DayOffEachSundayInCS = rule.DayOffRule.Add1DayOffEachSundayInCS,
                    HolidayShiftRule = rule.DayOffRule.HolidayShiftRule,
                    SpecifiedNumberOfDays = rule.DayOffRule.SpecifiedNumberOfDays,
                    MaxFWTimes = rule.DayOffRule.MaxFWTimes,
                    MaxPWTimes = rule.DayOffRule.MaxPWTimes,
                    MinFWTimes = rule.DayOffRule.MinFWTimes,
                    MinPWTimes = rule.DayOffRule.MinPWTimes
                };

                attendance.SchedulingPayload.DayOffMask = new MaskOfDay()
                {
                    Monthdays = rule.DayOffMask.Monthdays,
                    Weekdays = rule.DayOffMask.Weekdays
                };
                /*attendance.SchedulingPayload.GroupingArrangeShift = new GroupingArrangeShift()
                {
                    IsGrouping = rule.GroupingArrangeShift.IsGrouping,
                    IsMappingEvent = rule.GroupingArrangeShift.IsMappingEvent
                };*/

                attendance.AmountDayOff = attendance.InitialDayOffCount();
            }
            return attendance;
        }
Example #8
0
 public SeatArrangement(ISimpleEmployee agent, DateTime start, DateTime end, Term shift, ISeat seat)
     : this(shift, agent, start, end)
 {
     this.Seat = seat;
 }
Example #9
0
 public SeatArrangement(ISimpleEmployee agent, DateTime start, DateTime end, Term shift, ISeat seat)
     : this(shift, agent, start, end)
 {
     this.Seat = seat;
 }
Example #10
0
 public TimeBox(DateRange period, Employee employee)
     : this()
 {
     _agent   = employee;
     Boundary = period;
 }
Example #11
0
 private IEnumerable <List <SeatArrangement> > GetOccupationByEmployee(ISimpleEmployee employee)
 {
     return(_employeeSeatOccupationRegister.Keys.Contains(employee) ?
            _employeeSeatOccupationRegister[employee].Where(so => so.Any(o => o.Seat == null)) :
            new List <List <SeatArrangement> >().AsEnumerable());
 }
Example #12
0
        public static IList <SeatArrangement> GenSeatArrangements(this IEnumerable <Term> terms, ISimpleEmployee agent, Func <string, Seat> getSeat, Func <string, SeatArrangement, bool> add)
        {
            var prv = default(Term);

            return(terms.GetSeatArrangement((dateRange, term, isNeedSeat) =>
            {
                if (term == null || !term.IsNeedSeat)
                {
                    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 = default(SeatArrangement);

                var seatObj = source.If(o => o.SeatIsEmpty()) == true ? default(Seat) : getSeat(source.Seat);
                if (seatObj != null)
                {
                    instance = new SeatArrangement(agent, dateRange.Start, dateRange.End, seatObj)
                    {
                        Source = source
                    };
                    add(source.Seat, instance);
                }

                prv = term;
                return instance;
            }));
        }
Example #13
0
 private IEnumerable<List<SeatArrangement>> GetOccupationByEmployee(ISimpleEmployee employee)
 {
     return _employeeSeatOccupationRegister.Keys.Contains(employee) ?
         _employeeSeatOccupationRegister[employee].Where(so => so.Any(o => o.Seat == null)) :
         new List<List<SeatArrangement>>().AsEnumerable();
 }
Example #14
0
 public virtual bool Equals(ISimpleEmployee other)
 {
     return(Profile.Equals(other));
 }
Example #15
0
 public AgentAdherence(ISimpleEmployee profile)
 {
     Profile = profile;
 }