|
Listing 3. This .Net code implements the GetDiscountRate Web method. [WebMethod]
public double GetDiscountRate(int custID)
{
// this is an arbitrary implementation; real world
// implementations would look up the customer
// discount rates in a database
switch (custID % 4)
{
case 0:
return 0.00;
case 1:
return 0.05;
case 2:
return 0.10;
case 3:
return 0.15;
default:
throw new InvalidCastException(
"Modulo operation yielded bad value");
}
}
|