Welcome to AssignmentCache!

Search results for 'DBM 502 wEEK 4 DATA WAREHOUSES BI Presentation'

Items 1 to 10 of 160 total

per page
Page:
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

Grid  List 

Set Ascending Direction
  1. All Stores Programming with Microsoft VB 2017 Diane Zak Chapter 12 Adalene Solution

    Programming with Microsoft VB 2017 Diane Zak Chapter 12 Adalene Solution

    Regular Price: $7.00

    Special Price $5.00

    Programming with Microsoft VB 2017 Diane Zak Chapter 12 Adalene Solution

    Open the Adalene Solution.sln file contained in the VB2017\Chap12\Adalene Solution folder. The application is already connected to the Adalene.mdf file, and the AdaleneDataSet has already been created. Start the application to view the records in the dataset and then stop the application. The Adalene Fashions application should allow the user to display all of the information in the dataset, only the information for company-owned stores, or only the information for franchisees. Create the appropriate queries and then use them to code the btnDisplay_Click procedure. Save the solution and then start and test the application.

    Learn More
  2. Programming with Microsoft VB 2017 Diane Zak Chapter 11 Utilities Solution

    Programming with Microsoft VB 2017 Diane Zak Chapter 11 Utilities Solution

    Regular Price: $7.00

    Special Price $5.00

    Programming with Microsoft VB 2017 Diane Zak Chapter 11 Utilities Solution

    Open the Utilities Solution.sln file contained in the VB2017\Chap11\Utilities Solution-DataGrid folder.
    a. Create a SQL Server database named Utilities.mdf.
    b. Add the Bills table definition shown in Figure 11-64 to the database. The Month field's (Is Identity), Identity Increment, and Identity Seed properties are set to True, 1, and 1, respectively. (Recall that you need to expand the Identity Specification property to access these properties.)
    c. After defining the table, click the Update button and then click the Update Database button.
    d. Open the Data Sources window and start the Data Source Configuration Wizard. Connect the Utilities.mdf file to the application. Include the entire Bills table in the dataset.
    e. Set the Utilities.mdf file's Copy to Output Directory property to "Copy if newer".
    f. Drag the Bills table to the form. Set the DataGridView control's AutoSizeColumnsMode property to Fill.
    g. Open the DataGridView control's task list and click Dock in Parent Container. Click Edit Columns. Change the Month column's AutoSizeMode property to ColumnHeader.
    h. Click Electricity in the Edit Columns dialog box, click DefaultCellStyle, click the ... (ellipsis) button, click Format, click the ... (ellipsis) button, click Numeric, and then click the OK button. The Format box now shows N2. Change the Alignment property to MiddleRight and then click the OK button to close the CellStyle Builder dialog box.
    i. Now, format the Water and Gas columns using the Numeric setting with two decimal places. Also, align the values in both columns using the MiddleRight setting. When you are finished setting the properties, close the Edit Columns dialog box.
    j. Change the form's Size property to 330, 200.
    k. Open the Code Editor window and enter an appropriate Try...Catch statement.
    l. Save the solution and then start the application. Enter the three records shown in Figure 11-64. (Recall that the Month field is an auto-numbered field. The numbers 1, 2, and 3 will appear when you click the Save Data button.)
    m. Stop the application and then start it again to verify that the three records were saved.

    Learn More
  3. Programming with Microsoft VB 2017 Diane Zak Chapter 11 Total Cookie Sales Solution

    Programming with Microsoft VB 2017 Diane Zak Chapter 11 Total Cookie Sales Solution

    Regular Price: $7.00

    Special Price $5.00

    Programming with Microsoft VB 2017 Diane Zak Chapter 11 Total Cookie Sales Solution

    Open the Total Cookie Sales Solution.sln file contained in the VB2017\Chap11\Total Cookie Sales Solution folder
    a. Figure 11-63 shows the Sales table contained in the CookieSales.mdf file. The table contains the numbers of boxes of cookies sold in each of six weeks. The database is already connected to the application and the CookieSalesDataSet has already been created.

    b. Open the Data Sources window and then drag the Sales table to the DataGridView control. Change the control's AutoSizeColumnsMode to Fill. Use the control's task list to disable adding, editing, and deleting records. Also, right-align the numbers in the cookie sales columns.

    c. Lock the controls on the form. Start the application to verify that the six records appear in the DataGridView control. Stop the application.

    d. The Calculate button should display the total sales for each cookie type. Code the btnCalc_Click procedure. (The database does not allow NULLs in any of the fields, so you do not need to check if a field contains the NULL value.)

    e. Save the solution and then start and test the application.

    Learn More
  4. All Grades Programming with Microsoft VB 2017 Diane Zak Chapter 12 FixIt Solution

    Programming with Microsoft VB 2017 Diane Zak Chapter 12 FixIt Solution

    Regular Price: $7.00

    Special Price $5.00

    Programming with Microsoft VB 2017 Diane Zak Chapter 12 FixIt Solution

    Open the VB2017\Chap12\FixIt Solution\FixIt Solution.sln file. Start the application.
    Click the Grade radio button, type the letter a in the Grade box, and then click the Display button. The application should display three records in the DataGridView control. It should also display the number 3 in the lblCount control. Notice that the application is not working properly. Fix the application.

    Learn More
  5. Programming with Microsoft VB 2017 Diane Zak Chapter 10 Fence Solution

    Programming with Microsoft VB 2017 Diane Zak Chapter 10 Fence Solution

    Regular Price: $7.00

    Special Price $5.00

    Programming with Microsoft VB 2017 Diane Zak Chapter 10 Fence Solution

    In this exercise, you create an application that can be used to calculate the cost of installing a fence around a rectangular area. Create a Windows Forms application. Use the following names for the project and solution, respectively: Fence Project and Fence Solution. Save the application in the VB2017\Chap10 folder:

    a. Use Windows to copy the Rectangular.vb file from the VB2017\Chap10 folder to the Fence Project folder. Then, use the Project menu to add the file to the project.

    b. Modify the Rectangular class to use the Double (rather than Integer) variables.

    c. Add a method named GetPerimeter to the Rectangle class. The method should calculate and return the perimeter of a rectangle. To calculate the perimeter, the method will need to add together the length and width measurements and then multiply the sum by 2.

    d. Create the interface shown in Figure 10-41 and then code the application. Save the solution and then start and test the application.

    Learn More
  6. WEB460 Lab 2 of 7 Creating and Using Master Pages Checkout Page

    WEB460 Lab 2 of 7: Creating and Using Master Pages

    Regular Price: $12.00

    Special Price $10.00

    WEB460 Lab 2 of 7: Creating and Using Master Pages

    Scenario/Summary
    In this Lab, you create a master page for our bookstore website and then modify the checkout and order confirm pages from last week's lab to use the master page.

    Deliverables
    The deliverables for this week's lab are the following:
    pgCheckOut.aspx
    pgCheckOut.aspx.cs
    pgConfirm.aspx
    pgConfirm.aspx.cs
    Web460Store.master
    Web460Store.master.cs
    web.config
    Please zip and submit the entire web project folder.

    Lab Steps
    STEP A: Create a New Web Site Project
    In this step, we set up a new project and copy the files from the Week 1 Lab into it. This allows us to begin our lab this week where we left off last week and to add common elements to both pages.
    1. To start this week's project, create a new Empty Web Application project.
    2. Copy the four files from last week's Lab into the folder for this new project. Be careful not to move the files. We want to work on a copy of last week's lab and leave the original untouched. The website folder should have the following files:
    pgCheckOut.aspx
    pgCheckOut.aspx.cs
    pgConfirm.aspx
    pgConfirm.aspx.cs
    web.config
    web.Debug.config ( optional: it depends on the version of Visual Studio you are using)
    3. Set pgCheckOut.aspx as the start page and test your application. It should perform just as it did last week.

    STEP B: Create a Master Page
    In this step, we add a master page to our project.
    1. Right-click on the name of your project and select Add => Add New Item ...
    2. Select Master Page as the type of item to add. Be sure that Place code in separate file. is checked.
    3. Name the master page Web460Store.master and click OK to create the maser page for our site.

    STEP C: Design Your Master Page
    Our master page contains elements that we want common to all pages on our website, such as the header, the footer, and two side-by-side content areas. We mark areas that content pages can fill with the ContentPlaceHolder tag.
    We also want a Label control that our content pages can modify to display messages directed to the user. Making the Label accessible to content pages requires editing the C# code for the master page, which we do in the next step.
    1. View the source for Web460Store.master. We first set the title and a content area in the head of the master page. Make any changes necessary to the <head> tag so that it matches the code below:
    <head runat="server">
    <title>WEB460 Book Store</title>
    <asp:ContentPlaceHolder id="HeadPlaceHolder" runat="server">
    </asp:ContentPlaceHolder>
    </head>
    2. Next we create the page template in the <body> of the master page. We use a table to assist with the layout. The first row of the table is the header for our page, displaying the company name and motto. It also contains the Label we will use to send messages to the user. The second table row has two content areas side by side for the website pages to place content and additional controls. The last row of the table is the page footer.
    Edit the <body> of your master page so that it looks like the following block of code:
    <body>
    <form id="form1" runat="server">
    <table style="padding: 10px; border: 1px solid black;">
    <tr style="background-color:lightcyan; text-align: center;">
    <td colspan="2">
    <!-- page header -->
    <h1>WEB 460 Book Store</h1>
    <h2>Providing you 100% more than 360 degrees</h2>
    <!-- Label for content pages to display user message -->
    <strong><span style="color:red;">
    <asp:Label ID="lblUserFeedBack" Runat="server">Welcome Traveler!</asp:Label>
    </span></strong>
    </td>
    </tr>
    <tr style="vertical-align: top;">
    <td>
    <!-- Left content area -->
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" Runat="server">
    </asp:ContentPlaceHolder>
    </td>
    <td>
    <!-- right content area -->
    <asp:ContentPlaceHolder ID="ContentPlaceHolder2" Runat="server">
    </asp:ContentPlaceHolder>
    </td>
    </tr>
    <tr style="background-color:lightgrey; text-align: center;">
    <td colspan="2">
    <!-- page footer -->
    Copyright DeVry University<br />
    <strong>User's GUID:
    <asp:Label ID="lblGUID" Runat="server" /></strong>
    </td>
    </tr>
    </table>
    </form>
    </body>

    STEP D: Expose the Label Control to Content Pages
    In this step, we modify the C# code file for our master page, Web460Store.master.cs, to modify text displayed on the Label controls.
    1. We need to establish set properties for the Label lblUserFeedback so that our content pages can change the message displayed to the user. Add the following method to the class Web460Store:
    public Label UserFeedBack
    {
    get { return lblUserFeedBack; }
    set { lblUserFeedBack = value; }
    }
    2. To provide a tool we can use for security in the future, we want to display the user GUID (globally unique identifier) for this page call. We only want to generate the GUID the first time the page is loaded (not on postback). We can accomplish this by adding the following code to the master page's Page_Load method:
    if (!Page.IsPostBack)
    {
    lblGUID.Text = System.Guid.NewGuid().ToString();
    }

    STEP E: Modify pgCheckOut to Use Our Master Page
    In this step, we modify pgCheckOut.aspx to use the master page we created earlier. Since the master page contains <head>, <body>, and <form> tags, we do not need those in our content page, so we will be removing them as part of this step. We also must map the content on this page to the ContentPlaceHolder controls on the master page.
    1. We begin by adding MasterPageFile="~/Web460Store.master" to the page directive to indicate that this page references our master page:
    <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Web460Store.master" CodeFile="pgCheckOut.aspx.cs" Inherits="pgCheckOut" %>
    2. So we have access controls the master page has exposed to us, such as the Label for user feedback. We need to add the following directive next:
    <%@ MasterType VirtualPath ="~/Web460Store.master" %>
    3. We can then remove the <!DOCTYPE>, <html>, and <head> tags because we will be using the ones defined in the master page. Also remove the <body> and <form> tags, but leave the content.
    4. Next we map the body content to the two ContentPlaceHolder controls on the master page. The customer name, address, and phone number should be in the left content area (ContentPlaceHolder1) and the credit card information in the right content area ( ContentPlaceholder2 ). We bracket the content for each with an ASP.NET Content control.
    5. Before the Label control for the customer's first name, place the line:
    <asp:Content ID="ContentArea1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    6. Just after the line for the phone number TextBox control, close the first content area with the line:
    </asp:Content>
    7. On the next line, we begin the second content area the same way as the first begins:
    <asp:Content ID="ContentArea2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    8. We close the second content area at the end of the file, after the submit button:
    </asp:Content>
    At this point, the pgCheckOut.aspx design view should look similar to the following:

    STEP F: Update the Master Page User Feedback Label
    On pgCheckOut.aspx we want the user to enter billing information. We can modify the master page Label lblUserFeedback by updating the master page's UserFeedBack property we setup earlier. So this happens when the page is loaded, making the Page_Load method in pgCheckOut.aspx.cs look like this:
    protected void Page_Load(object sender, EventArgs e)
    {
    Master.UserFeedBack.Text = "Please enter billing information.";
    }

    STEP G: Modify pgConfirm to Use the Site Master Page
    In this step, we transform the confirmation page pgConfirm to use the website master page in a similar way to how we modified pgCheckOut.
    First, modify pgConfirm.aspx:
    1. Remove unneeded HTML tags and modify the page directives as necessary.
    2. The left content area should contain the customer's name and address.
    3. The right content area should contain the customer credit card information and the Submit Order button.
    4. Remove the status label lblStatus because we will use the master page's user feedback Label.
    Then, because we removed lblStatus, we need to modify pgConfirm.aspx.cs:
    5. When the page first loads, it should display the user feedback message:
    Please confirm your billing information.
    6. After the user presses the Submit Order button, the user feedback should be:
    Your order has been submitted for processing.
    7. If there is an exception thrown by PreviousPage.IsCrossPagePostBack, it should display the message:
    Sorry, there was an error processing your request.
    When the application is rTuonpning, pgConfirm should appear similar to the following:

    STEP H: Finalize Your Lab
    1. Save your work!
    2. Test it!
    3. Make changes as appropriate until it works.
    4. Remember to add comments for each step being performed.

    Learn More
  7. WEB460 Lab 1 of 7 Basic ASP Page and Cross-Page Posting CheckOut Page

    WEB460 Lab 1 of 7: Basic ASP Page and Cross-Page Posting

    Regular Price: $12.00

    Special Price $10.00

    WEB460 Lab 1 of 7: Basic ASP Page and Cross-Page Posting

    Scenario/Summary
    In this week's lab assignment, we'll be developing credit card information checkout pages of an online book store. Such pages are necessary in any developed e-commerce application. In these pages, users are required to enter information related to their payment and shipping options.
    We will develop two pages. On the first page, the user provides personal, payment, and shipping information for the order submitted. The second page summarizes the user's input and requires the user to confirm.

    Learning Objectives
    Create an ASP.NET web project in Visual Studio 2010 or Visual Studio 2012.
    Create and design ASP.Net web forms.
    Cross-page posting in ASP.NET
    How to use ASP.NET web server controls (DropDownList, TextBox, RadioButtonList, Label, and Button)
    Exception handling

    Deliverables
    A zip archive of the ASP.NET Application implementing cross-page posting consisting of the following files:
    – pgCheckOut.aspx web form with all server controls defined in requirements
    – pgCheckOut.aspx.cs with code for cross-page posting
    – pgConfirm.aspx web form with all server controls defined in requirements
    – pgConfirm.aspx.cs with code for cross-page posting and exception handling

    Lab Steps
    STEP A: Create a New Web Site Project
    1. Go to the File menu and select New. From the New sub-menu, select Web Site to create a new Web Site project.
    2. In the New Web Site dialog box, select the language you want to use in developing your web application; for our applications choose Visual C#.
    3. Select ASP.NET Empty Web Site to create a project with only a web.config file.
    4. Then specify the location of your project or website. Note that in ASP.NET, you have the option of creating your website in different locations, whether in any folder on your local file system, on the local IIS server you have on your computer, or on a remote HTTP or FTP server. ASP.NET has an integrated IIS server with the Visual Studio .Net IDE.
    I recommend using the default Web Sites folder in the Visual Studio project folder. This allows the development of web applications without the hassle of setting up an IIS server on your computer. If you don't have IIS server installed on your computer, this is the best option to select for your lab.

    STEP B: Create and Design a New Web Form, pgCheckOut.aspx
    1. Add the first web form to the web application by right-clicking on the project name and selecting Add New Item. Name the web form pgCheckOut.aspx.
    2. Add the controls in the table below to the form. If desired, you can visually layout the form using HTML and CSS after adding the controls.
    The first column in the table shows the data the control represents or their label, the second column is the type of control, and the last column is the ID or name of the actual control. If the Visual Studio web form Toolbox Pane is not displayed, you can show it by going to the View menu and selecting Toolbox. All of these controls can be found in the Toolbox Pane.
    Data or Label Control Type Control ID or Name
    First Name TextBox txtFirstName
    Last Name TextBox txtLastName
    Street TextBox txtStreet
    City TextBox txtCity
    State TextBox txtState
    Payment Method RadioButtonList rblCCType
    Credit Card Number TextBox txtCCNumber
    Submit Button btnSubmit
    Phone Number TextBox txtPhone

    3. When the user clicks on the submit button, pgConfirm.aspx should be displayed. This is done with cross-page posting. To implement this, set the PostBackUrl property of the Submit button to ~/pgConfirm.aspx. This will cause the pgCheckOut.aspx to post user requests to the web page pgConfirm.aspx, which we will create shortly.

    STEP C: Add Code to the pgCheckOut.aspx Form (to Read User Input and Implement Cross-page Posting)
    Implement public methods in the pgCheckOut.aspx.cs code file to expose the form's control values to other pages. The code below is an example of how to retrieve the value of the txtFirstName and txtLastName.
    Sample Method to Get Control Values
    public TextBox FirstName
    { get { return txtFirstName; } }
    public TextBox LastName
    { get { return txtLastName; } }

    STEP D: Create and Design Another Web Form, pgConfirm.aspx
    1. Add the second web form to your web application. Name the form pgConfirm.aspx.
    2. Add label controls to display the user input values for the name, address, credit card type, and credit card number.
    This allows the user to review and confirm order information before final submission. Add the controls in the table below to the form. The application will fill in the text displayed by the labels, so you don't need to. You should provide additional labels that describe these values for the user.
    Control Type Control ID or Name Control Purpose
    Label lblName Holds the concatenation string of first name and last name entered in pgChekout.aspx
    Label lblAddress Holds the concatenation of all address-related fields user input in pgCheckOut.aspx
    Label lblCCType Displays the credit card type the user selected in pgCheckOut.aspx
    Label lblCCNumber Displays the credit card number the user entered in pgCheckOut.aspx
    Label lblStatus Displays the message of any run time exception that might happen during run time
    Button btnSubmit When the user clicks on the submit order button, this displays a note to the user that his or her order was submitted successfully. You should use the status label to display the message.

    STEP E: Add Code to the pgConfirm.aspx Form (to Allow User to Verify Order Input and Submit for Final Processing)
    1. In the pgConfirm.aspx page, add the following code to the PreviousPageType directive to the pgConfirm.aspx file, and set it to the pgCheckOut.aspx.
    <%@ Page Language="C#" AutoEventWireup=“true" CodeFile="pgConfirm.aspx.cs" Inherits="pgConfirm" %>
    <%@ PreviousPageType VirtualPath="~/pgCheckOut.aspx" %>
    2. Next, in the Page_Load() event of the pgConfirm.aspx.cs code page, check whether there is any cross-page posting by checking whether there is a cross-page postback, and set the values of the label controls with the corresponding user input values from the previous page as shown below. Be sure to implement for all controls on the form.
    3. Enclose your code in a try/catch block to handle any run time exception thrown by the application for any reason, as shown below.
    4. Add code to have lblStatus display the message of any thrown exception. Don't forget to add comments explaining what each line of code does.
    pgConfirm Page_Load method
    protected void Page_Load(object sender, EventArgs e)
    {
    try
    {
    if (PreviousPage.IsCrossPagePostBack)
    {
    lblName.Text = PreviousPage.FirstName.Text + " " + PreviousPage.LastName.Text;
    // Your code to set other form labels goes here
    }
    }
    catch (Exception error )
    {
    lblStatus.Text = error.Message;
    }
    }

    STEP F: Compile, Test, Save, and Submit Your Project
    1. Save your work!
    2. Test it! Make changes as appropriate until it works.
    3. Remember to add comments for each step being performed.
    4. Please zip and submit the entire web project folder.

    Learn More
  8. Microsoft Visual Basic 2012 Shelly Cashman Chapter 6 Case Problem 5 Distance Traveled Calculator

    Microsoft Visual Basic 2012 Shelly Cashman Chapter 6 Case Problem 5 Distance Traveled Calculator

    Regular Price: $20.00

    Special Price $15.00

    Microsoft Visual Basic 2012 Shelly Cashman Chapter 6 Case Problem 5 Distance Traveled Calculator

    Design a Windows application and write the code that will execute according to the program requirements shown in Figure 6-132. Before writing the code, create an event planning document for each event in the program. Create a Use Case Definition document for the application.

    REQUIREMENTS DOCUMENT
    Date submitted: December 5, 2014
    Application title: Vacation Distance Calculator Windows Application

    Purpose: This application computes the number of miles traveled given the speed limit and the number of days traveled while driving cross country.

    Program Procedures: In a Windows application, enter the speed limit and the number of days you plan to travel across the country. You will enter the number of hours you would like to drive for each of the days, based on places you plan to visit as you drive and other factors. For example, the first day you plan to drive only 4 hours because you are driving after work. The application displays the distance that you are able to travel for the entire trip based on the speed limit and the hours driven.

    Algorithms, Processing, Conditions:
    1. The application opens displaying a title. The user enters the speed limit and the and number of days you plan to drive.
    2. The user clicks the Distance button to request the number of hours you plan to drive each day. The result of the total number of miles you plan to drive over the entire trip will be displayed.
    3. A File menu contains a Clear and an Exit option. The Clear menu item clears the result and the entered number of miles per hour and time traveled. The Exit menu item closes the application.

    Notes and Restrictions:
    1. Nonnumeric values should not be accepted.
    2. The number of hours for one day of travel should not exceed 20 hours.

    Comments:
    1. The application allows decimal entries.

    Learn More
  9. CSIS 209 PROGRAMMING ASSIGNMENT 2 INSTRUCTIONS Output

    CSIS 209 Programming Assignment 2 Salesperson Total Sales Application

    Regular Price: $15.00

    Special Price $12.00

    CSIS 209 Programming Assignment 2 Salesperson Total Sales Application

    Adapted from: Deitel & Deitel (2017). Visual C# 2015 How to Program (6th ed.). Pearson Education, Inc.
    A large company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5,000 worth of merchandise in a week receives $200 plus 9% of $5,000, or a total of $650. You’ve been supplied with a list of the items sold by each salesperson. The values of these items are as follows:
    Item Value
    1 239.99
    2 129.75
    3 99.95
    4 350.89

    Develop a C# application that inputs one salesperson's items sold for the last week, then calculates and displays that salesperson's total sales. There's no limit to the number of items that can be sold by a salesperson. You do not have to implement this with classes and objects.

    Technical Requirements:
    Prompt the user to enter the salesperson's name, and store this name in a variable.
    Prompt the user to enter an item number and a quantity sold of that item. Store these two entries in two separate variables called "intItem" and "intQuantity".
    Using a DO-WHILE control structure, loop until the user enters -1 for the item number.
    Calculate the amount of sales for an item and store the result in a variable called dblItemSales.
    After the user enters an item number and a quantity, print to the screen: the salesperson's name "has sold " [intQuantity] "of item # [intItem].
    Accumulate the total sales in a variable called dblTotalSales by using a SWITCH statement to select the correct value to be multiplied by the quantity sold and adding this result to a running total, which is stored in the variable dblTotalSales.
    If the user enters a number other than 1, 2, 3, or 4, display the message "Invalid Entry" and re-prompt the user to enter an Item Number. Make sure you do not perform any calculations or prompt the user to enter a quantity if the item number is incorrect.
    After accumulating the total sales for an employee (that is, after the user has entered a -1 to quit), print to the screen Salesperson [Salesperson’s name] sold a total of [total sales].

    See below for examples of the required output.

    Learn More
  10. CIS407 Lab 5 PayrollSystem ASP.NET Application frmPersonnel

    CIS407 Lab 5 of 7: Transaction Processing PayrollSystem ASP.NET Application

    Regular Price: $12.00

    Special Price $10.00

    CIS407 Lab 5 of 7: Transaction Processing PayrollSystem ASP.NET Application

    Lab Overview
    Scenario/Summary
    This week, we will use the .NET OleDbTransaction functions to either commit a set of changes to the database, if all of them were done correctly, or to roll back all of the changes if there was an error in any one of them. We will first modify the code that we created last week so that it will save personnel data in the database in two steps; first by inserting a personnel record for a new employee, and then by updating that record to fill in the start and end dates.
    This two-step approach is not really needed in this simple case, but we will use it to simulate a more complex database transaction that would have to be done in multiple steps, such as one involving more than one table or even more than one database. We will then see what happens when there is an error in the second operation (the update), allowing a record to be created containing incomplete information: not a good result! We will fix the problem by wrapping both operations (the insert and the update) into a single transaction that will be committed (made permanent) only if both operations succeed or will be rolled back (undone) if either operation fails. We will also add client-side validation using the ASP.Net validation controls, and we will allow the user an easy way to edit all employees.
    Please watch the tutorial before beginning the Lab.

    Lab Steps
    Deliverables
    All files are located in the subdirectory of the project. The project should function as specified:
    When you press the Submit button in frmPersonnel, a record should be saved in the tblPersonnel table containing the FirstName, LastName, PayRate, StartDate, and EndDate that you entered. Test that the transaction will roll back by entering invalid information in one or more items, such as Hello for a StartDate. Check that client-side validation works: The ability to edit employees in a grid is working. Once you have verified that it works, save your website, zip up all files, and submit them.

    STEP 1: Modify the clsDataLayer to Use a Two-Step Process
    1. Open Microsoft Visual Studio.NET.
    2. Click the ASP.NET project called PayrollSystem to open it.
    3. Open the clsDataLayer class.
    4. Modify the SavePersonnel() function so that instead of just doing a single SQL INSERT operation with all of the personnel data, it does an INSERT with only the FirstName and LastName, followed by an UPDATE to save the PayRate, StartDate, and EndDate into the new record. (This two-step approach is not really necessary here because we are dealing with only one table, tblPersonnel, but we are doing it to simulate a case with more complex processing requirements, in which we would need to insert or update data in more than one table or maybe even more than one database.) Find the following existing code in the SavePersonnel() function:
     // Add your comments here
            strSQL = "Insert into tblPersonnel " +
            "(FirstName, LastName, PayRate, StartDate, EndDate) values ('" +
            FirstName + "', '" + LastName + "', " + PayRate + ", '" + StartDate +
            "', '" + EndDate + "')";
            // Add your comments here
            command.CommandType = CommandType.Text;
            command.CommandText = strSQL;
            // Add your comments here
            command.ExecuteNonQuery();
    Modify it so that it reads as follows:
    // Add your comments here
            strSQL = "Insert into tblPersonnel " +
            "(FirstName, LastName) values ('" +
            FirstName + "', '" + LastName + "')";
            // Add your comments here
            command.CommandType = CommandType.Text;
            command.CommandText = strSQL;
            // Add your comments here
            command.ExecuteNonQuery();
            // Add your comments here
            strSQL = "Update tblPersonnel " +
            "Set PayRate=" + PayRate + ", " +
            "StartDate='" + StartDate + "', " +
            "EndDate='" + EndDate + "' " +
            "Where ID=(Select Max(ID) From tblPersonnel)";
            // Add your comments here
            command.CommandType = CommandType.Text;
            command.CommandText = strSQL;
            // Add your comments here
            command.ExecuteNonQuery();
    5. Set frmMain as the startup form and run the PayrollSystem Web application to test the changes. When valid data values are entered for a new employee, things should work exactly as they did previously. To test it, enter valid data for a new employee in frmPersonnel and click Submit. The frmPersonnelVerified form should be displayed with the entered data values and a message that the record was saved successfully. Click the View Personnel button and check that the new personnel record was indeed saved to the database and that all entered data values, including the PayRate, StartDate, and EndDate, were stored correctly. Close the browser window.
    Now run the PayrollSystem Web application again, but this time, enter some invalid data (a nonnumeric value) in the PayRate field to cause an error, like this:
     
    6. Now, when you click Submit, the frmPersonnelVerified form should display a message indicating that the record was not saved:
     
    However, when you click on the View Personnel button to display the personnel records, you should see that an incomplete personnel record was in fact created, with missing values for the PayRate, StartDate, and EndDate fields.
    This occurred because the Insert statement succeeded but the following Update statement did not. We do not want to allow this to happen because we end up with incomplete or incorrect data in the database. If the Update statement fails, we want the Insert statement to be rolled back, or undone, so that we end up with no record at all. We will fix this by adding transaction code in the next step.
    STEP 2: Add Transaction Code
    7. In the clsDataLayer.cls class file, add code to the SavePersonnel() function to create a transaction object. Begin the transaction, commit the transaction if all database operations are successful, and roll back the transaction if any database operation fails. The following listing shows the complete SavePersonnel() function; the lines you will need to add are marked with ** NEW ** in the preceding comment and are shown in bold and underlined.
    // This function saves the personnel data
        public static bool SavePersonnel(string Database, string FirstName, string LastName,
                                         string PayRate, string StartDate, string EndDate)
        {
            bool recordSaved;
    // ** NEW ** Add your comments here
             OleDbTransaction myTransaction = null;
            try
            {
                // Add your comments here
                OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" +
                                                           "Data Source=" + Database);
                conn.Open();
                OleDbCommand command = conn.CreateCommand();
                string strSQL;
                // ** NEW ** Add your comments here
     myTransaction = conn.BeginTransaction();
      command.Transaction = myTransaction;
                // Add your comments here
                strSQL = "Insert into tblPersonnel " +
                         "(FirstName, LastName) values ('" +
                         FirstName + "', '" + LastName + "')";
                // Add your comments here
                command.CommandType = CommandType.Text;
                command.CommandText = strSQL;
                // Add your comments here
                command.ExecuteNonQuery();
                // Add your comments here
                strSQL = "Update tblPersonnel " +
                         "Set PayRate=" + PayRate + ", " +
                         "StartDate='" + StartDate + "', " +
                         "EndDate='" + EndDate + "' " +
                         "Where ID=(Select Max(ID) From tblPersonnel)";
                // Add your comments here
                command.CommandType = CommandType.Text;
                command.CommandText = strSQL;
                // Add your comments here
                command.ExecuteNonQuery();
                // ** NEW ** Add your comments here
     myTransaction.Commit();
                // Add your comments here
                conn.Close();
            recordSaved = true;
            }
            catch (Exception ex)
            {
                // ** NEW ** Add your comments here
                myTransaction.Rollback();
                recordSaved = false;
            }
            return recordSaved;
        }
    8. Run your Web application. First, enter valid data in all fields of frmPersonnel. When you press the Submit button in frmPersonnel, a record should be saved in the tblPersonnel table containing the FirstName, LastName, PayRate, StartDate, and EndDate. With valid data entered in all items, the successfully saved message should appear, indicating that the transaction was committed.
     
    Click the View Personnel button and verify that the new record was in fact added to the database table correctly.
     
    9. Now, close the browser, run the Web application again, and this time, test that the transaction will roll back after entering incorrect information. On the frmPersonnel form, enter invalid data for PayRate and click Submit. The not saved message should appear, which indicates that the transaction was rolled back.
     
    Click the View Personnel button and verify that this time, as desired, an incomplete record was not added to the database table.
     
    10.  You have seen how we used the try/catch block to catch an unexpected error. You may have noticed that if you enter bad data for the dates, an exception is thrown. Go back to the validation code that you added in the frmPersonnel code and add a try/catch with logic to prevent an invalid date from causing a server error.
    11.  In the Week 3 Lab, you learned how to validate code once the page was posted back to the server. There is some validation that must be done on the server because it requires server resources such as the database. Some validation can also be done on the client. If you can do validation on the client, it saves a round trip to the server, which will improve performance. In this approach, we will check values before the page is submitted to the server for processing. Normally, there is a combination of server and client validation used in a Web application. ASP.Net includes validation controls which will use JavaScript on the client to perform validation. You will find these controls in the Validation group in the toolbox.
    12.  Add validation controls to the frmPersonnel form as follows: For the first,  last name, and pay rate, make sure each field has data in it. Use the RequiredFieldValidator for this task. Add the control to the right of the text box that you are validating. The location of the validator control is where the error message (if there is one) will appear for the control to which you link the validator. You will be adding one validator control for each text box that you want to validate. Remember to set the ControlToValidate and ErrorMessage properties on the validator control. Making this change eliminates the need for the server-side check you were doing previously. Use a regular expression validator to check that the start and end date are in the correct format.
    In order to keep the validation controls from causing wrapping, you may want to increase the Panel width.
    A regular expression for mm/dd/yyyy is this:
    ^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$
    13.  Remove the View Personnel and Cancel buttons from the frmPersonnel form, because they will cause a Postback and invoke the client-side editing that you just added. The user is able to get to the View Personnel from the main form and from the personnel verification screen, so there is no need for these buttons now.
    14.  Because you have entered data in this lab that is invalid and those partial records are in the database, you will need to add the ability to remove or update data. Open up frmMain and add a new main form option called Edit Employees. Add the link and image for it. This option will take the user to a new form called frmEditPersonnel.
    15.  Add the new form frmEditPersonnel. On frmEditPersonnel, add the ACIT logo at the top of the form. Add a label that says Edit Employees. Add a GridView control with an ID of grdEditPersonnel.
    16.  You will now add a SQLDataSource to the page. You will be using a databound grid for this form unlike the previous grids, in which you added as unbound (in the designer).
    17.  Add a new SQLDataSource control to the frmEditPersonnel in the Design View. This is not a visible control; that is, it will only appear in Design View, but the user will never see it. Note: If you change the folder name or location of your database, you will need to reconfigure the data source (right-click on the data source control and select the Configure Data Source option).
    18.  There is a small > indicator in the Design View of the SQL Data Source control that you added. If the configuration menu is collapsed (press it to open the menu), or there is a < with the menu displayed, from the data source menu, select Configure Data Source.
    19.  Press the New Connection button and browse for the database.
    20.  Press the Next button.
    21.  When asked if you want to save the connection in the application configuration file, check the Yes check box and press Next.
    22.  Select the tblPersonnel table.
    23.  Select all columns (you can use the * for this).
    24.  Press the Advanced button and check the Generate Insert, Update, and Delete option and press the OK button.
    25.  Press the Next button.
    26.  Press the Test Query button and make sure that you see all records in the database like the image below. If it does not, repeat the above steps to make sure that you did everything properly (and selected the correct database - if you are not sure, open the database in Windows Explorer to be sure that it is the one with data in tblPersonnel). Press the Finish button.
    27.  Click on the grid that you added in the Design View and expand the Properties menu (the little > in the upper right of the control). Choose the data source you just added. On the GridView tasks menu, select Edit columns. Add an Edit, Update, and Cancel Command field. Add a Delete Command field. Press OK. You can now test the grid, which is a fully functioning Update and Delete grid. Try it out!
     
    STEP 3: Test and Submit
    28. Once you have verified that everything works as it is supposed to work, save your project, zip up all files, and submit it.
    NOTE: Make sure you include comments in the code provided where specified (where the " // Your comments here" is mentioned) and for any code you write, or else a 5-point deduction per item (form, class, function) will be made.

    Learn More

Items 1 to 10 of 160 total

per page
Page:
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

Grid  List 

Set Ascending Direction
[profiler]
Memory usage: real: 15466496, emalloc: 14988120
Code ProfilerTimeCntEmallocRealMem