public CallbackReentryManager() { _recordManager = null; _settingsManager = null; objLock = new object(); objLockReentry = new object(); _LastTick = DateTime.ParseExact("01/01/1900 00:00:00", "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); _tmrTick = new System.Threading.Timer(_tmrTick_Tick); }
public CallbackReentryManager(CallbackRecordManager RecordManager, ContactRealtimeDataClient RealtimeDataClient, SettingsManager SettingsManager) { _recordManager = RecordManager; _RealtimeDataClient = RealtimeDataClient; _settingsManager = SettingsManager; objLock = new object(); objLockReentry = new object(); _LastTick = DateTime.ParseExact("01/01/1900 00:00:00", "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); _tmrTick = new System.Threading.Timer(_tmrTick_Tick); }
public bool Analyse(ContactServiceQueueInformation Information, CallbackContactServiceQueueSettingsProfile Profile, CallbackRecordManager RecordManager) { Trace.TraceInformation("Enter."); try { if (Information == null) { _Description = "Information is null."; Trace.TraceWarning("Information is null."); return(false); } if (Profile == null) { _Description = "Profile is null."; Trace.TraceWarning("Profile is null."); return(false); } if (RecordManager == null) { _Description = "RecordManager is null."; Trace.TraceWarning("RecordManager is null."); return(false); } bool bResult = true; foreach (CallbackAlgorithmFilter filter in Profile.OfferedAlgorithmFilters) { if (filter.Enabled) { try { Constants.FilterOperations Operation = Constants.FilterOperations.BIGGERTHANOREQUALTO; Operation = (Constants.FilterOperations)Enum.Parse(typeof(Constants.FilterOperations), filter.Operation.ToUpper()); switch (filter.Name) { case "AgentsLoggedIn": switch (Operation) { case Constants.FilterOperations.BIGGERTHANOREQUALTO: if (Information.AgentsLoggedIn >= filter.Value) { bResult = bResult && true; } else { _Description = "CSQ " + Information.Name + " has less than " + filter.Value + " agents logged in."; bResult = bResult && false; } break; case Constants.FilterOperations.SMALLERTHANOREQUALTO: if (Information.AgentsLoggedIn <= filter.Value) { bResult = bResult && true; } else { _Description = "CSQ " + Information.Name + " has more than " + filter.Value + " agents logged in."; bResult = bResult && false; } break; } break; case "CallsWaiting": switch (Operation) { case Constants.FilterOperations.BIGGERTHANOREQUALTO: if (Information.ContactsWaiting >= filter.Value) { bResult = bResult && true; } else { _Description = "CSQ " + Information.Name + " has less than " + filter.Value + " calls waiting."; bResult = bResult && false; } break; case Constants.FilterOperations.SMALLERTHANOREQUALTO: if (Information.ContactsWaiting <= filter.Value) { bResult = bResult && true; } else { _Description = "CSQ " + Information.Name + " has more than " + filter.Value + " calls waiting."; bResult = bResult && false; } break; } break; case "LongestQueueTime": switch (Operation) { case Constants.FilterOperations.BIGGERTHANOREQUALTO: if (Information.LongestWaitingContact >= filter.Value) { bResult = bResult && true; } else { _Description = "CSQ " + Information.Name + " has longest queue time less than " + filter.Value; bResult = bResult && false; } break; case Constants.FilterOperations.SMALLERTHANOREQUALTO: if (Information.LongestWaitingContact <= filter.Value) { bResult = bResult && true; } else { _Description = "CSQ " + Information.Name + " has longest queue time more than " + filter.Value; bResult = bResult && false; } break; } break; case "CallbackRequests": switch (Operation) { case Constants.FilterOperations.BIGGERTHANOREQUALTO: if (RecordManager.NumberOfRecordsForQueue(Information.Name) >= filter.Value) { bResult = bResult && true; } else { _Description = "CSQ " + Information.Name + " has fewer than " + filter.Value + " callback requests."; bResult = bResult && false; } break; case Constants.FilterOperations.SMALLERTHANOREQUALTO: if (RecordManager.NumberOfRecordsForQueue(Information.Name) <= filter.Value) { bResult = bResult && true; } else { _Description = "CSQ " + Information.Name + " has more than " + filter.Value + " callback requests:" + RecordManager.NumberOfRecordsForQueue(Information.Name); bResult = bResult && false; } break; } break; default: break; } } catch (Exception ex) { _Description = "Exception performing algorithm comparisons."; Trace.TraceWarning("Exception: " + ex.Message + Environment.NewLine + "Stacktrace: " + ex.StackTrace); bResult = false; } } } return(bResult); } catch (Exception ex) { _Description = "Exception running callback offer algorithm."; Trace.TraceWarning("Exception: " + ex.Message + Environment.NewLine + "Stacktrace: " + ex.StackTrace); return(false); } }