Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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;
 }
Ejemplo 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());
        }
Ejemplo 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());
        }
Ejemplo 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();
        }
Ejemplo n.º 7
0
 //CONSTRUCTOR\\
 public EntityClass(int entityID, ECallType callType)
 {
     this.callType   = callType;
     this.entityID   = entityID;
     startQTime      = 0;
     startSystemTime = 0;
     endQTime        = 0;
     endSystemTime   = 0;
 }
Ejemplo 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;
 }
Ejemplo 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);
 }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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("");
            }
        }
Ejemplo 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);
        }
Ejemplo 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);
              }
        }
Ejemplo 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>()); }
        }
Ejemplo 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>()); }
        }
Ejemplo 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); }
        }
Ejemplo 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);
            }
        }
Ejemplo 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);
        }
Ejemplo 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 { }
        }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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));
 }
Ejemplo n.º 24
0
 public Stack<CCallRecord> getList(ECallType type) { return null;}
Ejemplo 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;
            }
        }
Ejemplo 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;
 }
Ejemplo n.º 27
0
 public Resource(ECallType callType)
 {
     this.CallType = callType;
     this.IsFree = true;
 }
Ejemplo n.º 28
0
 public void addCall(ECallType type, string number, string name, System.DateTime time, System.TimeSpan duration) { }
Ejemplo n.º 29
0
 public Stack<CCallRecord> getList(ECallType type) { return null; }
Ejemplo n.º 30
0
 /// <summary>
 /// Pops the first in the queue
 /// </summary>
 public Entity GetFirstInQueue(ECallType calltype)
 {
     return(queueManager.GetFirstInQueue(calltype));
 }
Ejemplo 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;
     }
 }
Ejemplo n.º 32
0
 public Queue(ECallType callType)
 {
     this.callType    = callType;
     this.entityQueue = new List <Entity>();
 }
Ejemplo n.º 33
0
Archivo: Queue.cs Proyecto: rNdm74/C-
 public Queue(ECallType callType)
 {
     this.callType = callType;
     this.entityQueue = new List<Entity>();
 }
Ejemplo 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;
            }
        }
Ejemplo n.º 35
0
 /// <summary>
 /// Gets a formatted list of data from the queue
 /// </summary>
 public List <string[]> GetQueueEntityData(ECallType callType)
 {
     return(queueManager.GetEntityDataInQueue(callType));
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Pops the first in the queue 
 /// </summary>
 public Entity GetFirstInQueue(ECallType calltype)
 {
     return queueManager.GetFirstInQueue(calltype);
 }
Ejemplo n.º 37
0
 public Resource(ECallType callType)
 {
     this.CallType = callType;
     this.IsFree   = true;
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Gets a formatted list of data from the queue
 /// </summary>
 public List<string[]> GetQueueEntityData(ECallType callType)
 {
     return queueManager.GetEntityDataInQueue(callType);
 }
Ejemplo 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();
 }
Ejemplo 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);
 }
Ejemplo n.º 41
0
 public void addCall(ECallType type, string number, string name, System.DateTime time, System.TimeSpan duration) { }
Ejemplo 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));
 }
Ejemplo n.º 43
0
 //CONSTRUCTOR\\
 public SalesRepClass(ECallType repType)
 {
     this.isFree  = false;
     this.repType = repType;
 }
Ejemplo 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;
                }
            }
        }