Design ideas for this situation... should I use a design pattern of some sorts?
Posted on 2006-04-24
Okay, here is a situation that I have at work. The way it's designed now sucks bad, so i'm trying to re-design it so it's a lot more object oriented. I'm just in need of some opinions. This is purely an architecture question
Here it is:
In our application there are different situations when a user needs to submit data to an attorney. For example, the user might submit sales information, or the user might submit Cure information. There are other situations like this, but we'll take these 2 as an example.
What happens is when the user submits, say, sales information, 4 or 5 values are sent through a web service and that web service calls a stored procedure to store those values into the attorney database. There are 2 or 3 different attorneys that all use instances of this database. So CMS uses this database (it's called FIPS) and HAS also uses FIPS, but these attorneys are in different locales so my web service has to determine which attorney to submit this data to. This is done via a value on the client end. If the value is "CMS" then the IP address for the web service is xxx.xxx.xxx.xxx, but if the value is "HAS" then the web service IP address is yyy.yyy.yyy.yyy There can be any number of attorneys that use this "FIPS" database in the future, so this needs to be flexible. IE: when a new attorney signs up and uses the FIPS database, I don't want to have to go to every client and write some conditional logic to accomidate for the new FIPS user.
There is one other situation. Some attorneys don't want to use FIPS but they want an email to be sent when the client submits data (for example, sales data). So if the value in the database on the client end is "OSB" the an email needs to be sent to that attorney instead of pushing data through a web service.
1.) User clicks Submit Sales Information
2.) Is this an "OSB" attorney?
3.) If so, then generate an email and in that email include the 4 or 5 sales related fields
4.) If not then get the attorney code ("CMS", "HAS"...etc)
5.) Based on the attorney code set the IP in the web service to the correct IP and submit data directly into FIPS (database)
This can all be done rather easily using conditional logic (which is how it's setup right now) But I am aiming for a really flexible solution. One that allows me to submit other data in the future with relative ease (ie: right now we might not submit Withdrawal information to the attorney, but it could happen in the future) Also, when a new attorney uses the FIPS database I want it to be as easy as possible to add this new attorney.
Any ideas on design patterns, or any other suggestions? I am open to anything.