protected void MakeChartUmsatz() { DataClasses1DataContext con = new DataClasses1DataContext(); var Customer1 = from cust in con.Customer select cust.Id; foreach (Guid custId in Customer1) { var orders = (from ord in con.Order where ord.CustomerId == custId && ord.Status == 900 select ord).ToList(); var customerName = con.Customer.SingleOrDefault(q => q.Id == custId).Name; double sum = 0; if (orders.Count > 0) { Telerik.Charting.ChartSeries chartUmsatz = new Telerik.Charting.ChartSeries(customerName); foreach (Order order in orders) { foreach (OrderItem item in order.OrderItem) { if (!item.IsAuthorativeCharge && item.Status == 900) { sum = sum + Convert.ToDouble(item.Amount); } } } chartUmsatz.AddItem(sum); umsatzProKundeChart.Series.Add(chartUmsatz); } } }
protected void MakeChartAnzahl() { //making pie DataClasses1DataContext con = new DataClasses1DataContext(); var Customer1 = from cust in con.Customer select cust.Id; foreach (Guid custId in Customer1) { var order = con.Order.Count(q => q.CustomerId == custId && q.Status == 900); if (order != 0) { var customerName = con.Customer.SingleOrDefault(q => q.Id == custId).Name; Telerik.Charting.ChartSeries chart = new Telerik.Charting.ChartSeries(customerName); chart.AddItem(order); anzahlChart.Series.Add(chart); } } }