private static ICommunication fromAbandonedRecord(string[] record) { try { DateTime firstRingTime = DateTime.Parse(record[0]); int accountCode = ClosingReport.sentinel; int.TryParse(record[1], out accountCode); TimeSpan callDuration = TimeManagement.StampToSpan(record[2]); ICommunication comm = new Communication( timeOfReceipt: firstRingTime, groupId: accountCode, direction: CommDirection.Inbound, wasReceived: false, timePendingResponse: null, duration: callDuration ); ClosingReport.log.TraceEvent(TraceEventType.Information, 0, $"Parsed communication: {comm}"); return(comm); } catch (Exception e) { throw new ParseException($"Unable to parse call from CVS row: {record}. Got error: {e.Message}"); } }
private static ICommunication fromInboundRecord(string[] row) { try { DateTime firstRingTime = DateTime.Parse(row[0]); string telephoneNumber = row[1]; TimeSpan callDuration = TimeManagement.StampToSpan(row[2]); int agentId = ClosingReport.sentinel; int.TryParse(row[3], out agentId); int accountCode = ClosingReport.sentinel; int.TryParse(row[4], out accountCode); TimeSpan ringDuration = TimeManagement.StampToSpan(row[5]); ICommunication comm = new Communication( timeOfReceipt: firstRingTime, groupId: accountCode, direction: CommDirection.Inbound, wasReceived: true, timePendingResponse: ringDuration, duration: callDuration ); ClosingReport.log.TraceEvent(TraceEventType.Information, 0, $"Parsed communication: {comm}"); return(comm); } catch (Exception e) { throw new ParseException($"Unable to parse communication from CVS row: {row}. Got error: {e.Message}"); } }
public void AddCommunication(ICommunication comm) { if (!TimeManagement.IsOpenAt(comm.TimeOfReceipt)) { ClosingReport.log.TraceEvent(TraceEventType.Warning, 0, $"Communication falls outside hours of operation: {comm}"); return; } Account account; try { account = accounts[comm.GroupId]; } catch (KeyNotFoundException) { account = accounts[sentinel]; } try { account.AddCommunication(comm); } catch (Exception e) { ClosingReport.log.TraceEvent(TraceEventType.Error, 1, $"Unable to add call, {comm}, got error: {e.Message}"); } }
public static IEnumerable <Stats> SeriesCtor(Accounts accounts) { var IsInbound = accounts.Trackers["Inbound"].IsTrackable; var IsOutbound = accounts.Trackers["Outbound"].IsTrackable; var IsAbandoned = accounts.Trackers["Abandoned"].IsTrackable; foreach (Account account in accounts) { var abandons = new List <ICommunication>(from x in account where IsAbandoned(x) select x); var inbounds = new List <ICommunication>(from x in account where IsInbound(x) select x); var outbounds = new List <ICommunication>(from x in account where IsOutbound(x) select x); yield return(new Stats { AccountName = account.Name, InboundAverage = TimeManagement.AverageTime(from comm in inbounds select comm.TimeSpentPending), AbandonedAverage = TimeManagement.AverageTime(from comm in abandons select comm.Duration), TotalInbound = inbounds.Count, TotalOutbound = outbounds.Count, TotalAbandoned = abandons.Count }); } yield break; }
public bool TrackIfSupported(ICommunication comm) { if (IsTrackable(comm)) { TimeSpan rounded = TimeManagement.NearestIncrement(comm.TimeOfReceipt); ClosingReport.log.TraceEvent(TraceEventType.Information, 0, $"Tracker {Name} supports communication, '{comm};' adding as {rounded}"); counts[rounded]++; return(true); } ClosingReport.log.TraceEvent(TraceEventType.Information, 0, $"Tracker {Name} does not support communication: {comm}"); return(false); }