| ThinkDigit Home |
|
||||||||||||
|
|||||||||||||
|
|||||||||||||
|
||||||||||||
|
This is an article continued from Developing a simple grocery inventory- Part 2. In this part we will be looking at the different groups of controls on the "Add/Delete" tab, looping through retrieved results and the "distinct" method in LINQ.
Continuing from the previous article, we will now see the controls on the Tab "Add/Delete" of the tab control.
Controls on Tab "Add/Delete"
This tab contains many controls but most of them have similar functions. The controls here are grouped according to their functionality. The controls are grouped according to those that perform addition of a new product, modification of details of an existing product, deletion of a product, show statistics of the inventory and a listbox control that shows all the products available in the inventory.
Add Product Group Controls
The Controls are grouped together in a GroupBox control named "Add Product"
1. cboCategory_Add - Combobox to hold categories.
2. txtName_Add, txtPrice_Add,txtReorderQuantity_Add,txtQuantity_Add - textbox controls to hold values for the new product.
3. btnAddProduct - A button to execute the LINQ statement to add the new product.
Delete Product Group Controls
The Controls are grouped together in a GroupBox control named "Delete Product"
1. txtID_Delete, txtCategory_Delete, txtQuantity_Delete, txtPrice_Delete - textbox controls to show values for the product to be deleted.
2. btnDeleteProduct - A button to execute the LINQ statement to delete the selected product.
Modify Product Group Controls.
The Controls are grouped together in a GroupBox control named "Modify Product"
1. cboCategory_Modufy - Combobox to hold categories.
2. txtID_Modify, txtName_Modify, txtPrice_Modify,txtReorderQuantity_Modify,txtQuantity_Modify - textbox controls to that hold values that are to be modified.
3. btnModifyProduct - A button to execute the LINQ statement to add the new product.
listBox_Products - list box which shows all available products in the inventory and through which you select products which you want to delete or modify.
lblTypesOfProducts, lblTotalProducts and lblReorderProducts - Labels which show the number of unique products, total quantity of all the products and the number of products that require reordering respectively.
Here, we will see more functionality of LINQ like inserting new records, deleting records, modifying records and also some more conditional retrieving of records.
Let's encapsulate code into functions which we will be using regularly.
Functions:
1. PopulateCategoryDropdownbox()
2. PopulateProductsListbox()
3. PopulateProductStatistics()(This method is covered in the next part
of the series)

|
|
| application, linq, series-linq, inventory |

