public ActionResult SearchByCustName(string searchString1, string searchString2)
        {
            List <Order>       orderHist       = blc.SearchOrderHistoryByName(searchString1, searchString2);
            OrderViewModelList orderViewModels = blc.GetOrderViewModels(orderHist);

            return(View("CustOrderHistoryView", orderViewModels));
        }
예제 #2
0
        public ActionResult CustHistFromStore(string searchString1, string searchString2)
        {
            List <Order>       orderHist       = blc.SearchOrderHistoryByName(searchString1, searchString2);
            OrderViewModelList orderViewModels = blc.GetOrderViewModels(orderHist);

            return(View("CustomerPersonalHistory", orderViewModels));
        }
예제 #3
0
        /// <summary>
        /// makes an order
        /// ViewModelList based on the list of orders sent in.
        /// </summary>
        /// <param name="orderHist"></param>
        /// <returns></returns>
        public OrderViewModelList GetOrderViewModels(List <Order> orderHist)
        {
            List <OrderViewModel>    listToDefineOrderViewModelList = new List <OrderViewModel>();
            List <PurchasedProducts> purchasedProducts1             = rs.GetAllPurchasedProducts();

            foreach (var item in orderHist)
            {
                Customer cust = rs.GetCustById(item.CustomerId);

                OrderViewModel model = new OrderViewModel();
                model.cusomerName = cust.firstName + " " + cust.lastName;
                //string Fname = GetCustById(item.CustomerId).firstName;
                //string Lname = GetCustById(item.CustomerId).lastName;
                foreach (var x in purchasedProducts1) //need to regather the purchased products
                {
                    if (x.OrderId == item.OrderId)
                    {
                        foreach (var j in allProducts)
                        {
                            if (x.productId == j.ProductId)
                            {
                                if (j.productName == "Guitar")
                                {
                                    model.SetGuitarName("Guitar");
                                    model.guitarQty  += 1;
                                    model.totalPrice += j.productPrice;
                                }
                                if (j.productName == "Case")
                                {
                                    model.SetCaseName("Case");
                                    model.CaseQty    += 1;
                                    model.totalPrice += j.productPrice;
                                }
                                if (j.productName == "Amplifier")
                                {
                                    model.SetAmplifierName("Amplifier");
                                    model.amplifierQty += 1;
                                    model.totalPrice   += j.productPrice;
                                }
                                if (j.productName == "Strings")
                                {
                                    model.SetStringsName("Strings");
                                    model.stringsQty += 1;
                                    model.totalPrice += j.productPrice;
                                }
                            }
                        }
                    }
                }
                model.SetDateTime(item.dateTime);
                listToDefineOrderViewModelList.Add(model);
            }

            OrderViewModelList list = new OrderViewModelList();

            list.SetOrderViewModelList(listToDefineOrderViewModelList);
            return(list);
        }
예제 #4
0
        public OrderViewModelList GetOrdersByStoreLocationName(string storeLocationName)
        {
            StoreLocation store     = rs.GetStoreLocationsByName(storeLocationName);
            List <Order>  orderlist = rs.getOrdersByStoreId(store.StoreId);

            OrderViewModelList OVML = GetOrderViewModels(orderlist);

            return(OVML);
        }
        public ActionResult ListStoreOrderHistory(string SearchString)
        {
            OrderViewModelList orderViewModelList = blc.GetOrdersByStoreLocationName(SearchString);

            return(View("CustOrderHistoryView", orderViewModelList));
        }