2.Rename the ID property and the other specified properties for each of the controls as in the lowing table: Default Name NameType of ControlOther Properties to Set from (in Figure 12-7)Properties DialogLabel1lblSearchLabelText = Enter Search Criteria: TextBox1txtSearchText BoxButton1btnSearchButtonText = Search 3.To rename properties for controls, use the Properties window as shown in Figure 12-8. Figure 12-84.After you make the changes shown in the table, the form should look similar to the one shownin Figure 12-9.271Case
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
Figure 12-9At this point, you re done with the user interface and can move on to writing the code. Building the Code ModulesIn this section, you write some routines to implement the functionality of the dashboard application. 1.Add the following importsstatements to the top of the WebForm1code segment (before thePublicClassWebForm1statement) so that you can import the namespaces for the variousobjects you will be using in the code. This allows you to refer to those objects in an abbreviatedfashion. Imports System.NetImports System.IOImports ExecutiveDashboard.AmazonImports ExecutiveDashboard.eBay2.Add the btnSearch_Clickevent to WebForm1. This event is called when the user fills in thesearch criteria and clicks the Search button. Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles btnSearch.Click This procedure will perform the search against Google, Amazon.com, and eBay and display the results in the browser insert some blank lines in the browser272Chapter
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
Figure 12-6Adding Controls to the FormNow, it s time to add the controls to the form. 1.Use the toolbox to add a label control, a text box control, and a button control towebform1.aspx, as illustrated in Figure 12-7. Figure 12-7270Chapter
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
Figure 12-4Figure 12-510.Click the Add Reference button to add a reference to the eBay API in your project. 11.At this point, the project should appear similar to what is shown in Figure 12-6.269Case
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
Adding References to the Web APIsThe next stage in building the dashboard application is to add Web references to the Google, Amazon.com, and eBay APIs. Perform the following steps to add these references. 1.Select Project.Add Web Reference. In the URL, specify the location of the Google WSDLfile(http://api.google.com/GoogleSearch.wsdl) and click the GO button. 2.Change the Web Reference Name to Googleso that you can use a shorter name in your project. An example of what the screen looks like at this point is shown in Figure 12-3. Figure 12-33.Click the Add Reference button to add a reference to the Google API to your project. 4.Next, add a reference to the Amazon.com API. 5.Just as before, select Project.Add Web Reference. In the URL, specify the location of theAmazon.com WSDLfile (http://webservices.amazon.com/AWSECommerceService/ AWSECommerceService.wsdl) and click the GO button. 6.Change the Web Reference Name to Amazonso that you can use a shorter name in your project. An example of this screen is shown in Figure 12-4.7.Click the Add Reference button to add a reference to the Amazon.com API to your program. 8.Add a reference to the eBay API. Again, select Project.Add Web Reference. In the URL, spec- ify the location of the eBay WSDLfile (http://developer.ebay.com/webservices/latest/ eBaySvc.wsdl) and click the GO button. 9.Change the Web Reference Name to eBayso that you can use a shorter name in your project. This screen is shown in Figure 12-5.268Chapter
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Inexpensive Web Hosting services
As the user scrolls down the browser window, results from Epinions (retrieved from Google) and fromeBay are also displayed. Examples of these screens are illustrated at the end of this chapter. At this point, you re ready to begin building the dashboard application. You can download the entire case study in Visual Basic .NET or C# from the Wrox Web site. In orderfor the downloaded version of the case study to work, you first copy the project to your Web server, such as c:inetpubwwwroot. You then need to refresh the Web references to the Google API, theAmazon.com API, and the eBay API from Visual Studio .NET by selecting the particular Web referenceand choosing the Refresh option. Finally, you need to specify your own account credentials in the sourcecode where indicated. Building the User InterfaceThe dashboard application is a simple example that does not require any database. You first create interface and write the code to make the interface work. Let s get started with the user interface. You use Visual Studio .NET to design the forms for the dashboard application. Creating the New ProjectThe first step in building the user interface for the dashboard application is to set up the new project. so, perform the following steps: 1.Open Visual Studio .NET. 2.Select File.New.Project. 3.Select Visual Basic for the Project Type, and ASP.NET Web Application for the Template. 4.Specify the Project Name as ExecutiveDashboard or another suitable name. An example of screen should appear at this point is shown in Figure 12-2. Figure 12-2267Case
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Inexpensive Web Hosting services
.The dashboard application is designed to allow users, such as business executives, to easilyretrieve product information and reviews from multiple sources. Business executives may wantto use the program to quickly review information about products they sell, as well as productssold by competitors. Other individuals, who are shopping for information about a productbefore making a purchase, can also benefit from the application. .Auser is able to fill in a search criteria and click a Search option on the screen. .The Amazon.com API is called to retrieve the first result in the electronics department that con- tains the specified search criteria. The URLcorresponding to the page is then retrieved so thephysical Amazon.com page can be loaded into the browser for display. .The Google API is called to retrieve the first result on the epinions.com domain that contains thespecified search criteria. By limiting the Google search to the epinions.com domain, the first resultis likely to be an exact or close match to the actual search criteria. After the URLis identified byGoogle, the contents of the physical Epinions page can be loaded into the browser for display. .The eBay API is called to retrieve a list of auctions that match the specified search criteria. Theapplication uses the eBay Sandbox test API, although the exact code would also work with thelive eBay site. .The results from the Amazon.com, Google, and eBay APIs are displayed in a single browser win- dow so the user can simply scroll down to view the search results. An example of the dashboardapplication showing a search based upon microsoft natural keyboard is shown in Figure 12-1. Figure 12-1266Chapter
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Inexpensive Web Hosting services
Case Study 2 ExecutiveDashboard ApplicationIn this chapter, you work through a case study that is referred to as the Executive DashboardApplication. The application is very simple in function, but it illustrates how easy it can be to com- bine multiple APIs together in a single program. This chapter discusses: .The design requirements for the dashboard application .Creating the user interface for the dashboard application in Visual Studio .NET .Creating the source code for the dashboard application in Visual Studio .NET .Integrating features from the Google API, the Amazon.com API, and the eBay API into the dashboard application .Touring the completed dashboard applicationIntroduction to the Executive Dashboard ApplicationThis chapter walks you through building a browser-based application referred to as the ExecutiveDashboard Application. The name of the application is not important, and it could also be appro- priately named Product Information Dashboard, or any other such name. What is important aboutthe dashboard application is that it illustrates how to combine results from Amazon.com, Google, and eBay API calls into your own custom program. Let s look at the basic requirements of the application and a sample screen to give you an idea ofhow it works:
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Inexpensive Web Hosting services
After the user specifies the starting address, the MapPoint API is then called to retrieve the exact coordi- nates of the starting and ending addresses as well as driving directions using those exact coordinates. Aform displaying the driving directions from the starting location to the address of the contact is thenshown, as you can see in Figure 11-21. Figure 11-21To navigate among the Contact records, the user clicks a button from the navigation pane, as shown inFigure 11-22. For example, he can navigate to the first contact record, the previous one, the next one, andthe last one. If he attempts to navigate too far, a message displays to let him know. Figure 11-22The user can manage changes to the Contact records by using the Save, Add, and Delete buttons, asshown in Figure 11-23. When the user navigates around the records, his changes are made to the localdataset. However, as mentioned before, these changes are not saved in the underlying database until theuser clicks the Save button. Clicking New clears the field so a new record can be added. Clicking Deleteenables the user to remove the record from the local dataset. Figure 11-23262Chapter
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
Finally, the user can specify a search criteria of a Last Name and/or a Company Name to go directly to contact record, as shown in Figure 11-24. In order for a match to be found, the value must matchthe value in the database exactly, including case (that means that Company and company are not the same). This is just a simple example, but in a more sophisticated application you might allow partial matching. Either the Last Name or the Company can be specified, or both. If a match is found, the matching recordbecomes the current record and is displayed on the form. Figure 11-24You have now completed a tour of the CRM Application. Take some time to play around with the fea- tures and poke around in the code to see exactly what is going on behind the scenes. SummaryIn this chapter, you created a sample CRM Application that illustrates ways to use the Google API Microsoft MapPoint API in a custom program. Although the application may not be fancy or sophis- ticated, it certainly does illustrate just how easy it can be to integrate third-party APIs into your customsolutions in creative ways. Let s move on to the second case study, which provides another example by integrating theAmazon.com, Google, and eBay APIs together into an application.
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services