M
mesut
hi colleagues,
I don't know if this is the right group for but it's in C# so I try.
I have a #3 procedural function called GetInfo.. and those are 3
overloaded methods. I would like to use the OOP approach to refactor
this.
The functions are working fine but I would like to have a OOP approach
can someone help me refactoring this??????
GeTInfo(System) -> returns mutiple records - Dataset
GeTInfo(System,Key) -> returns multiple records - Dataset
GeTInfo(System,Key,Value) -> returns 1 record - Returns String
new approach:
- I created 3 properties
- I deleted the parms in the Functions it looks like GetInfo()
Function:
GetInfo()
3 Properties:
public String System{ get; set; }
public String Key{ get; set; }
public String Value{ get; set; }
Approach:
my aspx page should set the property, it can just the System or it can
be System, Key or it can be System, Key , Value. and then call the
GetInfo() function. The problem I have is: how can I decide how my
SQL should look like in WHERE clause. Because the previous procedural
I passed them as parameter and then used them in the WHERE. But I had
3 functions then (overloaded Methods)... Now I have 1 method... but
how can I decided how my SQL the Where clause should look like?
SELECT Name, Address, Zipcode FROM AddressBOOK where XXXXXXXXXXXXXX
is it with if (propertySystem!= null) { //concat } If {propertyKey!=
null) {//concat}
etc etc.
can someone show the OOP approach?????? or the best practice...
thanks in advance,
mesut
I don't know if this is the right group for but it's in C# so I try.
I have a #3 procedural function called GetInfo.. and those are 3
overloaded methods. I would like to use the OOP approach to refactor
this.
The functions are working fine but I would like to have a OOP approach
can someone help me refactoring this??????
GeTInfo(System) -> returns mutiple records - Dataset
GeTInfo(System,Key) -> returns multiple records - Dataset
GeTInfo(System,Key,Value) -> returns 1 record - Returns String
new approach:
- I created 3 properties
- I deleted the parms in the Functions it looks like GetInfo()
Function:
GetInfo()
3 Properties:
public String System{ get; set; }
public String Key{ get; set; }
public String Value{ get; set; }
Approach:
my aspx page should set the property, it can just the System or it can
be System, Key or it can be System, Key , Value. and then call the
GetInfo() function. The problem I have is: how can I decide how my
SQL should look like in WHERE clause. Because the previous procedural
I passed them as parameter and then used them in the WHERE. But I had
3 functions then (overloaded Methods)... Now I have 1 method... but
how can I decided how my SQL the Where clause should look like?
SELECT Name, Address, Zipcode FROM AddressBOOK where XXXXXXXXXXXXXX
is it with if (propertySystem!= null) { //concat } If {propertyKey!=
null) {//concat}
etc etc.
can someone show the OOP approach?????? or the best practice...
thanks in advance,
mesut