示例#1
0
        public static List <GameToReport> PrepareGamesToReport(DateTime dateFrom, DateTime dateTo)
        {
            var gamesToReport = new List <GameToReport>();
            var games         = new List <GameParams>();
            var orders        = DBController.GetOrdersParams(dateFrom, dateTo);

            foreach (var order in orders)
            {
                foreach (var game in order.games)
                {
                    games.Add(game);
                }
            }
            var groupedGames = from game in games group games by game.Name;

            foreach (var game in groupedGames)
            {
                gamesToReport.Add(new GameToReport()
                {
                    Name     = game.Key,
                    Quantity = game.Count(),
                    Price    = game.First().First().Price,
                    Total    = game.First().First().Price *game.Count()
                });
            }
            return(gamesToReport);
        }
示例#2
0
        public static List <OrderToReport> PrepareOrdersToReport(DateTime dateFrom, DateTime dateTo)
        {
            var ordersToReport = new List <OrderToReport>();
            var orders         = DBController.GetOrdersParams(dateFrom, dateTo);

            foreach (var order in orders)
            {
                ordersToReport.Add(new OrderToReport(order));
            }
            return(ordersToReport);
        }