Example #1
0
        /// <summary>
        /// Gets the supplier info.
        /// </summary>
        /// <returns></returns>
        public ObservableCollection <SalesByDate> GetSalesInfo()
        {
            var sales = new ObservableCollection <SalesByDate>();
            int i     = 0;
            var r     = new Random();

            while (i < 60)
            {
                var salesByYear = new SalesByDate()
                {
                    Name = productName[r.Next(0, 45)],
                    QS1  = quartarSale[r.Next(0, 35)],
                    QS2  = quartarSale[r.Next(0, 35)],
                    QS3  = quartarSale[r.Next(0, 35)],
                    QS4  = quartarSale[r.Next(0, 35)],
                    QS5  = quartarSale[r.Next(0, 35)],
                    QS6  = quartarSale[r.Next(0, 35)],
                    Year = r.Next(2000, 2015),
                };
                salesByYear.Total = salesByYear.QS1 + salesByYear.QS2 + salesByYear.QS3 + salesByYear.QS4 + salesByYear.QS5 + salesByYear.QS6;
                sales.Add(salesByYear);
                i++;
            }

            return(sales);
        }
        public ObservableCollection <SalesByDate> GetSalesDetailsByDay(int days)
        {
            var collection = new ObservableCollection <SalesByDate>();
            var r          = new Random();

            for (var i = 0; i < days; i++)
            {
                var dt = DateTime.Now;
                foreach (var person in _salesParsonNames)
                {
                    if (r.Next(0, 3) == 0)
                    {
                        continue;
                    }
                    var s = new SalesByDate
                    {
                        Name = person,
                        QS1  = r.Next(100000, 1000000) * 0.01,
                        QS2  = r.Next(100000, 1000000) * 0.01,
                        QS3  = r.Next(100000, 1000000) * 0.01,
                        QS4  = r.Next(100000, 1000000) * 0.01,
                    };
                    s.Total = s.QS1 + s.QS2 + s.QS3 + s.QS4;
                    s.Date  = dt.AddDays(-1 * i);
                    collection.Add(s);
                }
            }
            return(collection);
        }