In this lab we add a Recommendation System to the PVFC System which we prepared up till lab 7. We created a separate ASP.NET Core Web API to handle the recommendation logic and the Web Forms frontend calls it using Microsoft.Data.SqlClient and Newtonsoft.Json.
| Endpoint | Purpose |
|---|---|
| /api/recommendations/{productId} | Products that are usually frequently bought with the given product |
| /api/reorder/{customerId} | Products that have been previously ordered by the customer |
| /api/forecast/{productId} | Top 5 secondary/other items that are purchased with a primary product with demand score |
1. Product Recommendations (search.aspx)
Each product card now has a "Show Recommendations" button which will call the API and display related products in a list.
2. Reorder Suggestions (Cart.aspx)
A button on the cart page calls the reorder API and shows all the products the customer has previously ordered.
3. Inventory Forecasting (employee_dashboard.aspx)
Employee enters a Product ID and clicks "Forecast Demand". A GridView will show secondary products.
| # | Test Case | Expected Output |
|---|---|---|
| 1 | Recommendations for a product with some order history | BulletedList will show related products |
| 3 | Reorder for customer with some previous orders | BulletedList will show previously ordered products |
| 4 | Forecast with valid Product ID | GridView will show products and demand scores |
| 6 | Forecast with non-numeric input | It will say "Product ID must be a number." |
| 7 | Unauthorized access to employee dashboard | User is redirected to EmployeeLogin.aspx |