The GiftCertificate Data Access Class

The GiftCertificate class serves two main purposes. First, it encapsulates the query necessary to retrieve a gift certificate's value. Second, it houses the query needed to redeem a gift certificate.

The gift certificate value retrieval functionality is implemented in the GetGiftCertificate Value method, which is shown in Listing 11.1.

Listing 11.1. The GetGiftCertificateValue Method
public decimal GetGiftCertificateValue( int GCID )
    decimal retval = 0;

    SqlConnection conn = new SqlConnection(ConnectionString);
    SqlCommand myCommand = new SqlCommand("Select * from GiftCertificates where GCID=" +
 GCID.ToString(), ...

Get Building e-Commerce Sites with the .NET Framework now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.