DateTime.Now.Year - strCarYear) * 2000;
nReturn -= nDepreciation;
return Math.Max(0, nReturn);
}
This crude calculation establishes the base value of a Honda at $30,000 (unless it is a
Pilot, in which case, it is $40,000). Other makes of car have a base value of $20,000.
Depreciation is then subtracted from the car??™s base value at $2,000 per year of age.
CHAPTER 3 ?– THE MICROSOFT AJAX LIBRARY: MAKING CLIENT-SIDE JAVASCRIPT EASIER 50
Finally, you need to add a [ScriptService] attribute to the web service declaration. By
adding this tag to the web service, you??™re telling the ASP.NET 2.0 AJAX Extensions to create
a proxy object for the web service so that it is accessible via JavaScript.
[ScriptService]
public class CarService : System.Web.Services.WebService
The web service is complete and ready to be invoked from the client; now it??™s time to
create the web page that is going to call it. Open Default.aspx in the designer, and add a
ScriptManager element to the page by dragging it from the Toolbox and dropping it onto
the page designer. Now add three ASP.
Pages:
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105