Question on overview of C# OOP in business WinForms application - scope of Object

Posted by TimR on Stack Overflow See other posts from Stack Overflow or by TimR
Published on 2010-04-24T01:32:38Z Indexed on 2010/04/24 1:43 UTC
Read the original article Hit count: 281

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about oop