private void simpleButton1_Click(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) { case 0: { IEnumerable<TotalAmountSalesByYear> wTotalAmountSalesByYear; using (TotalAmountSalesByYearDataContext dc = new TotalAmountSalesByYearDataContext()) { wTotalAmountSalesByYear = from s in dc.TotalAmountSalesByYears select s; totalAmountSalesByYearBindingSource.DataSource = wTotalAmountSalesByYear; } propertyGrid1.SelectedObject = this.chartControl1; break; } case 1: { IEnumerable<TotalAmountByProductByYear> wTotalAmountByProductByYear; using (TotalAmountByProductByYearDataContext dc = new TotalAmountByProductByYearDataContext()) { int[] productList = new int[] { 707, 708, 715 ,717 }; wTotalAmountByProductByYear = from s in dc.TotalAmountByProductByYears where productList.Contains(s.ProductID) select s; totalAmountByProductByYearBindingSource.DataSource = wTotalAmountByProductByYear; } break; } } }
private void simpleButton1_Click(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) { case 0: { IEnumerable <TotalAmountSalesByYear> wTotalAmountSalesByYear; using (TotalAmountSalesByYearDataContext dc = new TotalAmountSalesByYearDataContext()) { wTotalAmountSalesByYear = from s in dc.TotalAmountSalesByYears select s; totalAmountSalesByYearBindingSource.DataSource = wTotalAmountSalesByYear; } propertyGrid1.SelectedObject = this.chartControl1; break; } case 1: { IEnumerable <TotalAmountByProductByYear> wTotalAmountByProductByYear; using (TotalAmountByProductByYearDataContext dc = new TotalAmountByProductByYearDataContext()) { int[] productList = new int[] { 707, 708, 715, 717 }; wTotalAmountByProductByYear = from s in dc.TotalAmountByProductByYears where productList.Contains(s.ProductID) select s; totalAmountByProductByYearBindingSource.DataSource = wTotalAmountByProductByYear; } break; } } }