Previous Table of Contents Next


After the customer finishes editing the double-clicked line, he selects the OK button next to it to move the new line back into the personal profile data display, where it overwrites the old line. Here is the done handler:

void CSmartShopperDlg::OnEditppdone()
{
    CListBox *pBox;
    CString item;
    CEdit *eBox;
    int i;

    pBox = (CListBox *)GetDlgItem(IDC_PP);
    eBox = (CEdit *)GetDlgItem(IDC_EDITPP);
    eBox->GetWindowText(item);
    i = item.GetLength();
    memcpy(seltext, (LPCTSTR)item, min(i,24));
    for(i = item.GetLength(); i < 24; i++) seltext[i] = ' ';
    seltext[24] = '\0';
    pBox->DeleteString(selitem);
    pBox->InsertString(selitem, seltext);
    pBox->SetItemData(selitem, 1); // mark item as changed
}

When all items that were to be updated have been updated, the user selects the Save Personal Profile button to write the changed records back to the Smart Shopper card. Here is the editing completion handler:

void CSmartShopperDlg::OnPpdone()
{
    CListBox *pBox;
    CString item;
    BYTE buffer[30];
    BYTE i;

    pBox = (CListBox *)GetDlgItem(IDC_PP);
    SelectFile(0x0100);
    for(i = 0; i < 10; i++) {
        if(pBox->GetItemData(i)) {
            pBox->GetText(i, item);
            memcpy(buffer, (LPCTSTR)item, 24);
            UpdateRecord(i+1, 4, 24, buffer, 0, 0);
        }
    }
    pBox->ResetContent();
}

Finally, the user can select the Examine Frequent Buyer Points button to view the number of frequent buyer points accumulated in each Frequent Buyer Points program on the card. When this button is selected, the Card Management Utility first reads the administration file, which contains the name of the participating merchant in each of the merchant directories. Then the Card Management Utility goes into each of the installed merchant directories, reads the current record in the frequent buyer points file and displays what it finds next to the merchant’s name. Here’s the code that displays frequent buyer point totals on the card:

void CSmartShopperDlg::OnGetfbp()
{
    CListBox *pBox;
    char s[100], *sp = s, *nsp;
    char t[100], v[20];
    int i, merchant, value;

    pBox = (CListBox *)GetDlgItem(IDC_FBPLIST);
    SelectFile(0x3F00);
    SelectFile(0x0F00);
    ReadBinary(0, 100);
    memcpy(s, DATA, 100);
    for(i = merchant = 0; i < 5; i++) {
        if((nsp = strchr(sp, '#')) == 0) {
            break;
        } else if(nsp-sp>1) {
            memset(t, ' ', 30);
            memcpy(t, sp, nsp-sp);
            SelectFile(4096*(i+1));
            if(SelectFile(4096*(i+1)+2)) {
                ReadRecord(0, 4, 6);
                value = DATA[2]<< 24 | DATA[3]<<16 |
                                DATA[4]<< 8 | DATA[5];
                sprintf(v, "%6d", value);
                memcpy(t+20, v, 7);
                t[27] = '\0';
                pBox->InsertString(merchant, t);
                pBox->SetItemData(merchant, 1000*(i+1));
                merchant++;
            }
        }
        sp = nsp+1;
        SelectFile(0x3F00);
    }
}

If you can think of ways to customize the Smart Shopper card Management Utility, get its code from the CD-ROM and start working!

Summary

This chapter describes a multimerchant smart card program, focusing primarily on the design of the smart card itself and the supporting application software. The intent is to show the design considerations that are characteristic of including a smart card in a consumer-oriented system. This chapter also discusses issues and concerns facing all smart card program stakeholders—card issuer, merchants and customers.


Previous Table of Contents Next