コード例 #1
0
ファイル: ReportsController.cs プロジェクト: sahvishal/matrix
        public ActionResult CallQueueExcludedCustomerReport(CallQueueExcludedCustomerReportModelFilter filter = null, int pageNumber = 1)
        {
            if (filter != null && ((filter.CustomerId.HasValue && filter.CustomerId > 0) || filter.HealthPlanId > 0 || !string.IsNullOrEmpty(filter.MemberId)))
            {
                int totalRecords;
                var model = _callQueueService.GetCallQueueExcludedCustomerReport(pageNumber, _pageSize, filter, out totalRecords);
                if (model == null)
                {
                    model = new CallQueueExcludedCustomerReportListModel();
                }
                model.Filter = filter;

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

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

                model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);
                return(View(model));
            }
            else
            {
                return(View(new CallQueueExcludedCustomerReportListModel {
                    Filter = filter
                }));
            }
        }
コード例 #2
0
        public ActionResult CallQueueExcludedCustomerReportCompleted(string id, CallQueueExcludedCustomerReportListModel model)
        {
            if (id == null)
            {
                return(Content("Model can't be null."));
            }

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

            RemoveProcess(id);

            var exporter = ExportableDataGeneratorProcessManager <ViewModelBase, ModelFilterBase> .GetCsvExporter <CallQueueExcludedCustomerReportModel>();

            var message = WriteCsv(string.Format("CallQueueExcludedCustomerReport_{0}.csv", Guid.NewGuid()), exporter, model.Collection, RequestSubcriberChannelNames.CallQueueExcludedCustomerReportQueue, RequestSubcriberChannelNames.CallQueueExcludedCustomerReportChannel);

            return(Content(message));
        }
コード例 #3
0
        public CallQueueExcludedCustomerReportListModel Create(IEnumerable <Customer> customers, IEnumerable <CorporateCustomerCustomTag> customTags,
                                                               IEnumerable <ProspectCustomer> prospectCustomers, IEnumerable <EventCustomer> eventCustomers, IEnumerable <Event> events, IEnumerable <OrganizationRoleUser> orgRoleUsers,
                                                               IEnumerable <User> users, IEnumerable <CallQueueCustomerCriteraAssignmentForStats> callQueueCustomers, IEnumerable <long> healthPlanZipIdPairs, CorporateAccount account,
                                                               IEnumerable <AccountCallQueueSetting> callQueueSettings, IEnumerable <CustomerEligibility> customerEligibilityCollection, IEnumerable <CustomerTargeted> targetedCustomers)
        {
            var model      = new CallQueueExcludedCustomerReportListModel();
            var collection = new List <CallQueueExcludedCustomerReportModel>();

            customers.ToList().ForEach(c =>
            {
                var customerTag = "N/A";
                if (customTags != null && customTags.Any())
                {
                    var customTag = (from ct in customTags where ct.CustomerId == c.CustomerId select ct.Tag).ToArray();

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

                var reasons = "N/A";
                CallQueueCustomerCriteraAssignmentForStats callQueueCustomer = null;
                if (!callQueueCustomers.IsNullOrEmpty())
                {
                    callQueueCustomer = callQueueCustomers.FirstOrDefault(x => x.CustomerId == c.CustomerId);
                }
                var customerEligibility = customerEligibilityCollection.FirstOrDefault(x => x.CustomerId == c.CustomerId);
                var targetedCustomer    = !targetedCustomers.IsNullOrEmpty() ? targetedCustomers.FirstOrDefault(x => x.CustomerId == c.CustomerId) : null;
                var reasonList          = GetReasons(c, prospectCustomers, eventCustomers, events, orgRoleUsers, users, callQueueCustomer, healthPlanZipIdPairs, account, callQueueSettings, customerEligibility, targetedCustomer).ToArray();
                if (reasonList != null && reasonList.Any())
                {
                    if (reasonList != null && reasonList.Any())
                    {
                        reasons = string.Join(", ", reasonList);
                    }
                }
                var customerZipCode = "N/A";
                if (c.Address != null)
                {
                    if (c.Address.ZipCode != null)
                    {
                        customerZipCode = c.Address.ZipCode.ToString();
                    }
                }
                var callQueueExcludedCustomerReportModel = new CallQueueExcludedCustomerReportModel
                {
                    CustomerId = c.CustomerId,
                    Name       = c.Name,
                    MemberId   = (!string.IsNullOrEmpty(c.InsuranceId)) ? c.InsuranceId : "N/A",
                    ZipCode    = customerZipCode,
                    Tag        = (!string.IsNullOrEmpty(c.Tag)) ? c.Tag : "N/A",
                    CustomTags = customerTag,
                    Reason     = reasons
                };

                collection.Add(callQueueExcludedCustomerReportModel);
            });


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