public ActionResult CustomerWithNoEventsInAreaReport(CustomerWithNoEventsInAreaReportModelFilter filter = null, int pageNumber = 1)
        {
            filter = filter ?? new CustomerWithNoEventsInAreaReportModelFilter();

            filter.ZipRangeInMiles = _zipRangeInMiles;

            if (filter.AccountId > 0 || (filter.CustomerId.HasValue && filter.CustomerId > 0) || !string.IsNullOrEmpty(filter.MemberId))
            {
                int totalRecords;
                var model = _callQueueService.GetCustomerWithNoEventsInArea(pageNumber, _pageSize, filter, out totalRecords);
                if (model == null)
                {
                    model = new CustomerWithNoEventsInAreaReportListModel();
                }

                model.Filter = filter;

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

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

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

            return(View(new CustomerWithNoEventsInAreaReportListModel {
                Filter = filter
            }));
        }
        public CustomerWithNoEventsInAreaReportListModel Create(IEnumerable <Customer> customers, IEnumerable <CorporateCustomerCustomTag> customTags)
        {
            var model      = new CustomerWithNoEventsInAreaReportListModel();
            var collection = new List <CustomerWithNoEventsInAreaReportModel>();

            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 customerZipCode = "N/A";
                if (c.Address != null)
                {
                    if (c.Address.ZipCode != null)
                    {
                        customerZipCode = c.Address.ZipCode.ToString();
                    }
                }
                var callQueueExcludedCustomerReportModel = new CustomerWithNoEventsInAreaReportModel
                {
                    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
                };

                collection.Add(callQueueExcludedCustomerReportModel);
            });


            model.Collection = collection;
            return(model);
        }
Exemple #3
0
        public ActionResult CustomerWithNoEventsInAreaReportCompleted(string id, CustomerWithNoEventsInAreaReportListModel 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 <CustomerWithNoEventsInAreaReportModel>();

            var message = WriteCsv(string.Format("CustomerWithNoEventsInAreaReport_{0}.csv", Guid.NewGuid()), exporter, model.Collection, RequestSubcriberChannelNames.CustomerWithNoEventsInAreaReportQueue, RequestSubcriberChannelNames.CustomerWithNoEventsInAreaReportChannel);

            return(Content(message));
        }