Beispiel #1
0
        /// <summary>
        /// Create an FSTimeSlot from a TimeSlot.
        /// </summary>
        protected void createTimeSlot(TimeSlot timeSlot)
        {
            var staffScheduleEntry = PXGraph.CreateInstance <TimeSlotMaint>();

            FSStaffSchedule fsStaffScheduleRow = PXSelect <FSStaffSchedule,
                                                           Where <
                                                               FSStaffSchedule.scheduleID, Equal <Required <FSStaffSchedule.scheduleID> > > >
                                                 .Select(this, timeSlot.ScheduleID);

            FSTimeSlot fsTimeSlotRow = new FSTimeSlot();
            DateTime   dateBegin, dateEnd;

            fsTimeSlotRow.BranchID         = fsStaffScheduleRow.BranchID;
            fsTimeSlotRow.BranchLocationID = fsStaffScheduleRow.BranchLocationID;
            fsTimeSlotRow.EmployeeID       = fsStaffScheduleRow.EmployeeID;

            dateBegin = new DateTime(timeSlot.DateTimeBegin.Year, timeSlot.DateTimeBegin.Month, timeSlot.DateTimeBegin.Day, fsStaffScheduleRow.StartTime.Value.Hour, fsStaffScheduleRow.StartTime.Value.Minute, fsStaffScheduleRow.StartTime.Value.Second);
            dateEnd   = new DateTime(timeSlot.DateTimeEnd.Year, timeSlot.DateTimeEnd.Month, timeSlot.DateTimeEnd.Day, fsStaffScheduleRow.EndTime.Value.Hour, fsStaffScheduleRow.EndTime.Value.Minute, fsStaffScheduleRow.EndTime.Value.Second);

            TimeSpan duration = dateEnd - dateBegin;

            fsTimeSlotRow.TimeStart    = dateBegin;
            fsTimeSlotRow.TimeEnd      = dateEnd;
            fsTimeSlotRow.RecordCount  = 1;
            fsTimeSlotRow.ScheduleType = fsStaffScheduleRow.ScheduleType;
            fsTimeSlotRow.TimeDiff     = (decimal)duration.TotalMinutes;
            fsTimeSlotRow.ScheduleID   = timeSlot.ScheduleID;
            fsTimeSlotRow.GenerationID = timeSlot.GenerationID;

            fsTimeSlotRow = staffScheduleEntry.TimeSlotRecords.Insert(fsTimeSlotRow);

            staffScheduleEntry.Save.Press();
        }
Beispiel #2
0
        /// <summary>
        /// Process all FSStaffSchedule. Generates one or more TimeSlot in the Scheduler Module.
        /// </summary>
        protected virtual void processStaffSchedule(PXCache cache, StaffContractScheduleProcess staffContractScheduleEnq, FSStaffSchedule fsScheduleRow, DateTime?fromDate, DateTime?toDate)
        {
            List <Schedule> mapScheduleResults = new List <Schedule>();

            mapScheduleResults = MapFSScheduleToSchedule.convertFSScheduleToSchedule(cache, fsScheduleRow, toDate, ID.RecordType_ServiceContract.EMPLOYEE_SCHEDULE_CONTRACT);
            generateTimeSlotAndUpdateStaffSchedule(mapScheduleResults, ID.RecordType_ServiceContract.EMPLOYEE_SCHEDULE_CONTRACT, fromDate, toDate, fsScheduleRow);
        }