public IEnumerable <OutboundCall> GetoutboundCallsForAgents(AgentConversionReportFilter filter, long[] agentIds)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var query = (from oc in linqMetaData.VwGetOutboundCalls
                             where agentIds.Contains(oc.CreatedByOrgRoleUserId) &&
                             oc.HealthPlanId > 0 && oc.CallQueueId > 0
                             select oc);

                if (filter != null)
                {
                    if (filter.ShowPreviousDayData)
                    {
                        filter.FromDate = DateTime.Today.AddDays(-1);
                        filter.ToDate   = DateTime.Today.AddDays(-1);
                    }
                    if (filter.FromDate.HasValue)
                    {
                        query = (from q in query where q.DateCreated >= filter.FromDate.Value select q);
                    }
                    if (filter.ToDate.HasValue)
                    {
                        query = (from q in query where q.DateCreated <= filter.ToDate.Value.GetEndOfDay() select q);
                    }
                }

                return(Mapper.Map <IEnumerable <VwGetOutboundCallsEntity>, IEnumerable <OutboundCall> >(query));
            }
        }
        public ActionResult AgentConversionReport(AgentConversionReportFilter filter = null, int pageNumber = 1)
        {
            int totalRecords;

            filter = filter ?? new AgentConversionReportFilter();

            var model = _callCenterReportService.GetAgentConversionReport(pageNumber, _pageSize, filter, out totalRecords);

            var currentAction          = ControllerContext.RouteData.Values["action"].ToString();
            Func <int, string> urlFunc = pn => Url.Action(currentAction, new { pageNumber = pn, filter.FromDate, filter.ToDate, filter.CallCenterAgentId });

            model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);

            return(View(model));
        }
Exemple #3
0
        public void AgentConversionReportAsync(string id = null, AgentConversionReportFilter filter = null)
        {
            if (id == null)
            {
                return;
            }

            AsyncManager.OutstandingOperations.Increment();
            var dataGen = new ExportableDataGenerator <AgentConversionReportViewModel, AgentConversionReportFilter>(_callCenterReportService.GetAgentConversionReport);

            var processmanager = new ExportableDataGeneratorProcessManager <AgentConversionReportViewModel, AgentConversionReportFilter>();

            processmanager.Add(id, dataGen);

            GetNewProcessStarted(filter, dataGen, id);
        }
        public long[] GetCallCenterAgentsForConversionReport(AgentConversionReportFilter filter, int pageNumber, int pageSize, out int totalRecords)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var query = (from cca in linqMetaData.VwGetCallCenterAgentsForConversionReport
                             where cca.HealthPlanId > 0 && cca.CallQueueId > 0
                             select cca);

                if (filter != null)
                {
                    if (filter.ShowPreviousDayData)
                    {
                        filter.FromDate = DateTime.Today.AddDays(-1);
                        filter.ToDate   = DateTime.Today.AddDays(-1);
                    }
                    if (filter.FromDate.HasValue)
                    {
                        query = (from q in query where q.DateCreated >= filter.FromDate.Value select q);
                    }
                    if (filter.ToDate.HasValue)
                    {
                        query = (from q in query where q.DateCreated <= filter.ToDate.Value.GetEndOfDay() select q);
                    }
                    if (filter.CallCenterAgentId > 0)
                    {
                        query = (from q in query where q.CreatedByOrgRoleUserId == filter.CallCenterAgentId select q);
                    }
                }

                var agentIds = (from q in query
                                select q.CreatedByOrgRoleUserId);

                var sortedQuery = (from oru in linqMetaData.OrganizationRoleUser
                                   join u in linqMetaData.User on oru.UserId equals u.UserId
                                   where agentIds.Contains(oru.OrganizationRoleUserId)
                                   orderby u.FirstName, u.LastName
                                   select oru.OrganizationRoleUserId);

                totalRecords = sortedQuery.Count();

                var result = sortedQuery.Skip((pageNumber - 1) * pageSize).Take(pageSize);

                return(result.ToArray());
            }
        }