Question on overview of C# OOP in business WinForms application - scope of Object
- by TimR
I may have all this OO completely wrong, but here goes:
Ok the scenario is a classic order entry.
Customer places an Order which has OrderLineItems of StockItems. Order is entered by Employee.
1) Application starts and asks for login/password
2) Employee selects 'Orders' from Mainmenu form
3) Orders forms opens....
4) Employee selects Customer
5) Employee selects Stock adds to OrderLineItems
6) Selects second StockItem; add to OrderLineItems
7) Order is committed, [stock decremented, order posted to DB, Order printed]
8) Employee is returned to MainMenu
Now with Object scope:
1) Application starts and asks for login/password
Is this the best place to make objEmployee, to be kept whilst in this whole Sales application?
2) Employee selects 'Orders' from Mainmenu form
3) Orders forms opens....
*Make objOrderHeader, is objEmployee able to be passed in or is it created here, or re-created here.*
4) Employee selects Customer - adds/edits Customer details if required...
Make objCustomer
5) Employee selects Stock adds to OrderLineItems...
*Make objStockItem and objOrderLineItem - add to objOrderLineItems_collection*
6) Selects second StockItem; add to OrderLineItems...
*Make objStockItem and objOrderLineItem - add to objOrderLineItems_collection*
7) Order is committed, [stock decremented, order posted to DB, Order printed, Order Entered By = EmployeeID]
Once posted to Db, all objects now redundant/garbage [except objEmployee?]
8) Employee is returned to MainMenu
is objEmployee still valid as an object?