Changes to the main menu to control for active customer. Added a menu item to delete products from a customer unless it is in an active order
Steps to Test
Outline the steps to test
git fetch --all
git checkout km-remove-products
cd bangazon-cli.Tests
dotnet restore
dotnet test
Console App Test
In the dev database, run the following SQL and write changes
DELETE FROM OrderProduct;
DELETE FROM `Order`;
DELETE FROM Product;
DELETE FROM PaymentType;
DELETE FROM Customer;
INSERT INTO Customer VALUES (null,"DELETE_ME","Street","City","State","PostalCode","PhoneNumber");
INSERT INTO Product
SELECT null,
c.Id,
"DELETE_PRODUCT",
25.00,
"A PRODUCT TO DELETE",
1
FROM Customer c
WHERE c.Name = "DELETE_ME";
INSERT INTO Customer VALUES (null,"DELETE_ME_2","Street","City","State","PostalCode","PhoneNumber");
INSERT INTO Product
SELECT null,
c.Id,
"DELETE_PRODUCT_2",
25.00,
"A PRODUCT TO DELETE",
1
FROM Customer c
WHERE c.Name = "DELETE_ME_2";
DELETE FROM `Order` WHERE CustomerId = (SELECT c.Id FROM Customer c WHERE c.Name = "DELETE_ME_2");
INSERT INTO `Order`
SELECT null,
c.Id,
null,
null
FROM Customer c
WHERE c.Name = "DELETE_ME_2";
INSERT INTO OrderProduct
SELECT null,
o.Id,
p.Id
FROM `Order` o, Product p
WHERE o.Id = (SELECT Id FROM`Order` WHERE CustomerId = (SELECT Id from Customer WHERE Name = "DELETE_ME_2"))
AND p.Name = "DELETE_PRODUCT_2";
#navigate to bangazon-cli project
dotnet run
Users are restricted to certain menus until they've selected an active customer
You should see only 3 options when the app starts (1,2, 10)
Selecting 10 exits the app
After assigning the active customer the remaining menus become visible
Delete products from users
Make DELETE_ME the active user (option 2 from main menu)
Select option 6 and attempt to delete the first item - it should be successful
Make DELETE_ME_2 the active user
Select option 6 - you should not be able to delete the item as it is on an order
Impacted Areas in Application
Program.cs
Menus/MainMenu.cs
Menus/DeleteActiveCustomerProducts
List general components of the application that this PR will affect:
Mentions @username
Tag users that need to review this code
Definition of Done
The project must be fully documented. This includes the following:
Complete README that documents the steps to install the code, how to install any dependencies, or system configuration needed.
Every class must be documented with purpose, author, and methods.
Every method must be documented with purpose and argument list - which itself must contain a short purpose for each argument.
The project must be able to run fully, and without errors, on each teammate's system.
Fulfills every requirement.
Every line of code has been peer reviewed.
For projects that require unit testing, core functionality must be identified and have at least one test for each.
Link to Ticket
Closes #7
Description of Proposed Changes
Changes to the main menu to control for active customer. Added a menu item to delete products from a customer unless it is in an active order
Steps to Test
Outline the steps to test
Console App Test
In the dev database, run the following SQL and write changes
Users are restricted to certain menus until they've selected an active customer
Delete products from users
Impacted Areas in Application
Mentions @username
Tag users that need to review this code
Definition of Done