private void getGraph() { total = 0; axisX = chart1.ChartAreas[0].AxisX; axelLabelPos = 0.5; using (RetailShopDBEntities db = new RetailShopDBEntities()) { var query = from s in db.SalesOrders where s.Createdon.Year == year group s by s.Createdon.Month; foreach (var group in query) { total += group.Sum(x => x.Amt_Tendered); sum = double.Parse(group.Sum(x => x.Amt_Tendered).ToString("n")); mnth = monthName(group.Key); this.chart1.Series["Series1"].Points.Add(sum); customerLabel = axisX.CustomLabels.Add(axelLabelPos, axelLabelPos + 1, mnth); axelLabelPos = axelLabelPos + 1.0; } lblTotal.Text = " Total Sales = " + total.ToString("n"); } }
private void getYear() { listBox1.Items.Clear(); using (RetailShopDBEntities db = new RetailShopDBEntities()) { var query = from s in db.SalesOrders group s by s.Createdon.Year; foreach (var group in query) { listBox1.Items.Add(group.Key); } } }