J
JohnR
Assume you have a grocery store application. An order consists of an order
header with the "customer" info, and multiple "item" records (one for each
thing they ordered). Now, in a regular DB application this is straight
forward stuff. However, I'd like some advice as to how to best take
advantage of classes to make a more flexible application.
I'm thinking about having a "order" class which would contain a "customer
class" instance and multiple "item class" instances. Each class would have
some good properties and methods associated with them. For example, a
method of the "item" class might be to display the total amount of that item
that has sold year-to-date.
What I envision is to create a runtime context menu that would appear when
you right click an instance of one of these classes. The context menu would
then give the user a choice of some nifty things they could do, based on the
methods available for the class.
The problem is that the easiest way to present data is to bind a datagrid to
the database. But what I'd like to do is somehow create the class instances
for the database records so that the datagrid actually contains the class
instance. I can then do a HitTestInfo and if the user clicks on a cell,
find out what class is in the cell and create the appropriate context menu
as described above.
Hopefully I was clear in my vision... Any ideas how one might organize
something like this???
Thanks.
header with the "customer" info, and multiple "item" records (one for each
thing they ordered). Now, in a regular DB application this is straight
forward stuff. However, I'd like some advice as to how to best take
advantage of classes to make a more flexible application.
I'm thinking about having a "order" class which would contain a "customer
class" instance and multiple "item class" instances. Each class would have
some good properties and methods associated with them. For example, a
method of the "item" class might be to display the total amount of that item
that has sold year-to-date.
What I envision is to create a runtime context menu that would appear when
you right click an instance of one of these classes. The context menu would
then give the user a choice of some nifty things they could do, based on the
methods available for the class.
The problem is that the easiest way to present data is to bind a datagrid to
the database. But what I'd like to do is somehow create the class instances
for the database records so that the datagrid actually contains the class
instance. I can then do a HitTestInfo and if the user clicks on a cell,
find out what class is in the cell and create the appropriate context menu
as described above.
Hopefully I was clear in my vision... Any ideas how one might organize
something like this???
Thanks.