CIS407 Lab 2 PayrollSystem ASP.NET Application
STEP 1: Create Web Forms
Open the payroll system website from Lab 1.
2. Create a new form called frmPersonnel. To do this, pull down the website menu, select Add New Item, then type frmPersonnel.aspx for the name.
And you will get the following screen:
Change Default.aspx to frmPersonnel.aspx.
And get the following Screen:
3. Go to the Design mode of the form by clicking the Design tab (as opposed to the Source tab).
4. From the ToolBox, drag and drop an Image control.
5. Next, right click on the Project folder name in the Solution folder. Click Add-> New Folder and name the folder Images.
6. Right click on the Images folder and choose Add->Existing item. We will add our logo to our Images folder. Be sure to choose All Files from the Files of Type and navigate to where you saved the image. The logo image is located in the Files section in our course for you to download to your own machine or upload to Citrix.
7. After you have loaded the logo to the project, select the image control on your page.
8. On the Properties window, choose the ImageURL property and the ellipse to the right of this property to open a Browse dialog box and add the ACITLogo to the page.
9. The Logo should appear on your page as shown.
10. From the ToolBox, drag-and-drop a Panel control underneath the logo image.
11. Click the A/Z button in the Properties dialog so that all of the properties are sorted alphabetically.
12. Change the height property of the Panel to 250px and the width to 300px. To do this, select the Panel, then go to the Properties pane (usually in the lower right corner of the Visual Studio.NET Design view; if you don’t see it, click the View Properties window OR press the F4 key). Scroll down the list, then type the value in for each property.
13. Change the panel’s HorizontalAlign property to left.
14. Save your work!
15. From the ToolBox, drag-and-drop five Labels and five TextBoxes onto the Panel. To make each Label/TextBox pair appear on a separate line, put the cursor after each TextBox, then press the [ENTER] key (much like you would a with a word processing program).
Rename the Label’s properties as defined below. You can do this by selecting each Label, scrolling to the property, and then typing in the value.
Label1 – Text First Name:
Label2 – Text Last Name:
Label3 – Text Pay Rate:
Label4 – Text Start Date:
Label5 – Text End Date:
Rename each TextBox’s property as defined below. You can do this by selecting each TextBox, scrolling to the property, and then typing in the value.
TextBox1 – (ID) txtFirstName
TextBox2 – (ID) txtLastName
TextBox3 – (ID) txtPayRate
TextBox4 – (ID) txtStartDate
TextBox5 – (ID) txtEndDate
Change each button’s ID and Text properties as defined below. You can do this by selecting each button, scrolling to the property, and then typing in the value.
Button1 – (ID) btnSubmit
Button1 – Text Submit
Button2 – (ID) btnCancel
Button2 – Text Cancel
Save your work!
16. If you would like, you can make the labels the same size by selecting the first label, pressing and holding Control, and selecting the rest of the labels. Then, choose Format-> Make Same Size ->Width as shown below:
17. When we click the Submit button, we want the contents of the form to be passed to another form. In the Solution Explorer, right click on the project name and choose Add-> Add New Item. Choose Web Form and name the form frmPersonnelVerified.aspx.
18. On this form, we will add an image and panel like the previous form. Within the panel, add a label and a textbox. The width of the panel should be 650and the height 250. The label should say Information to Submit. The textbox ID should be txtVerifiedInfo. Also, change the TextMode Property of the textbox to MultiLine, the height to 80, and the width to 400.
Click the Design tab for the frmPersonalVerified.aspx, and add a Label and a TextBox. Set the properties as follows:
Label – Text Information to submit
Textbox – (ID) txtVerifiedInfo
Textbox – Height 80px
Textbox – Width 400px
Textbox – TextMode Multiline
19. Next, we will write the code that will load the information from the frmPersonnel page to the frmPersonnelVerified page. Be sure that your cursor is not selecting the panel. Double click on the blank part of the page to open the page_load event handler and add the following code.
20. Return to the frmPersonnel Web page, click the btnSubmit button, go to the PostBackUrL property and set it to frmPersonalVerified.aspx by clicking the ellipse to the right of the property to open a Browse dialog, and click frmPersonalVerified.aspx there. This will insert the correct path to the PostBackUrl Property.
21. Test your Web page. On the frmPersonnel.aspx page, right click and choose View in Browser. Test the application with test data and press Submit. You should see your test data appear in the frmPersonnelVerified page.
STEP 2: Adding Navigation
22. Add a new Web form called frmMain.aspx
A. Add the ACIT Logo to the top of the form and a panel below the image with height = 350 and width = 500.
B. Add an ImageButton control, then, space over, and next, add a LinkButton.
23. For the Image button, you will need to download an image from the Internet or create an image yourself. Right click on the Images folder and chooseAdd->Existing item and browse to add the image that you want to use as part of your project.
24. Click on the ImageButton and the ImageUrl property. Then, select the image that you added to the project. Modify the text of the LinkButton to Annual Salary Calculator.
25. Set the PostBackURL property for the image and the link to the frmSalaryCalculator.aspx from last week.
26. Right click on the frmMain.aspx and choose Set As Start Page.
27. Test your Web page. Press F5, or click the Start Debugging (Citrix users, press Start Without Debugging) button on the toolbar, or pull down the Debug menu and select Start Debugging. Test your link. Does it take you to the Annual Salary Calculator page?
NOTE: To execute the application, you have these options:
A. If you are using Citrix, press CTRL + F5 to Start Without Debugging. You will not be deducted points for this part
B. If you are using a standalone version, press F5 to Start with Debugging, or you can press CTRL + F5 to Start Without Debugging.
On your own:
A. Repeat this process to create an image and link for the frmPersonnel.aspx page. Remember to set the PostbackURL properties.
B. On the frmPersonnel page, make the ACIT logo be a link that will take the user to the frmMain page. Use an ASP.Net Hyperlink control to do this task.
C. Update the frmPersonnel, frmPersonnelVerified, and frmSalaryCalculator to include the ACIT logo at the top of each page with the logo set as a hyperlink that will return to the frmMain page.
D. On the frmPersonnel page, make it so that if the user presses the Cancel button, then that user is taken back to the frmMain.
STEP 3: Verify and Submit
28. Save your work and run the project. You should be able to go to both areas of your site and enter the information in the pages. Your calculator should properly calculate without errors, and then on the frmPersonel Web page, you can click the Submit button and have it display in the frmPersonalVerified Web page. Once you have verified that it works, save your project, zip up all files, and submit it.
NOTE: Make sure that you include comments in the C# code where specified (where the “//Your comments here” is mentioned), or else a 5-point deduction per item (form, class, function) will be made. This includes code that you will be creating in the coming weeks. To comment on the code, you basically put two forward slashes to start the comment; anything after the slashes on that line is disregarded by the compiler. Then, type a brief statement on what is happening in the line under it. Comments show professionalism and are a must in systems. As a professional developer, comments will set you apart from others and make your life much easier if maintenance and debugging are needed.