示例#1
0
        public ManageProducts()
        {
            InitializeComponent();

            dbContext = new PokeMartEntities();

            comboBoxType.DataSource    = dbContext.Types.ToList();
            comboBoxType.DisplayMember = "Name";
            comboBoxType.ValueMember   = "Id";
        }
示例#2
0
        public Till()
        {
            InitializeComponent();

            TransactionTotal = 0;
            dbContext        = new PokeMartEntities();
            products         = new BindingList <Product>();
            listBoxProductList.DataSource    = products;
            listBoxProductList.DisplayMember = "Name";

            CreateTypeTabs();
            AddProductsToTabs();
        }
示例#3
0
        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();
            }
        }