Beispiel #1
0
        //GET THE NEXT WAITING ENTITY IN THE QUEUE
        public EntityClass getEntityWaiting(ECallType callType)
        {
            EntityClass nextEntity = null;

            if (callType == ECallType.stereo) //If the call is stereo
            {
                //If there is someone waiting
                if (stereoWaiting.Count > 0)
                {
                    nextEntity = stereoWaiting.Dequeue();
                }
            }
            else
            {
                if (otherWaiting.Count > 0)
                {
                    nextEntity = otherWaiting.Dequeue();
                }
            }

            return(nextEntity);
        }
Beispiel #2
0
        //****************************************************************
        // COMPLETE THE SERVICECALL EVENT
        //****************************************************************
        public void CompleteServiceCall()
        {
            //What happens when they comeplete the service call?

            /*
             * Calls complete
             * Free up that sales rep
             * grab from queue
             */

            //EntityClass newEntity = null;

            if (mainQueue.stereoWaiting.Count == 0) //If there isnt anyone waiting do what?
            {
                Console.WriteLine("Number of People on hold: " + mainQueue.stereoWaiting.Count);
            }
            else
            {
                if (activeEntity.callType == ECallType.stereo)    //Someone was in the queue
                {
                    activeEntity.personImTalkingTo.isFree = true; //Frees up the resource
                                                                  //Pretty sure he just dissapares from the system now. He no longer holds up any resources

                    int interval      = Convert.ToInt16(diceRoller.DiceRoll() * 2);
                    int scheduledTime = currentTime + interval;
                    //New completeService Event
                    EntityClass newEntity = mainQueue.getEntityWaiting(ECallType.stereo);
                    EventClass  newEvent  = new EventClass(newEntity, EEventType.CompleteServiceCall, scheduledTime);

                    SalesRepClass freeRep = salesTeam.getFreeRep(ECallType.stereo);
                    newEntity.personImTalkingTo = freeRep;//Assign it to the active entity
                    freeRep.isFree = false;

                    //Add new Event to the calendar
                    mainCalendar.addEvent(newEvent);
                }
            }

            if (mainQueue.otherWaiting.Count == 0)
            {
                Console.WriteLine("Number of people on Hold: " + mainQueue.otherWaiting.Count);
            }
            else
            {
                if (activeEntity.callType == ECallType.stereo)    //Someone was in the queue
                {
                    activeEntity.personImTalkingTo.isFree = true; //Frees up the resource
                                                                  //Pretty sure he just dissapares from the system now. He no longer holds up any resources

                    int interval      = Convert.ToInt16(diceRoller.DiceRoll() * 2);
                    int scheduledTime = currentTime + interval;
                    //New completeService Event
                    EntityClass newEntity = mainQueue.getEntityWaiting(ECallType.other);
                    EventClass  newEvent  = new EventClass(newEntity, EEventType.CompleteServiceCall, scheduledTime);

                    SalesRepClass freeRep = salesTeam.getFreeRep(ECallType.stereo);
                    newEntity.personImTalkingTo = freeRep;//Assign it to the active entity
                    freeRep.isFree = false;

                    //Add new Event to the calendar
                    mainCalendar.addEvent(newEvent);
                }

                int interval2      = Convert.ToInt16(diceRoller.DiceRoll() * 2);
                int scheduledTime2 = currentTime + interval2;
                //New completeService Event
                EventClass newEvent2 = new EventClass(activeEntity, EEventType.EndSim, scheduledTime2);
                mainCalendar.addEvent(newEvent2);
            }

            /*if (activeEntity.callType == ECallType.stereo) //Someone was in the queue
             * {
             *  activeEntity.personImTalkingTo.isFree = true; //Frees up the resource
             *                                                //Pretty sure he just dissapares from the system now. He no longer holds up any resources
             *
             *  int interval = Convert.ToInt16(diceRoller.DiceRoll() * 2);
             *  int scheduledTime = currentTime + interval;
             *  //New completeService Event
             *  EntityClass newEntity = mainQueue.getEntityWaiting(ECallType.stereo);
             *  EventClass newEvent = new EventClass(newEntity, EEventType.CompleteServiceCall, scheduledTime);
             *
             *  SalesRepClass freeRep = salesTeam.getFreeRep(ECallType.stereo);
             *  newEntity.personImTalkingTo = freeRep;//Assign it to the active entity
             *  freeRep.isFree = false;
             *
             *  //Add new Event to the calendar
             *  mainCalendar.addEvent(newEvent);
             * }
             * else
             * {
             *  activeEntity.personImTalkingTo.isFree = true; //Frees up the resource
             *
             *  int interval = Convert.ToInt16(diceRoller.DiceRoll() * 1);
             *  int scheduledTime = currentTime + interval;
             *  //New completeService Event
             *  EntityClass newEntity = mainQueue.getEntityWaiting(ECallType.other);
             *  EventClass newEvent = new EventClass(newEntity, EEventType.CompleteServiceCall, scheduledTime);
             *
             *  SalesRepClass freeRep = salesTeam.getFreeRep(ECallType.other);
             *  newEntity.personImTalkingTo = freeRep; //Assign it to the active entity
             *  freeRep.isFree = false; //take that resource
             *
             *  //Add new Event to the calendar
             *  mainCalendar.addEvent(newEvent);
             * }
             * //Thats it until the time reaches the EndSim eventTime.*/
        }
Beispiel #3
0
 //CONSTRUCTOR\\
 public EventClass(EntityClass currentEntity, EEventType newEvent, int schedualedTime)
 {
     this.currentEntity    = currentEntity;
     this.currentEventType = newEvent;
     this.schedualedTime   = schedualedTime;
 }