Exemple #1
0
        public UncontactedCustomersReportListModel Create(IEnumerable <Customer> customers, IEnumerable <CorporateCustomerCustomTag> customerTags, IEnumerable <CustomerEligibility> customerEligibilities)
        {
            var model      = new UncontactedCustomersReportListModel();
            var collection = new List <UncontactedCustomersReportModel>();

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

                    if (customTag != null && customTag.Any())
                    {
                        customerTag = string.Join(", ", customTag);
                    }
                }
                var eligibility = customerEligibilities.FirstOrDefault(x => x.CustomerId == c.CustomerId);

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

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

                var uncontactedCustomersModel = new UncontactedCustomersReportModel
                {
                    CustomerId = c.CustomerId,
                    Name       = c.Name.FullName,
                    Tag        = c.Tag,
                    ZipCode    = customerZipCode,
                    IsEligible = isEligible,
                    CustomTag  = customerTag
                };
                collection.Add(uncontactedCustomersModel);
            });

            model.Collection = collection;
            return(model);
        }
        public ActionResult UncontactedCustomersReport(UncontactedCustomersReportModelFilter filter = null, int pageNumber = 1)
        {
            int totalRecords;
            var model = _callQueueService.GetUncontactedCustomersReport(pageNumber, _pageSize, filter, out totalRecords);

            if (model == null)
            {
                model = new UncontactedCustomersReportListModel();
            }
            model.Filter = filter;

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

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

            model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);
            return(View(model));
        }
Exemple #3
0
        public ActionResult UncontactedCustomersReportCompleted(string id, UncontactedCustomersReportListModel 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 exporter = ExportableDataGeneratorProcessManager <ViewModelBase, ModelFilterBase> .GetCsvExporter <UncontactedCustomersReportModel>();

            var message = WriteCsv(string.Format("UncontactedCustomersReport_{0}.csv", id), exporter, model.Collection, RequestSubcriberChannelNames.UncontactedCustomersReportQueue, RequestSubcriberChannelNames.UncontactedCustomersReportChannel);

            return(Content(message));
        }