Пример #1
0
            internal AffiliateReportTotals GetAffiliateTotals(long affId, TotalsReturnType returnType)
            {
                IEnumerable <DnnUser> users = null;

                var query = BuildReportQuery().Where(a => a.Id == affId);

                query = FilterQueryBySearchText(query, ref users);

                var totals = new AffiliateReportTotals();

                if (returnType == TotalsReturnType.ReturnAll || returnType == TotalsReturnType.ReturnReferrals)
                {
                    totals.ReferralsCount = query.Sum(i => (int?)i.SignupsCount) ?? 0;
                }

                if (returnType == TotalsReturnType.ReturnAll || returnType == TotalsReturnType.ReturnOrders)
                {
                    totals.OrdersCount = query.Sum(i => (int?)i.OrdersCount) ?? 0;
                    totals.SalesAmount = query.Sum(i => (decimal?)i.SalesAmount) ?? 0;
                }

                if (returnType == TotalsReturnType.ReturnAll || returnType == TotalsReturnType.ReturnPayments)
                {
                    totals.Commission     = query.Sum(i => (decimal?)i.Commission) ?? 0;
                    totals.CommissionPaid = query.Sum(i => (decimal?)i.CommissionPayed) ?? 0;
                    totals.PaymentsCount  = query.Sum(i => (int?)i.PaymentsCount) ?? 0;
                }
                return(totals);
            }
Пример #2
0
 public override AffiliateReportTotals GetAffiliateTotals(long affId, AffiliateReportCriteria criteria,
                                                          TotalsReturnType returnType)
 {
     using (var strategy = CreateStrategy())
     {
         var helper = new AffiliateReportHelper(this, strategy, criteria, 1, int.MaxValue);
         return(helper.GetAffiliateTotals(affId, returnType));
     }
 }
 public abstract AffiliateReportTotals GetAffiliateTotals(long affId, AffiliateReportCriteria criteria,
                                                          TotalsReturnType returnType);
 public abstract AffiliateReportTotals GetTotalsByFilter(AffiliateReportCriteria criteria,
                                                         TotalsReturnType returnType);