Esempio n. 1
0
        public void GetAllOrders()
        {
            LineSeparator line      = new LineSeparator();
            List <Order>  orderList = _orderBL.GetOrders();

            foreach (Order order in orderList)
            {
                line.LineSeparate();

                Console.WriteLine($"| Order ID: {order.OrderID} | Order Date: {order.OrderDate} | Customer ID: {order.CustomerID} | Location ID: {order.LocationID}");
                //Console.WriteLine(order.OrdersWithCustomers());
                line.LineSeparate();
            }
            line.LineSeparate();
        }
Esempio n. 2
0
 public void GetOrders()
 {
     foreach (var item in _orderBL.GetOrders())
     {
         Console.WriteLine(item.OrderID);
     }
 }
 public void GetOrders()
 {
     foreach (var element in _orderBL.GetOrders())
     {
         Console.WriteLine(element.OrderID);
     }
 }
        // GET: OrderController
        public ActionResult Index(int id)
        {
            ViewBag.cust = _custBL.GetCustomerById(id);

            List <Orders> orderList = _orderBL.GetOrders(_custBL.GetCustomerById(id));

            return(View(orderList
                        .Select(Orders => new OrderVM(Orders))
                        .ToList()));
        }
        public void GetSearchedCustomers(string searchTerm)
        {
            int             tracker           = 0;
            LineSeparator   line              = new LineSeparator();
            List <Customer> customerList      = _customerBL.GetCustomers();
            List <Order>    orderList         = _orderBL.GetOrders();
            List <Order>    filteredOrderList = new List <Order>();
            Customer        firstCustomer     = new Customer();

            foreach (Customer customer in customerList)
            {
                if (customer.FName.Contains(searchTerm) || customer.LName.Contains(searchTerm) || customer.CustomerID.ToString().Contains(searchTerm))
                {
                    line.LineSeparate();
                    Console.WriteLine(customer);
                    tracker++;

                    if (tracker == 1)
                    {
                        firstCustomer = customer;
                        foreach (Order o in orderList)
                        {
                            if (o.CustomerID == firstCustomer.CustomerID)
                            {
                                filteredOrderList.Add(o);
                            }
                        }
                    }
                }
            }

            if (tracker == 0)
            {
                line.LineSeparate();
                Console.WriteLine("No results found! Please double-check customer name spelling. \nReminder: This search system is Case Sensitive :)");
            }
            if (tracker == 1)
            {
                line.LineSeparate();
                Console.WriteLine("Single customer found! Here is a detailed view of customer information: ");
                line.LineSeparate();
                Console.WriteLine(firstCustomer.ToString());
                line.LineSeparate();
                Console.WriteLine("Customer order history: ");
                foreach (Order o in filteredOrderList)
                {
                    line.LineSeparate();
                    Console.WriteLine(o.ToString());
                }
            }

            line.LineSeparate();
        }
Esempio n. 6
0
        public void PrevCustOrdersNewToOld(int custId)
        {
            bool ordersFound = false;

            foreach (var item in _orderBL.GetOrders())
            {
                if (item.CustomerId == custId)
                {
                    ordersFound = true;
                }
            }

            if (!ordersFound)
            {
                Console.WriteLine("No orders have been placed.");
            }
            else
            {
                foreach (Order order in _orderBL.GetOrders().OrderByDescending(o => o.Date).ToList())
                {
                    if (order.CustomerId == custId)
                    {
                        Console.WriteLine(order.ToString());
                    }
                }
            }
        }