Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Project 5 Eyeglass Rx User Control. Eyeglass Rx Earlier in the semester we looked at an eyeglass prescription as an example of an HTML table. 2.

Similar presentations


Presentation on theme: "1 Project 5 Eyeglass Rx User Control. Eyeglass Rx Earlier in the semester we looked at an eyeglass prescription as an example of an HTML table. 2."— Presentation transcript:

1 1 Project 5 Eyeglass Rx User Control

2 Eyeglass Rx Earlier in the semester we looked at an eyeglass prescription as an example of an HTML table. 2

3 Project 5 In this project we will create an ASPX user control to display eyeglass prescriptions in the same format. The user control is to be a reusable component. Content for the user control will be provided from the enclosing page. 3

4 Assignment Write an ASP.NET app to display Eyeglass Prescriptions from a local database table. Let the display be done by a user control suitable for reuse in other pages and apps. User selects the Rx to view. App displays the selected Rx in the user control. 4

5 Requirements Create a table named Rx in your local database. Details later in this presentation. Populate the table with data from a csv file from the class web site. Described on following slides. 5

6 The Data File Download file Rx.csv from the class web site: http://www.csee.usf.edu/~turnerr/Web_Application_Design/ Downloads/095_Eyeglass_Rx/ 6 The first row contains column names. You will need to delete this row before using the file to populate your database table.

7 Rx.csv 7

8 The Database Table Create a database table called Rx in your local database. Use column headings from the csv file as column names for the database table. See table definition on the following slide. You can use the SQL command on the next slide to create the table. Populate the table with information from Rx.csv Delete the column headings before using the csv file to populate the database table. 8

9 Table Rx 9

10 Table Creation Command CREATE TABLE [dbo].[Rx] ( [RxID] INT NOT NULL, [RSphere] DECIMAL (6, 2) NOT NULL, [RCylinder] DECIMAL (6, 2) NOT NULL, [RAxis] INT NOT NULL, [RPrism] DECIMAL (6, 2) NOT NULL, [RBase] INT NOT NULL, [RAdd] DECIMAL (6, 2) NOT NULL, [RSeg] INT NOT NULL, [RPD] DECIMAL (6, 2) NOT NULL, [RNPD] DECIMAL (6, 2) NOT NULL, [LSphere] DECIMAL (6, 2) NOT NULL, [LCylinder] DECIMAL (6, 2) NOT NULL, [LAxis] INT NOT NULL, [LPrism] DECIMAL (6, 2) NOT NULL, [LBase] INT NOT NULL, [LAdd] DECIMAL (6, 2) NOT NULL, [LSeg] INT NOT NULL, [LPD] DECIMAL (6, 2) NOT NULL, [LNPD] DECIMAL (6, 2) NOT NULL, PRIMARY KEY CLUSTERED ([RxID] ASC) ); 10

11 Specifications Define a class, Rx, to hold Eyeglass Rx information. Use the.NET decimal type for all member variables that can have fractional parts decimal(6,2) in the table definition An object of this class will hold one eyeglass presecription. Constructor takes a SqlDataReader as parameter. Initializes the Rx object with the current result in the SqlDataReader Use Rx objects wherever you need Rx information. 11

12 Example of Use 12 User selects Rx ID 8. Initial screen

13 Example of Use 13

14 Example of Use 14 App displays Rx 8

15 Specifications Your app should look similar to the example and should behave identically. Note cell padding. Use New Web Site (not New Project) to create your app in Visual Studio. 10 point penalty for failing to follow this specification. 15

16 Specifications Use the.NET generic List class to hold a collection of Rx objects List Save the list as an Application State variable. Get Rx data from the database only if you have to because the Application variable does not exist. Normally only on initial page load by the first user of the application. 16

17 User Control Specifications The eyeglass Rx should be displayed in a user control. The user control should use an ASP Table control to display the Rx information. Contents are conveniently settable by C# code. Will be rendered as an HTML table. The user control should have a public property of type Rx. Setting the property causes the user control to display that Rx. 17

18 Additional Specifications Define a class to do the database query. This class should encapsulate all knowledge of how to do the query. The Rx class encapsulates knowledge of how to interpret the query result. 18

19 Implementation Tips Review the slides and examples from class presentations. It is OK to copy and modify code from class presentations and the Downloads area of the class web site. Look up documentation on the ASPX Table class. The markup in your.aspx file is different from HTML markup. Contents settable by page code. Renders as HTML 19

20 20 Submission Submit your web site files via Canvas Assignments. Zip your web site folder using the Windows “Send to Compressed Folder” command. Submit the.zip file.

21 21 Ground Rules You may work with one or two other students. OK to work alone if you prefer. If you do collaborate All group members are expected to contribute. Only one group member should submit the website files in Canvas. Include a comment with the names of all group members. Other group members submit just a comment with the names of all group members.

22 22 Ground Rules Do not share your work with other students (outside your group.) Before or after submitting the project. OK to discuss the project. Do not copy any other student’s code. Or even look at it. Do not let anyone copy or examine your code.

23 23 Ground Rules Except for code posted on the class web site Do not copy code from the Internet or any other source. Write your own code.

24 24 Due Date Project is due by 11:59 PM, Wednesday, March 9. Projects submitted after the deadline will be subject to a penalty of 10 points per hour. End of Presentation


Download ppt "1 Project 5 Eyeglass Rx User Control. Eyeglass Rx Earlier in the semester we looked at an eyeglass prescription as an example of an HTML table. 2."

Similar presentations


Ads by Google