Beispiel #1
0
        public GlobalCallCenterRepMetricViewData GetMetricsForAllUsers(DateTime startDate, DateTime endDate)
        {
            ICallCenterRepMetricRepository  callCenterRepMetricRepository = new CallCenterRepMetricRepository();
            List <OrderedPair <long, int> > listOfNumberOfCalls           = callCenterRepMetricRepository.GetListOfNumberOfCalls(startDate, endDate);
            List <OrderedPair <long, int> > listOfNumberOfBookings        = callCenterRepMetricRepository.GetListOfNumberOfBookings(startDate, endDate);
            var listOfNumberOfSpouseBookings = callCenterRepMetricRepository.GetListOfNumberOfSpouseBookings(startDate, endDate);

            listOfNumberOfSpouseBookings = listOfNumberOfSpouseBookings ?? new List <OrderedPair <long, int> >();
            List <OrderedPair <long, int> >     listOfNumberOfClosings   = callCenterRepMetricRepository.GetListOfNumberOfClosings(startDate, endDate);
            List <OrderedPair <long, decimal> > listOfAverageSaleAmounts = callCenterRepMetricRepository.GetListOfAverageSaleAmounts(startDate, endDate);
            List <CallCenterRepMetricViewData>  callCenterMetrics        = _callCenterRepMetricFactory.CreateCallCenterMetrics
                                                                               (listOfNumberOfCalls, listOfNumberOfBookings, listOfNumberOfSpouseBookings, listOfNumberOfClosings,
                                                                               listOfAverageSaleAmounts);

            try
            {
                List <long>          callCenterCallCenterUserIds = callCenterMetrics.Select(ccm => ccm.CallCenterRepId).ToList();
                List <CallCenterRep> callCenterReps = _callCenterRepRepository.GetCallCenterReps(callCenterCallCenterUserIds);
                List <OrderedPair <CallCenterRep, CallCenterRepMetricViewData> > globalMetrics =
                    callCenterMetrics.Select(ccm => new OrderedPair <CallCenterRep, CallCenterRepMetricViewData>
                                                 (callCenterReps.SingleOrDefault(ccr => ccr.CallCenterRepId == ccm.CallCenterRepId), ccm)).
                    Where(ccm => ccm.FirstValue != null).ToList();

                return(new GlobalCallCenterRepMetricViewData(globalMetrics));
            }
            catch (Exception)
            {
                // TODO: We need to log the issue, this is probably we dont have any records for the filters provided.
                return(null);
            }
        }
Beispiel #2
0
        public void GetCallCenterRepsReturnsUserWithId1058WhenCallCenterUser105Given()
        {
            const long expectedUserId = 1058;

            List <Falcon.App.Core.Users.Domain.CallCenterRep> callCenterReps = _callCenterRepRepository.
                                                                               GetCallCenterReps(new List <long> {
                VALID_CALL_CENTER_CALL_CENTER_USER_ID
            });

            Assert.AreEqual(expectedUserId, callCenterReps.Single().Id, "Incorrect User ID returned.");
        }