Export (0) Print
Expand All

Northwind Smart Client Sample

Download sample

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005

    -or-

    Visual Studio Team System

  • Microsoft Office 2003

This sample uses Microsoft Visual Studio 2005 Tools for the Microsoft Office System and Microsoft Office 2003 applications to duplicate many of the features that are available in the sample Microsoft Office Access database called Northwind. The sample includes the following features:

  • Northwind Catalog template. This Excel template is used by customers to browse the different product offerings of the Northwind Supply Company. The template retrieves product information from the SQL Server Northwind database by calling the Northwind Web service. Using this template, customers can purchase different products, view and update their orders, and complete their orders with shipping information. The workbook retains information about the order between uses to enable the customer to use the catalog offline.

    NoteNote

    The template does not retrieve orders that have already been submitted; it only creates and edits new orders.

  • Northwind Web service. After customers complete their orders they click Checkout, which submits the order to the Northwind Web service. The Web service adds the order information to the Northwind Order Rollup workbook and returns an Order ID.

  • Northwind Order Rollup workbook. This Excel workbook provides a consolidated view of all the new orders that are submitted through the Northwind Catalog and Northwind Web service. Users can track the company’s order history to see which products are being purchased, who is purchasing them, how often they are purchased, and how much is purchased.

  • Northwind Web site. Users can view a list of all orders that have been submitted to the Northwind Web service from an ASPX page. This page reads data from the Northwind Order Rollup workbook. Users can select an order and click the Create Invoice button to write the data for that order into a new document made from the Northwind Invoice template. They can also view invoices that have already been created by clicking View Invoice.

  • Northwind Invoice template. This Word template is used by employees of the Northwind Supply Company to create invoices for customers. When an employee opens the template, the invoice for the data is created if data has already been added to the data cache by the Northwind Web site. If there is no data in the data cache, a Windows Form is displayed and the user can select which customer and which order to create the invoice for. The Northwind Invoice template then creates an invoice from data in the Northwind Order Rollup workbook.

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

For information about installing the sample project on your computer, see How to: Download Sample Files in Help Topics.

To run this sample

  1. In the App_Code subfolder of the NorthwindWebService project, open the file Service.vb (in Visual Basic) or Service.cs (in C#).

  2. Find the comment that is labeled TODO:.

  3. Change the value of the workbookLocation variable to point to the installation location of the sample.

  4. In the NorthwindWebSite project, open the file Default.aspx.vb (in Visual Basic) or Default.aspx.cs (in C#).

  5. Find the two comments that are labeled TODO:.

  6. Change the values of the invoiceDirectory and workbookLocation variables to point to the installation location of the sample.

  7. Select the project NorthwindInvoice.

  8. On the Project menu, click NorthwindInvoice Properties.

  9. Click the Settings tab.

  10. On the Settings page, change the value of RollupLocation to point to the location of NorthwindOrderRollup.xls on your computer.

  11. Press F5.

  12. On the actions pane, select a category of products.

  13. Select a product in the worksheet and then click Order.

  14. Type a positive number in the dialog box and then click OK.

  15. On the actions pane, click View Cart.

    You can delete a product from the order or change the quantity.

  16. Click Continue Shopping to add more products to the order.

    — or —

    Click Checkout to finish the order.

  17. Type the shipping information in the dialog box and then click OK to submit the order.

    The order is submitted to the Northwind Web service.

  18. To view order history for all products, open the Northwind Order Rollup workbook and view the reports that are available on the actions pane.

  19. To create an invoice for an order, open the Northwind Web site, click an Order ID, and then click Create Invoice.

    The Northwind Web site reads the order data from the data cache in the Northwind Order Rollup workbook and saves it in a new document created from the Northwind Invoice template.

  20. To view the invoice, click View Invoice on the Web page.

    — or —

    Open the new Word document in the NorthwindInvoice\bin or NorthwindInvoice\bin\Debug folder.

  21. To create another invoice, open the Northwind Invoice template, select a Customer and an Order ID, and then click OK.

Requirements

  • The SQL Server database Northwind.

Demonstrates

  • Reading data from a SQL Server database.

  • Data binding lists on protected worksheets.

  • Using Windows Forms.

  • Using the actions pane.

  • Caching datasets.

  • Caching custom business objects.

  • Server-side processing of Visual Studio Tools for Office documents

  • Using Word XMLNodes host controls.

  • Using Excel data validation.

  • Determining whether the current client machine is online or offline.

  • Calling a Web service.

See Also

Community Additions

ADD
Show:
© 2015 Microsoft