Ejemplo n.º 1
0
        private void BTNViewSales_Click(object sender, EventArgs e)
        {
            // För att se hur detta fungerar, gå till StatsForm-klassens dokumentation.
            Product selectedProduct = GetSelectedProductFromListView(ListViewProducts);

            if (selectedProduct != null)
            {
                List <Receipt> receiptsFound = receiptController.GetAllBetweenDates(
                    DateTimePickerFrom.Value.ToString("yyyyMMdd"),
                    DateTimePickerTo.Value.ToString("yyyyMMdd"));
                StatsForm statsForm = new StatsForm();
                statsForm.DrawSalesGraph(selectedProduct, receiptsFound);
                statsForm.Show();
            }
            else
            {
                MessageBox.Show("Select a product to view sales.");
            }
        }