How to go about designing this module?

How to go about designing this module?

Old forum URL: forums.lhotka.net/forums/t/4944.aspx


Shailesh posted on Friday, June 06, 2008

I have a screen where there are 3 dropdowns: role,client and assignment.

The display of the dropdowns client and assignment depends on the selection of values in the role dropdown i.e for some roles the client/assignment dropdowns should be invisible..

Also to be noted that this visibility data does not come from database.It has to be somewhere stored in our code...

So client and assignment becomes conditional fields depending on the role selected.So can you suggest some ways to design this business object?

 And where to store the visibility values of client and assignment dropdowns for UI ?

Lalit replied on Friday, June 06, 2008

Hi Shailesh,

Can you please tell me that from where that data will come? Are they stored in some DB or are Enums?

If you are fetching data from DB, i will suggest you to define ReadOnlyListBase classes for Role, Client and Assignment. Client and Assignment may have a method which will take Role value as argument. Depending upon role passed you may alter your list and return the same. This will work like a view of your complete list. Now on selection change of Role drop down you can call this method to fetch a view of your list depending upon the selected role and can bind this view with your drop down at run time.

Shailesh replied on Friday, June 06, 2008

Thanks Lalit for your quick reply.......

Yes , the value of roles,client and assignment does come for database.

But another one point I want to add i.e there is no relation between roles and client/assignment(The client and assignment values are same for all roles irrespective of selection of role).All are independent entities.Just that for some roles we need to show the client and assignment dropdowns.

This visibility values are not stored in database currently.So it has to be stored somewhere may be in Enum in the business object.

Just was thinking in the lines where we can have the visibility values for each roles also coming from the business object  which is used to  load the role dropdown so that we can avoid a postback for onchange. (we can store this additional visiblity values may be in value part of dropdown)

Other way can be...we can have some helper methods which returns this visibility property callled 'onchange' event of role dropdown.

Please suggest on the right way to implement this on terms of CSLA.......

Thanks in advance

Copyright (c) Marimer LLC