/*This handles the initial order view propogating the page with customer information and item information
         * required for each order. (Quantities of items are handled in the ALOHASystem.js file using jQuery
         * */
        public ActionResult OrderView()
        {
            ovm = new OrderCartViewModel();
            OrderViewModel info = new OrderViewModel();
            DataSet CustomerIDs = new DataSet();
            DataSet ItemInfo = new DataSet();
            CustomerIDs = ac.getCustomerInfo();
            ItemInfo = ac.getItemInfo();

            foreach(DataTable customer in CustomerIDs.Tables)
            {
                foreach (DataRow row in customer.Rows)
                {
                    info.CustomerID.Add(Convert.ToInt32(row["ID"]));
                }
            }

            foreach (DataTable item in ItemInfo.Tables)
            {
                foreach (DataRow row in item.Rows)
                {
                    info.lstItemOrderViewModel.Add(new ItemOrderViewModel()
                        {
                            Name = Convert.ToString(row["itemName"]),
                            Price = Convert.ToDecimal(row["Price"]),
                            Quantity = Convert.ToInt32(row["Quantity"]),
                            ProductID = Convert.ToInt32(row["ID"])
                        });
                }
            }
            return View(info);
        }
        /*This creates a partial view on the CustomerFindOrderView. This allows for two seperate buttons to be pressed.
         * One checks for orders based on customerID and the other checks for orders based on orderID.
         * */
        public PartialViewResult OrderSearch(string button)
        {
            //Searching by customer ID
            if (button == "Search by Customer ID")
            {
                ovm = new OrderCartViewModel();
                DataSet orderInfo = new DataSet();
                int customerID = Convert.ToInt32(Request.Form["CustomerID"]);
                orderInfo = ac.findOrderInfobyCustomer(customerID);

                foreach (DataTable item in orderInfo.Tables)
                {

                    foreach (DataRow row in item.Rows)
                    {
                        ovm.lstOrderedInfo.Add(new FindOrderInfo()
                        {
                            orderID = Convert.ToInt32(row["orderID"]),
                            itemName = Convert.ToString(row["itemName"]),
                            itemPrice = Convert.ToDecimal(row["itemPrice"]),
                            itemQuantity = Convert.ToInt32(row["itemQuantity"]),
                            date = Convert.ToString(row["date"]),
                            status = Convert.ToString(row["orderStatus"])
                        });
                    }
                }

                return PartialView("_searchOrder", ovm);
            }
            //search by order ID
            else if (button == "Search by Order ID")
            {
                ovm = new OrderCartViewModel();
                DataSet orderInfo = new DataSet();
                int orderID = Convert.ToInt32(Request.Form["OrderID"]);
                orderInfo = ac.findOrderInfobyOrder(orderID);

                foreach (DataTable item in orderInfo.Tables)
                {

                    foreach (DataRow row in item.Rows)
                    {
                        ovm.lstOrderedInfo.Add(new FindOrderInfo()
                        {
                            orderID = Convert.ToInt32(row["orderID"]),
                            itemName = Convert.ToString(row["itemName"]),
                            itemPrice = Convert.ToDecimal(row["itemPrice"]),
                            itemQuantity = Convert.ToInt32(row["itemQuantity"]),
                            date = Convert.ToString(row["date"]),
                            status = Convert.ToString(row["orderStatus"])
                        });
                    }
                }
                return PartialView("_searchOrder", ovm);
            }
            else
                return PartialView("_searchOrder");
        }