Beispiel #1
0
        public void GetRevenuePairByPacakge(IEnumerable <HealthPlanRevenueItem> accountRevenueItems, HealthPlanRevenue revenue, List <OrderedPair <long, decimal> > list)
        {
            var packageRevenueItems = accountRevenueItems.Where(x => x.PackageId.HasValue);

            var pacakgeIds = packageRevenueItems.Select(x => x.PackageId.Value).Distinct();

            var customerCountByPackage = _eventCustomerRepository.GetEventCustomerCountForHealthPlanRevenueByPackage(revenue.AccountId, revenue.DateFrom, revenue.DateTo ?? DateTime.Today.AddDays(1), pacakgeIds);

            decimal revenueGeneatedbyPackage = 0;
            long    customerCount            = 0;

            foreach (var pacakgeId in pacakgeIds)
            {
                var customersAvailedPackagePair = customerCountByPackage.SingleOrDefault(x => x.FirstValue == pacakgeId);

                if (customersAvailedPackagePair != null)
                {
                    var customersAvailedPackage = customersAvailedPackagePair.SecondValue;
                    customerCount += customersAvailedPackage;
                    var packagePrice = packageRevenueItems.First(x => x.PackageId.Value == pacakgeId).Price;

                    revenueGeneatedbyPackage = revenueGeneatedbyPackage + (packagePrice * customersAvailedPackage);
                }
            }

            list.Add(new OrderedPair <long, decimal>(customerCount, revenueGeneatedbyPackage));
        }
Beispiel #2
0
        public void EntityIdFieldReturnsRefundIdFromRefundFields()
        {
            var result = _eventCustomerRepository.GetEventCustomerCountForHealthPlanRevenueByPackage(1003,
                                                                                                     DateTime.Today.AddDays(-565), DateTime.Today, new long[] { 399, 437, 438 });
            //EntityField2 expectedEntityIdField = RefundFields.RefundId;
            //string expectedEntityFieldName = string.Format("{0}.{1}", expectedEntityIdField.ContainingObjectName, expectedEntityIdField.Name);

            //EntityField2 entityIdField = _refundRepository.EntityIdField;
            //string entityFieldName = string.Format("{0}.{1}", entityIdField.ContainingObjectName, entityIdField.Name);

            //Assert.AreEqual(expectedEntityFieldName, entityFieldName, "EntityIdField returned incorrect EntityField.");
        }
        public void GetEventCustomerCountForHealthPlanRevenueByPackage()
        {
            var result = _eventCustomerRepository.GetEventCustomerCountForHealthPlanRevenueByPackage(1003,
                                                                                                     DateTime.Today.AddDays(-565), DateTime.Today, new long[] { 399, 437, 438 });

            if (result != null)
            {
                var packageIds = result.Select(x => x.FirstValue).Distinct();
                foreach (var packageId in packageIds)
                {
                    var count = result.Count(x => x.FirstValue == packageId);
                }
            }

            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result.ToList());
        }