Exemplo n.º 1
0
        public ActionResult PreAssessmentReport(PreAssessmentReportFilter filter = null, int pageNumber = 1)
        {
            int totalRecords = 0;

            if (filter == null)
            {
                filter = new PreAssessmentReportFilter();
            }

            var model = _preAssessmentReportingService.GetPreAssessmentReport(pageNumber, _pageSize, filter, out totalRecords);

            var currentAction        = ControllerContext.RouteData.Values["action"].ToString();
            var routeValueDictionary = new RouteValueDictionary
            {
                { "EventDateFrom", filter.EventDateFrom },
                { "EventDateTo", filter.EventDateTo },
                { "HealthPlanId", filter.HealthPlanId },
                { "Disposition", filter.Disposition }
            };

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

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

            return(View(model));
        }
Exemplo n.º 2
0
        public string PreAssessmentReportExport(PreAssessmentReportFilter filter, long userId)
        {
            var dataGen = new ExportableDataGenerator <PreAssessmentReportViewModel, PreAssessmentReportFilter>(_preAssessmentReportingService.GetPreAssessmentReport, Logger);

            var model = dataGen.GetData(filter);

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

            return(WriteCsv(GetExportableFileName("PreAssessmentReport"), exporter, model.Collection, userId));
        }
Exemplo n.º 3
0
        public void PreAssessmentReportAsync(string id = null, PreAssessmentReportFilter filter = null)
        {
            if (id == null)
            {
                return;
            }

            AsyncManager.OutstandingOperations.Increment();
            var dataGen = new ExportableDataGenerator <PreAssessmentReportViewModel, PreAssessmentReportFilter>(_preAssessmentReportingService.GetPreAssessmentReport);

            var processmanager = new ExportableDataGeneratorProcessManager <PreAssessmentReportViewModel, PreAssessmentReportFilter>();

            processmanager.Add(id, dataGen);

            GetNewProcessStarted(filter, dataGen, id);
        }
        //public CallQueueCustomer GetByCallIdAndcustomerId(long callId, long customerId)
        //{
        //    using (var adapter = PersistenceLayer.GetDataAccessAdapter())
        //    {
        //        var linqMetaData = new LinqMetaData(adapter);


        //        CallQueueCustomer callQueueCustomer = new CallQueueCustomer();
        //        var calls = (from cp in linqMetaData.Calls where cp.CallId == callId && cp.CalledCustomerId == (long)customerId select cp).FirstOrDefault();

        //        var customerProfile = (from cp in linqMetaData.CustomerProfile where cp.CustomerId == calls.CalledCustomerId select cp).FirstOrDefault();
        //        var organizationRoleUser = (from org in linqMetaData.OrganizationRoleUser where org.OrganizationRoleUserId == calls.CalledCustomerId select org).FirstOrDefault();
        //        var user = (from org in linqMetaData.User where org.UserId == organizationRoleUser.UserId select org).FirstOrDefault();
        //        var address = (from ad in linqMetaData.Address where ad.AddressId == customerProfile.BillingAddressId select ad);
        //        var eventCustomer = (from ec in linqMetaData.EventCustomers where ec.EventId == calls.EventId && ec.CustomerId == calls.CalledCustomerId select ec).FirstOrDefault();
        //        var eventAccount = (from ea in linqMetaData.EventAccount where ea.EventId == calls.EventId select ea).FirstOrDefault();
        //        var eventAppointment = (from ea in linqMetaData.EventAppointment where ea.AppointmentId == eventCustomer.AppointmentId select ea).FirstOrDefault();
        //        var prospectCustomer = (from pc in linqMetaData.ProspectCustomer where pc.CustomerId == calls.CalledCustomerId select pc).FirstOrDefault();

        //        callQueueCustomer.CustomerId = calls.CalledCustomerId;
        //        callQueueCustomer.FirstName = user.FirstName;
        //        callQueueCustomer.LastName = user.LastName;
        //        callQueueCustomer.MiddleName = user.MiddleName;
        //        callQueueCustomer.EventId = calls.EventId;
        //        callQueueCustomer.EventCustomerId = eventCustomer.EventCustomerId;
        //        callQueueCustomer.HealthPlanId = eventAccount.AccountId;
        //        callQueueCustomer.AppointmentDate = eventAppointment.StartTime;
        //        callQueueCustomer.CallQueueId = (long)calls.CallQueueId;
        //        callQueueCustomer.ProspectCustomerId = prospectCustomer.ProspectCustomerId;

        //        return callQueueCustomer;
        //    }
        //}

        public IEnumerable <PreAssessmentCallCustomer> GetForPreAssessmentReport(PreAssessmentReportFilter filter, int pageNumber, int pageSize, out int totalRecords)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var callQueue = (from cq in linqMetaData.CallQueue where cq.Category == HealthPlanCallQueueCategory.PreAssessmentCallQueue select cq).Single();

                var temp1 = (from cqcc in linqMetaData.PreAssessmentCustomerCallQueueCallAttempt
                             join c in linqMetaData.Calls on cqcc.CallId equals c.CallId
                             where (c.CallQueueId == callQueue.CallQueueId || c.Disposition == ProspectCustomerTag.PatientConfirmed.ToString()) &&
                             c.Status != (long)CallStatus.Initiated
                             group cqcc.CallId by cqcc.CustomerId
                             into grp
                             select new { CustomerId = grp.Key, CallId = grp.Max() });



                var query = (from cqc in linqMetaData.PreAssessmentCustomerCallQueueCallAttempt
                             join t in temp1 on cqc.CallId equals t.CallId
                             join c in linqMetaData.Calls on t.CallId equals c.CallId
                             join ec in linqMetaData.EventCustomers on new { CustomerId = t.CustomerId, EventId = c.EventId.Value } equals new { CustomerId = ec.CustomerId, EventId = ec.EventId }
                             where c.CallQueueId == callQueue.CallQueueId &&
                             cqc.CustomerId != null && cqc.CustomerId > 0 &&
                             c.CalledCustomerId != null && c.EventId != null &&
                             c.Status != (long)CallStatus.Initiated
                             select new { c.CalledCustomerId, c.EventId, c.HealthPlanId, c.TimeCreated, c.Disposition, t.CallId, ec.EventCustomerId });

                if (filter.EventDateFrom.HasValue)
                {
                    var eventIds = (from e in linqMetaData.Events where e.EventDate >= filter.EventDateFrom select e.EventId);
                    query = (from q in query
                             where q.EventId != null && q.EventId > 0 &&
                             eventIds.Contains(q.EventId.Value)
                             select q);
                }

                if (filter.EventDateTo.HasValue)
                {
                    var eventIds = (from e in linqMetaData.Events where e.EventDate <= filter.EventDateTo select e.EventId);
                    query = (from q in query
                             where q.EventId != null && q.EventId > 0 &&
                             eventIds.Contains(q.EventId.Value)
                             select q);
                }

                if (filter.HealthPlanId > 0)
                {
                    query = (from q in query
                             where q.HealthPlanId == filter.HealthPlanId
                             select q);
                }

                if (!string.IsNullOrEmpty(filter.Disposition))
                {
                    query = (from q in query
                             where q.Disposition == filter.Disposition
                             select q);
                }

                totalRecords = query.Count();

                var model = query.OrderByDescending(x => x.TimeCreated).Select(x => new PreAssessmentCallCustomer
                {
                    HealthPlanId    = x.HealthPlanId,
                    CustomerId      = x.CalledCustomerId,
                    EventId         = x.EventId,
                    CallId          = x.CallId,
                    EventCustomerID = x.EventCustomerId
                }).TakePage(pageNumber, pageSize).ToArray();

                return(model);
            }
        }
Exemplo n.º 5
0
 public ActionResult PreAssessmentReport(PreAssessmentReportFilter filter = null)
 {
     return(CreateExportQueue(filter, ExportableReportType.PreAssessmentReport, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId));
 }