Exemplo n.º 1
0
        //METHODS\\
        public SalesRepClass getFreeRep(ECallType callType)
        {
            if (callType == ECallType.stereo)
            {
                foreach (SalesRepClass item in stereoRep)
                {
                    if (item.isFree == true)
                    {
                        //If there is a free stereo rep, return them.
                        return(item);
                    }
                }
            }
            if (callType == ECallType.other)
            {
                foreach (SalesRepClass item in otherRep)
                {
                    if (item.isFree == true)
                    {
                        //If there is a free other rep, return them.
                        return(item);
                    }
                }
            }

            //If couldnt find free rep
            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Finds the appropriate queue and returns if it is empty
        /// </summary>
        public bool IsQueueEmpty(ECallType callType)
        {
            // Get the queue for the call type
            Queue queue = simulatorQueues.Find(q => q.CallType == callType);

            return(queue.IsEmpty);
        }
Exemplo n.º 3
0
 public CCallRecord(ECallType type, string number, DateTime time, TimeSpan duration)
 {
     this._Type     = type;
     this._Number   = number;
     this._Time     = time;
     this._Duration = duration;
 }
Exemplo n.º 4
0
        public Entity GetFirstInQueue(ECallType callType)
        {
            // Gets the queue for the call type
            Queue queue = simulatorQueues.Find(q => q.CallType == callType);

            return(queue.GetFirstInQueue());
        }
Exemplo n.º 5
0
        /// <summary>
        /// Returns the data in a queue based on the calltyped
        /// </summary>
        public List <string[]> GetEntityDataInQueue(ECallType callType)
        {
            // Get the queue for the call type
            Queue queue = simulatorQueues.Find(q => q.CallType == callType);

            return(queue.GetEntityDataInQueue());
        }
Exemplo n.º 6
0
        public Entity GetFirstInQueue(ECallType callType)
        {
            // Gets the queue for the call type
            Queue queue = simulatorQueues.Find(q => q.CallType == callType);

            return queue.GetFirstInQueue();
        }
Exemplo n.º 7
0
 //CONSTRUCTOR\\
 public EntityClass(int entityID, ECallType callType)
 {
     this.callType   = callType;
     this.entityID   = entityID;
     startQTime      = 0;
     startSystemTime = 0;
     endQTime        = 0;
     endSystemTime   = 0;
 }
Exemplo n.º 8
0
 public ECallData(string subject, string sender, string comment, ECallType type = ECallType.Auto)
 {
     Id      = null;
     Created = DateTime.Now;
     Subject = subject;
     Sender  = sender;
     Comment = comment;
     // id nélkül csak automata lehet a típus
     Type = Id is null ? ECallType.Auto : type;
 }
Exemplo n.º 9
0
 private CCallRecord findRecord(string number, ECallType type)
 {
     foreach (CCallRecord item in _callList)
     {
         if ((item.Number == number) && (item.Type == type))
         {
             return(item);
         }
     }
     return(null);
 }
Exemplo n.º 10
0
        /////////////////////////////////////////////////////////////////////////////////////
        public void addCall(ECallType type, string number, string name, DateTime time, TimeSpan duration)
        {
            int delta = (int)duration.TotalSeconds;

            CCallRecord record = new CCallRecord();
            // todo:::extract name from number
            record.Name = name;
            record.Number = number;
            record.Duration = duration;
            record.Type = type;
            record.Time = time;
            addRecord(record);
        }
Exemplo n.º 11
0
        ////////////////////////////////////////////////////////////////////////////////////////////
        public Stack <CCallRecord> getList(ECallType type)
        {
            Stack <CCallRecord> tempList = new Stack <CCallRecord>();

            foreach (CCallRecord item in _callList)
            {
                if ((item.Type == type) || (type == ECallType.EAll))
                {
                    tempList.Push(item);
                }
            }
            return(tempList);
        }
Exemplo n.º 12
0
        public static string GetCallType(ECallType type)
        {
            switch (type)
            {
            case ECallType.EDialed: return("Dialed Call");

            case ECallType.EMissed: return("EMissed Call");

            case ECallType.EReceived: return("Received Call");

            case ECallType.EUndefined: return("Undefined Call");

            default: return("");
            }
        }
Exemplo n.º 13
0
        /////////////////////////////////////////////////////////////////////////////////////
        public void addCall(ECallType type, string number, string name, DateTime time, TimeSpan duration)
        {
            int delta = (int)duration.TotalSeconds;

            CCallRecord record = new CCallRecord();

            // todo:::extract name from number
            record.Name     = name;
            record.Number   = number;
            record.Duration = duration;
            record.Type     = type;
            record.Time     = time;

            addRecord(record);
        }
Exemplo n.º 14
0
        public void deleteRecord(string number, ECallType type)
        {
            CCallRecord[] tmplist = _callList.ToArray();
              List<CCallRecord> list = new List<CCallRecord>(tmplist);
              list.Reverse();
              _callList.Clear();

              foreach (CCallRecord item in list)
              {
            if ((item.Number == number) && (item.Type == type))
            {
              continue;
            }
            _callList.Push(item);
              }
        }
Exemplo n.º 15
0
        public List <CCallRecord> getList(ECallType type)
        {
            try
            {
                if (CallRecords == null)
                {
                    LoadRecords();
                }
                switch (type)
                {
                case ECallType.EAll: return(getList());

                default: return(CallRecords.FindAll(r => r.Type == type));
                }
            }
            catch { return(new List <CCallRecord>()); }
        }
Exemplo n.º 16
0
        public List <CCallRecord> SearchList(ECallType type, Predicate <CCallRecord> match)
        {
            try
            {
                if (CallRecords == null)
                {
                    LoadRecords();
                }
                switch (type)
                {
                case ECallType.EAll: return(CallRecords.FindAll(match));

                default: return(CallRecords.FindAll(r => (r.Type == type) && match(r)));
                }
            }
            catch { return(new List <CCallRecord>()); }
        }
Exemplo n.º 17
0
        public CCallRecord SearchOneRecord(ECallType type, Predicate <CCallRecord> match)
        {
            try
            {
                if (CallRecords == null)
                {
                    LoadRecords();
                }
                switch (type)
                {
                case ECallType.EAll: return(CallRecords.Find(match));

                default: return(CallRecords.Find(r => (r.Type == type) && match(r)));
                }
            }
            catch { return(null); }
        }
Exemplo n.º 18
0
        public void deleteRecord(string number, ECallType type)
        {
            CCallRecord[]      tmplist = _callList.ToArray();
            List <CCallRecord> list    = new List <CCallRecord>(tmplist);

            list.Reverse();
            _callList.Clear();

            foreach (CCallRecord item in list)
            {
                if ((item.Number == number) && (item.Type == type))
                {
                    continue;
                }
                _callList.Push(item);
            }
        }
Exemplo n.º 19
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);
        }
Exemplo n.º 20
0
        public void addCall(ECallType type, string number, string name, DateTime time, TimeSpan duration)
        {
            try
            {
                CCallRecord record = new CCallRecord(type, number, time, duration);
                record.Id             = ++MaxRecordId;
                record.OnDataChanged += new DataChanged(record_OnDataChanged);
                if (CallRecords != null)
                {
                    CallRecords.Insert(0, record);
                }
                SaveRecord(record);
                RiseEvent(OnRecordAdded, record);

                List <CCallRecord> records = getList(type);
                if (records.Count > MaxRecordsCount)
                {
                    deleteRecord(records[records.Count - 1].Id);
                }
            }
            catch { }
        }
Exemplo n.º 21
0
 ////////////////////////////////////////////////////////////////////////////////////////////
 public Stack<CCallRecord> getList(ECallType type)
 {
     Stack<CCallRecord> tempList = new Stack<CCallRecord>();
       foreach (CCallRecord item in _callList)
       {
     if ((item.Type == type)||(type == ECallType.EAll))
     {
       tempList.Push(item);
     }
       }
       return tempList;
 }
Exemplo n.º 22
0
 private CCallRecord findRecord(string number, ECallType type)
 {
     foreach (CCallRecord item in _callList)
       {
     if ((item.Number == number)&&(item.Type == type))
     {
       return item;
     }
       }
       return null;
 }
Exemplo n.º 23
0
 /// <summary>
 /// Returns true if the call type queue has no entities waiting
 /// </summary>
 public bool IsQueueEmpty(ECallType calltype)
 {
     return(queueManager.IsQueueEmpty(calltype));
 }
Exemplo n.º 24
0
 public Stack<CCallRecord> getList(ECallType type) { return null;}
Exemplo n.º 25
0
        /// <summary>
        /// Computes all call compleation stats
        /// </summary>
        private void completions(ECallType? callType)
        {
            // Update statistics of every enitiy leaving system
            Global.CallCompletion++;

            // Update individual completions
            switch (callType)
            {
                case ECallType.OTHER:
                    Global.CallCompletionType1++;
                    break;
                case ECallType.CAR_STEREO:
                    Global.CallCompletionType2++;
                    break;
            }
        }
Exemplo n.º 26
0
 /// <summary>
 /// Finds the appropriate queue and returns if it is empty
 /// </summary>
 public bool IsQueueEmpty(ECallType callType)
 {
     // Get the queue for the call type
     Queue queue = simulatorQueues.Find(q => q.CallType == callType);
     return queue.IsEmpty;
 }
Exemplo n.º 27
0
 public Resource(ECallType callType)
 {
     this.CallType = callType;
     this.IsFree = true;
 }
Exemplo n.º 28
0
 public void addCall(ECallType type, string number, string name, System.DateTime time, System.TimeSpan duration) { }
Exemplo n.º 29
0
 public Stack<CCallRecord> getList(ECallType type) { return null; }
Exemplo n.º 30
0
 /// <summary>
 /// Pops the first in the queue
 /// </summary>
 public Entity GetFirstInQueue(ECallType calltype)
 {
     return(queueManager.GetFirstInQueue(calltype));
 }
Exemplo n.º 31
0
 /// <summary>
 /// Return the event time depending on callType
 /// </summary>
 public int NextEventTime(ECallType? callType)
 {
     switch (callType)
     {
         case ECallType.CAR_STEREO:
             return DelayCarStereo;
         case ECallType.OTHER:
             return DelayOther;
         default:
             return DelayAtSwitch;
     }
 }
Exemplo n.º 32
0
 public Queue(ECallType callType)
 {
     this.callType    = callType;
     this.entityQueue = new List <Entity>();
 }
Exemplo n.º 33
0
Arquivo: Queue.cs Projeto: rNdm74/C-
 public Queue(ECallType callType)
 {
     this.callType = callType;
     this.entityQueue = new List<Entity>();
 }
Exemplo n.º 34
0
        /// <summary>
        /// Computes the average number of entities that waited
        /// </summary>
        private void averageNumberWaiting(ECallType? callType)
        {
            // Running average of entities waiting
            Global.WaitCount++;
            Global.AverageNumberWaiting += computeAverage(Global.WaitCount, Global.AverageNumberWaiting, count);

            switch (callType)
            {
                case ECallType.CAR_STEREO:
                    Global.WaitCountType2++;
                    Global.AverageNumberWaitingType2 += computeAverage(Global.WaitCountType2, Global.AverageNumberWaitingType2, count);
                    break;
                case ECallType.OTHER:
                    Global.WaitCountType1++;
                    Global.AverageNumberWaitingType1 += computeAverage(Global.WaitCountType1, Global.AverageNumberWaitingType1, count);
                    break;
            }
        }
Exemplo n.º 35
0
 /// <summary>
 /// Gets a formatted list of data from the queue
 /// </summary>
 public List <string[]> GetQueueEntityData(ECallType callType)
 {
     return(queueManager.GetEntityDataInQueue(callType));
 }
Exemplo n.º 36
0
 /// <summary>
 /// Pops the first in the queue 
 /// </summary>
 public Entity GetFirstInQueue(ECallType calltype)
 {
     return queueManager.GetFirstInQueue(calltype);
 }
Exemplo n.º 37
0
 public Resource(ECallType callType)
 {
     this.CallType = callType;
     this.IsFree   = true;
 }
Exemplo n.º 38
0
 /// <summary>
 /// Gets a formatted list of data from the queue
 /// </summary>
 public List<string[]> GetQueueEntityData(ECallType callType)
 {
     return queueManager.GetEntityDataInQueue(callType);
 }
Exemplo n.º 39
0
 /// <summary>
 /// Returns the data in a queue based on the calltyped
 /// </summary>
 public List<string[]> GetEntityDataInQueue(ECallType callType)
 {
     // Get the queue for the call type
     Queue queue = simulatorQueues.Find(q => q.CallType == callType);
     return queue.GetEntityDataInQueue();
 }
Exemplo n.º 40
0
 /// <summary>
 /// Returns true if the call type queue has no entities waiting
 /// </summary>
 public bool IsQueueEmpty(ECallType calltype)
 {
     return queueManager.IsQueueEmpty(calltype);
 }
Exemplo n.º 41
0
 public void addCall(ECallType type, string number, string name, System.DateTime time, System.TimeSpan duration) { }
Exemplo n.º 42
0
 /// <summary>
 /// Returns the next available resource
 /// </summary>
 public Resource NextAvailableResource(ECallType? calltype)
 {
     // Specific calltype and resource must be free else will return null
     return resources.Find(r => (r.CallType == calltype && r.IsFree == true));
 }
Exemplo n.º 43
0
 //CONSTRUCTOR\\
 public SalesRepClass(ECallType repType)
 {
     this.isFree  = false;
     this.repType = repType;
 }
Exemplo n.º 44
0
        /// <summary>
        /// If the entity is waiting over 1 min, can be set by user
        /// </summary>
        private void excessiveWaiting(ECallType? callType, int waitTime)
        {
            // Work out if call had an excessive wait time
            if (waitTime > Global.ExcessiveWaitTime)
            {
                Global.ExcessiveWaitCount++;

                switch (callType)
                {
                    case ECallType.CAR_STEREO:
                        Global.ExcessiveWaitCountType2++;
                        break;
                    case ECallType.OTHER:
                        Global.ExcessiveWaitCountType1++;
                        break;
                }
            }
        }