public static List <Package> GetDelivered(DateTime startDate, DateTime finalDate)
        {
            var packages  = DataBaseManager.GetPackage();
            var delivered = packages.Where(t =>
                                           t.State.Equals("delivered") &&
                                           t.Deliver > startDate &&
                                           t.Deliver < finalDate)
                            .ToList();

            return(delivered);
        }
        // Generates xml with the top 25 selled products
        public static List <Product> GetTop25Products()
        {
            var top25    = new List <Product>();
            var products = DataBaseManager.GetProduct();

            while (top25.Count < 25 && products.Count > 0)
            {
                var top = products.MaxBy(t => t.Sells).First();
                top25.Add(top);
                products.Remove(top);
            }

            return(top25);
        }
Example #3
0
        // Generates xml with the delivered packages between two dates
        public static void GenerateDelivered(DateTime startDate, DateTime finalDate)
        {
            var delivered = DataBaseManager.GetDelivered(startDate, finalDate);

            GenerateXml(delivered, "Delivered.xml");
        }
Example #4
0
        // Generates xml with the packages ready to deliver in certain routeId
        public static void GenerateRoutes(long routeId)
        {
            var packages = DataBaseManager.GetRoutesReport(routeId);

            GenerateXml(packages, "Routes.xml");
        }
Example #5
0
        // Generates xml with the top 25 selled products
        public static void GenerateTop25Products()
        {
            var top25 = DataBaseManager.GetTop25Products();

            GenerateXml(top25, "Top25.xml");
        }