Exemple #1
0
        public static BarcoShift AddShift(BarcoJob job, BarcoMember member)
        {
            if (job.Shifts.Count < job.JobCapacity)
            {
                var shift = new BarcoShift
                {
                    BarcoMember = member,
                    ShiftStatus = ShiftStatus.Planned,
                    BarcoJob    = job
                };
                job.Shifts.Add(shift);

                return(shift);
            }
            else
            {
                return(null);
            }
        }
        private void PushShift(BarcoShift shift, BarcoJob job)
        {
            var dueInterval = TimeSpan.FromHours(10);

            if (shift.ShiftStatus == ShiftStatus.Planned && DateTime.Now > job.StartDateTime - dueInterval)
            {
                //notify
                NotifyDueShifts(shift);
                shift.ShiftStatus = ShiftStatus.Notified;
            }
            else if (shift.ShiftStatus == ShiftStatus.Started && job.EndDateTime < DateTime.Now)
            {
                //close it
                shift.ShiftStatus = ShiftStatus.Worked;
            }
            else if (shift.ShiftStatus == ShiftStatus.Planned && job.EndDateTime < DateTime.Now)
            {
                //fail it
                shift.ShiftStatus = ShiftStatus.UnWorked;
            }
        }
 private void NotifyDueShifts(BarcoShift shift)
 {
     Notify(shift.BarcoMember, "Barco Shift Notification", "dd");
 }
Exemple #4
0
 public BarcoShiftViewModel(BarcoShift shift, BarcoJob job) : this(shift)
 {
     Date      = job.StartDateTime.Day;
     MonthCode = job.StartDateTime.ToString("MMM");
 }
Exemple #5
0
 public BarcoShiftViewModel(BarcoShift shift)
 {
     ShiftStatus = shift.ShiftStatus;
     BarcoMember = new BarcoMemberViewModel(shift.BarcoMember);
 }