Ejemplo n.º 1
0
        public ActionResult CallCenterCallReport(CallCenterCallReportModelFilter filter = null, int pageNumber = 1)
        {
            int totalRecords;

            if (filter == null)
            {
                filter = new CallCenterCallReportModelFilter {
                    DateFrom = DateTime.Now.AddDays(-1).Date, DateTo = DateTime.Now.Date.AddDays(-1).Date
                }
            }
            ;

            var model = _callQueueService.GetCallCenterCallReport(pageNumber, _pageSize, filter, out totalRecords);

            if (model == null)
            {
                model = new CallCenterCallReportListModel();
            }

            if (string.IsNullOrEmpty(filter.Tag) && (filter.CustomTags == null) && !filter.DateFrom.HasValue && !filter.DateTo.HasValue && !filter.CustomerId.HasValue && filter.HealthPlanId <= 0 && filter.CallQueueId <= 0)
            {
                filter.DateFrom = filter.DateFrom.HasValue ? filter.DateFrom.Value : DateTime.Now.AddDays(-1).Date;
                filter.DateTo   = filter.DateTo.HasValue ? filter.DateTo.Value : DateTime.Now.AddDays(-1).Date;
            }

            model.Filter = filter;

            var currentAction        = ControllerContext.RouteData.Values["action"].ToString();
            var routeValueDictionary = GetRouteValueDictionaryForCallCenterCallReportModel(filter);

            Func <int, string> urlFunc = pn => Url.Action(currentAction, AddRouteValueDictionary(routeValueDictionary, pn));

            model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult CallCenterCallReportCompleted(string id, CallCenterCallReportListModel model)
        {
            if (id == null)
            {
                return(Content("Model can't be null."));
            }

            if (model == null || model.Collection == null || model.Collection.Count() < 1)
            {
                return(Content("Model can't be null."));
            }

            RemoveProcess(id);

            var message = WriteCsvCallCenterCallReport(string.Format("CallCenterCallReport_{0}.csv", Guid.NewGuid()), model.Collection);

            return(Content(message));
        }
Ejemplo n.º 3
0
        public CallCenterCallReportListModel Create(List <Customer> customers, IEnumerable <Core.Sales.Domain.CorporateCustomerCustomTag> customerTags, IEnumerable <Call> calls, List <EventCustomer> eventCustomers,
                                                    EventBasicInfoListModel eventBasicInfoListModel, List <Appointment> appointments, IEnumerable <OrderedPair <long, string> > registeredbyAgentNameIdPair, IEnumerable <CallCenterNotes> callCenterCallNotes,
                                                    IEnumerable <OrderedPair <long, long> > orderedPairsCustomersShippingDetails, IEnumerable <ShippingDetail> customersShippingDetails, List <Address> addresses, IEnumerable <CallQueue> callQueues,
                                                    IEnumerable <CustomerEligibility> customerEligibilities)
        {
            var model      = new CallCenterCallReportListModel();
            var collection = new List <CallCenterCallReportModel>();
            var events     = eventBasicInfoListModel != null && eventBasicInfoListModel.Events != null ? eventBasicInfoListModel.Events : null;

            calls.ToList().ForEach(c =>
            {
                var customer            = (from cd in customers where cd.CustomerId == c.CalledCustomerId select cd).First();
                var customerEligibility = customerEligibilities.FirstOrDefault(x => x.CustomerId == customer.CustomerId);
                Appointment appointment = null;
                var eventDetail         = events != null ? events.SingleOrDefault(x => x.Id == c.EventId) : null;
                if (eventCustomers != null)
                {
                    var eventCustomer = eventCustomers.SingleOrDefault(x => x.EventId == c.EventId && x.CustomerId == c.CalledCustomerId);

                    if (eventCustomer != null && eventCustomer.AppointmentId.HasValue)
                    {
                        appointment = appointments.Single(x => x.Id == eventCustomer.AppointmentId.Value);
                    }
                }

                var callQueueName = "N/A";

                if (c.CallQueueId.HasValue && c.CallQueueId > 0)
                {
                    callQueueName = callQueues.Single(x => x.Id == c.CallQueueId.Value).Name;
                }

                var customerTag = "N/A";
                if (customerTags != null && customerTags.Any())
                {
                    var customTag = (from ct in customerTags where ct.CustomerId == c.CalledCustomerId select ct.Tag).ToArray();

                    if (customTag != null && customTag.Any())
                    {
                        customerTag = string.Join(", ", customTag);
                    }
                }

                ProspectCustomerTag prospectCustomerTag;
                Enum.TryParse(c.Disposition, out prospectCustomerTag);
                var isDefined = Enum.IsDefined(typeof(ProspectCustomerTag), prospectCustomerTag);

                var agentName = "N/A";
                if (registeredbyAgentNameIdPair != null && registeredbyAgentNameIdPair.Any())
                {
                    agentName = registeredbyAgentNameIdPair.Single(ap => ap.FirstValue == c.CreatedByOrgRoleUserId).SecondValue;
                }

                var state = "N/A";
                if (orderedPairsCustomersShippingDetails != null && orderedPairsCustomersShippingDetails.Any())
                {
                    var shippingDetais = orderedPairsCustomersShippingDetails.Where(x => x.FirstValue == c.CalledCustomerId);

                    if (shippingDetais != null && shippingDetais.Any())
                    {
                        var shippingDeatilsIds      = shippingDetais.Select(x => x.SecondValue);
                        var customerShippingAdderss = customersShippingDetails.FirstOrDefault(x => shippingDeatilsIds.Contains(x.Id));
                        if (customerShippingAdderss != null)
                        {
                            var address = addresses.FirstOrDefault(x => x.Id == customerShippingAdderss.ShippingAddress.Id);
                            state       = address.State;
                        }
                        else if (customer.Address != null)
                        {
                            state = customer.Address.State;
                        }
                    }
                    else if (customer.Address != null)
                    {
                        state = customer.Address.State;
                    }
                }
                else if (customer.Address != null)
                {
                    state = customer.Address.State;
                }

                var isEligible = "N/A";
                if (customerEligibility != null && customerEligibility.IsEligible.HasValue)
                {
                    if (customerEligibility.IsEligible.Value)
                    {
                        isEligible = EligibleStatus.Yes.ToString();
                    }
                    else
                    {
                        isEligible = EligibleStatus.No.ToString();
                    }
                }

                var customerZipCode = "N/A";
                if (customer.Address != null)
                {
                    if (customer.Address.ZipCode != null)
                    {
                        customerZipCode = customer.Address.ZipCode.ToString();
                    }
                }

                var outreachTime     = String.Format("{0:hh:mm tt}", DateTime.Today);
                var callOutreachTime = String.Format("{0:hh:mm tt}", c.CallDateTime);

                var callCenterCallReportModel = new CallCenterCallReportModel
                {
                    CustomerId            = c.CalledCustomerId,
                    Name                  = customer.Name,
                    MemberId              = customer.InsuranceId,
                    MedicareId            = customer.Hicn,
                    DateOfBirth           = customer.DateOfBirth,
                    EventDate             = eventDetail != null ? eventDetail.EventDate : (DateTime?)null,
                    EventId               = eventDetail != null ? eventDetail.Id.ToString() : "N/A",
                    AppointmentTime       = appointment != null ? appointment.StartTime : (DateTime?)null,
                    AppointmentBookedDate = appointment != null ? appointment.DateCreated : (DateTime?)null,
                    Tag              = customer.Tag,
                    SponsoredBy      = eventDetail != null ? eventDetail.Sponsor : "N/A",
                    Outcome          = ((CallStatus)c.Status).GetDescription(),
                    Disposition      = c.Disposition != string.Empty && isDefined ? prospectCustomerTag.GetDescription() : "N/A",
                    Reason           = c.NotInterestedReasonId.HasValue && c.NotInterestedReasonId.Value > 0 ? ((NotInterestedReason)c.NotInterestedReasonId.Value).GetDescription() : "N/A",
                    OutreachDate     = c.CallDateTime,
                    OutreachTime     = (callOutreachTime != outreachTime) ? callOutreachTime : "N/A",
                    OutreachType     = c.IsIncoming ? "Inbound" : "Outbound",
                    CustomTags       = customerTag,
                    Agent            = agentName,
                    State            = state,
                    Notes            = callCenterCallNotes.Where(cn => cn.CallId == c.Id).Select(x => x).ToArray(),
                    ZipCode          = customerZipCode,
                    IsEligible       = isEligible,
                    CallQueue        = callQueueName,
                    CalledCustomTags = !string.IsNullOrEmpty(c.CustomTags) ? c.CustomTags : "N/A"
                };

                collection.Add(callCenterCallReportModel);
            });

            model.Collection = collection;
            return(model);
        }