Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in c# . please keep in mind that I am a complete beginner. Review the code Open the InventoryMaintenance project You may need to

Code in c#. please keep in mind that I am a complete beginner.
Review the code
Open the InventoryMaintenance project
You may need to set the property of the .txt file to "Content" and "Copy Always" or "Copy if newer" in the file's properties window
Display the code for the InvItemList class and note that it contains a readonly property named DisplayText.
Display the code for the Inventory Maintenance form and review the code that loads the items in the combo box and the code that executes when the selected item in the combo box is changed.
Run the application and view the items in the combo box. Notice that nothing happens when you change the selected item. Exit the application.
Add code that sorts and filters the inventory items
Find the FillItemListBox() method in the Inventory Maintenance form. It starts by storing the selected value of the combo box in a variable named filter and declaring a local collection of InvItem objects named filteredItems.
Code an if/else statement that uses LINQ to query the class-level collection named invItems based on the value of the filter variable. The LINQ queries should also order the inventory items by Description. Assign the result of each LINQ query to the filteredItems collection. Note: You can use method-based queries or query expressions here.
Update the foreach statement so it loops through the local filteredItems collection rather than the class-level invItems collection.
Test the application to be sure it displays the items in alphabetical order and filters the items by price when the selected item in the combo box changes.
Add the following new item to the inventory: ItemNo: 4372639 Description: Creeping Phlox Price: 24.99 Notice that the new item is sorted so it appears alphabetically in the display. Use the combo box to show items whose price is between $10 and $50 and see that the new item is displayed. When youre done, exit the application.
Open the InventoryItems.txt file and see that the items arent in alphabetical order, and that the item you just added is the last item in the file
Add code that uses LINQ to find the inventory item to delete
Run the application, select the item you added and click Delete. Note that the confirmation message identifies the wrong item for deletion. Click Cancel and exit the application.
Display the btnDelete_Click() event handler in the Inventory Maintenance form and comment out the line of code that uses the selected index value of the ListView control to get the selected InvItem object from the invItems collection.
Add code that uses that selected index value to retrieve the display text of the selected item from the Items collection of the ListView control.
Use a LINQ query to get the selected InvItem object from the InvItems collection. The LINQ query should select the item whose DisplayText property is equal to the display text value you just retrieved. Note: To do this, you need to use the First() or FirstOrDefault() method. Because of that, you should code this as a method-based query.
Run the application and try to delete the item you added in step 4. This time, the confirm message should present the correct inventory item. Click OK to delete the item and exit the application STUDENT: FillItemListBox() Must have Correct Coding and Edit Code for btnDelete_Click according to directions above. I also have picture of my code I put provided but the code is incomplete and not functioning at all. Please help me fix the code to function correctly.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago