Exemplo n.º 1
0
        public BasicBar <int?> GetSalesPerProduct(int[] productList, DateTime?begin, DateTime?end)
        {
            BasicBar <int?> chart = new BasicBar <int?>();

            DAL.SalesPerProduct[] query
                = repo.GetSalesPerProduct(productList, begin, end);

            string[] stores = GetStoreList(query);

            //Getting the list of years
            string[] products = query
                                .OrderBy(r => r.Product)
                                .Select(r => r.Product)
                                .Distinct().ToArray();

            chart.Categories = products;

            foreach (var store in stores)
            {
                Serie <int?> serie = new Serie <int?>()
                {
                    Name = store,
                    Data = new int?[products.Length]
                };

                for (int i = 0; i < products.Length; i++)
                {
                    int?value = query
                                .Where(r => r.Store == store && r.Product == products[i])
                                .Select(r => r.Total)
                                .FirstOrDefault();

                    serie.Data[i] = value;
                }

                chart.Series.Add(serie);
            }

            return(chart);
        }
Exemplo n.º 2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            var sample = new BasicBar();

            sample.ShowDialog();
        }