Example #1
0
        } // end of EventStaffChange

        #endregion

        //--------------------------------------------------------------------------------------------------
        // State Change
        //--------------------------------------------------------------------------------------------------

        #region Trigger

        /// <summary>
        /// Overrides the state change method, staffing levels will change, for leaving
        /// staff requests for absence are filed, incoming staff is added to the
        /// parent control unit
        /// </summary>
        /// <param name="time">Time the staffing changes</param>
        /// <param name="simEngine">SimEngine responsible for simulation execution</param>
        protected override void StateChange(DateTime time, ISimulationEngine simEngine)
        {
            // foreach leaving staff a request to be absent is filed at their control unit
            // arriving staff is automatically added to the control by the triggering
            // of the event
            foreach (ResourceAssignmentStaff staffAssignment in StaffLeaving)
            {
                ParentDepartmentControl.AddRequest(new RequestBeAbsent(staffAssignment.Resource, time));
                staffAssignment.Resource.StaffOutsideShift = true;
            } // end foreach

            foreach (ResourceAssignmentStaff staffAssignment in StaffAriving)
            {
                staffAssignment.Resource.StaffOutsideShift     = false;
                staffAssignment.Resource.BlockedForDispatching = false;
                staffAssignment.Resource.BaseControlUnit       = ParentDepartmentControl;
                staffAssignment.Resource.AssignmentType        = staffAssignment.AssignmentType;

                if (staffAssignment.OrganizationalUnit == "RootDepartment")
                {
                    ParentDepartmentControl.AddEntity(staffAssignment.Resource);
                }
                else
                {
                    ParentDepartmentControl.OrganizationalUnitPerName[staffAssignment.OrganizationalUnit].AddEntity(staffAssignment.Resource);
                }

                SequentialEvents.Add(staffAssignment.Resource.StartWaitingActivity(ParentDepartmentControl.WaitingRoomForStaff(staffAssignment.Resource)));
            } // end foreach

            DateTime nextTime;

            // schedule the next staff change
            Event nextChange = StaffHandler.GetNextStaffChangingEvent(ParentDepartmentControl, time, out nextTime);

            simEngine.AddScheduledEvent(nextChange, nextTime);
        } // end of Trigger
Example #2
0
        } // end of SetOrganizationalChildControl

        #endregion

        #region AddRequest

        /// <summary>
        /// Overrides the add request method for control units as all requests are
        /// routed first to the parent department control and not directly to the
        /// organizational unit
        /// </summary>
        /// <param name="req"></param>
        public override void AddRequest(ActivityRequest req)
        {
            ParentDepartmentControl.AddRequest(req);
        } // end of AddRequest