Exemple #1
0
        public void AddIo(IO io, ShiftSegmentDto shiftSegmentDto, AssignShift assignShift)
        {
            var assignedSegment = shiftSegmentDto.ShiftSegmentsList.Single(s => s.Index == assignShift.Index);
            var dateDiff        = (io.Date - assignShift.StartDate).Days;
            var mod             = (dateDiff + assignedSegment.Index) % shiftSegmentDto.ShiftSegmentsList.Count;

            if (mod == 0)
            {
                mod = shiftSegmentDto.ShiftSegmentsList.Count;
            }


            if ((Convert.ToDecimal(shiftSegmentDto.ShiftSegmentsList[mod].StartTime.Replace(":", "")) +
                 Convert.ToDecimal(shiftSegmentDto.ShiftSegmentsList[mod].EndTime.Replace(":", "")) == 0)
                ||
                (Convert.ToDecimal(shiftSegmentDto.ShiftSegmentsList[mod].StartTime.Replace(":", "")) >
                 Convert.ToDecimal(io.ArrivalTime.Replace(":", ""))
                 &&
                 Convert.ToDecimal(shiftSegmentDto.ShiftSegmentsList[mod].EndTime.Replace(":", "")) <
                 Convert.ToDecimal(io.ExiTime.Replace(":", ""))))
            {
                throw new EnteredTimeIsNotInSegmentInside();
            }

            Ios.Add(io);
        }
Exemple #2
0
 public void AddAssignShift(AssignShift assignShift)
 {
     AssignShifts.Add(assignShift);
 }