Exemplo n.º 1
0
        public Bill(Models.Bill bill)
        {
            Summary = new Summary
            {
                BillDate = bill.Statement.Generated,
                DueDate = bill.Statement.Due,
                From = bill.Statement.Period.From,
                To = bill.Statement.Period.To,
                Total = bill.Total
            };

            Package = new Package
            {
                Total = bill.Package.Total,
                Subscriptions = bill.Package.Subscriptions.Select(x => new Subscription
                {
                    Name = x.Name,
                    Type = x.Type,
                    Cost = x.Cost
                }).ToList()
            };

            CallCharges = new CallCharges
            {
                Total = bill.CallCharges.Total,
                Calls = bill.CallCharges.Calls.Select(x => new Call
                {
                    Called = x.Called,
                    Duration = x.Duration,
                    Cost = x.Cost
                }).ToList()
            };

            SkyStore = new SkyStore
            {
                Total = bill.SkyStore.Total,
                BuyAndKeep = bill.SkyStore.BuyAndKeep.Select(x => new Movie {Title = x.Title, Cost = x.Cost}).ToList(),
                Rentals = bill.SkyStore.Rentals.Select(x => new Movie {Title = x.Title, Cost = x.Cost}).ToList()
            };
        }
 private static Series GetCallsSeriesData(CallCharges callCharges)
 {
     return new Series
     {
         Name = "Calls",
         Data = new Data(callCharges.Calls
             .GroupBy(call => call.Called)
             .Select(callGroup =>
                 new Point
                 {
                     Name = callGroup.Key,
                     Y = ConvertNumber(callGroup.Sum(call => call.Cost))
                 })
             .ToArray())
     };
 }
 public static Highcharts GetCallsChart(CallCharges callCharges)
 {
     return BuildPieChart("CallChargesChart", GetCallsSeriesData(callCharges),
         @"{point.name}: £{point.y:.2f}",
         @"<span style=""color:{point.color}"">{point.id}</span><br/>");
 }