public ManageProducts() { InitializeComponent(); dbContext = new PokeMartEntities(); comboBoxType.DataSource = dbContext.Types.ToList(); comboBoxType.DisplayMember = "Name"; comboBoxType.ValueMember = "Id"; }
public Till() { InitializeComponent(); TransactionTotal = 0; dbContext = new PokeMartEntities(); products = new BindingList <Product>(); listBoxProductList.DataSource = products; listBoxProductList.DisplayMember = "Name"; CreateTypeTabs(); AddProductsToTabs(); }
private void generateGraph() { using (PokeMartEntities dbContext = new PokeMartEntities()) { var query = from product in dbContext.SaleProducts group product by product.Product1.Name into g select new { ProductId = g.Key, TotalUnitsSold = g.Count() }; chart1.DataSource = query.ToList(); chart1.Series["Series1"].XValueMember = "ProductId"; chart1.Series["Series1"].YValueMembers = "TotalUnitsSold"; chart1.ChartAreas[0].AxisX.LabelStyle.Angle = -90; chart1.ChartAreas[0].AxisX.LabelStyle.Interval = 1; chart1.Series["Series1"].Name = "Products"; chart1.DataBind(); chart1.Show(); } }