示例#1
0
        public IActionResult ShowReportChoice(string routeName)
        {
            ViewData["routeName"] = routeName;
            SystemR.GetAllOrdersFromFile();

            ViewData["totalNumberOFOrders"] = SystemR.systemManager.GetOrdersByRoute(routeName).Count;
            ViewData["numberOfCanceled"]    = SystemR.systemManager.GetOrdersByRoute(routeName).Where(x => x.status == Status.Canceled).ToList().Count;
            ViewData["numberOfNotOnTime"]   = SystemR.systemManager.GetOrdersByRoute(routeName).Where(x => x.status == Status.NotOnTime).ToList().Count;
            double success = Convert.ToDouble(SystemR.systemManager.GetOrdersByRoute(routeName).Where(x => x.status == Status.Delivered).ToList().Count.ToString());
            double total   = Convert.ToDouble(SystemR.systemManager.GetOrdersByRoute(routeName).ToList().Count.ToString());
            double percent = success / total * 100;

            Console.WriteLine(percent);
            ViewData["percent"] = percent;
            return(View(SystemR.systemManager.GetOrdersByRoute(routeName)));
        }
示例#2
0
        public IActionResult Sorting(int parameter, string routeName)
        {
            ViewData["routeName"] = routeName;
            SystemR.GetAllOrdersFromFile();

            ViewData["totalNumberOFOrders"] = SystemR.systemManager.GetOrdersByRoute(routeName).Count;
            ViewData["numberOfCanceled"]    = SystemR.systemManager.GetOrdersByRoute(routeName).Where(x => x.status == Status.Canceled).ToList().Count;
            ViewData["numberOfNotOnTime"]   = SystemR.systemManager.GetOrdersByRoute(routeName).Where(x => x.status == Status.NotOnTime).ToList().Count;
            double success = Convert.ToDouble(SystemR.systemManager.GetOrdersByRoute(routeName).Where(x => x.status == Status.Delivered).ToList().Count.ToString());
            double total   = Convert.ToDouble(SystemR.systemManager.GetOrdersByRoute(routeName).ToList().Count.ToString());
            double percent = success / total * 100;

            Console.WriteLine(percent);
            ViewData["percent"] = percent;
            switch (parameter)
            {
            case 1:
                return(View(SystemR.systemManager.GetOrdersByRoute(routeName).OrderBy(x => x.category)));

                break;

            case 2:
                return(View(SystemR.systemManager.GetOrdersByRoute(routeName).OrderBy(x => x.amount)));

                break;

            case 3:
                return(View(SystemR.systemManager.GetOrdersByRoute(routeName).OrderBy(x => x.status)));

                break;

            case 4:
                return(View(SystemR.systemManager.GetOrdersByRoute(routeName).OrderBy(x => x.date)));

                break;

            case 5:
                return(View(SystemR.systemManager.GetOrdersByRoute(routeName).OrderBy(x => x.sum)));

                break;

            default:
                return(View(SystemR.systemManager.GetOrdersByRoute(routeName)));

                break;
            }
        }