Welcome to AssignmentCache!

Search results for 'My'

Items 1 to 10 of 16 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Descending Direction
  1. CIS 170 Week 3 iLab 3 DIVE Scoring Program

    CIS 170 Week 3 iLab 3 of 7 Looping DIVE Scoring Program

    $15.00

    CIS 170 Week 3 iLab 3 of 7 Looping DIVE Scoring Program

    DIVE Scoring Program
    Your mission: The state diving commission wants to computerize the scoring at its diving competitions. You've been hired to write a program to automate the scoring of dives. Following are the requirements for the program.
    After each dive, the user will be prompted to enter the:
    diver's name
    diver's city
    degree of difficulty (ranges from 1.00 to 1.67); and scores from five judges (scores can range from 0 to 10).
    If an invalid score is entered, an error message will be displayed. The user will be prompted for the score repeatedly until a valid score is entered.
    The program will then display the following information:
    Diver's name
    Diver's city
    Dive final score: This is calculated by dropping the highest and lowest of the five judges' scores. The remaining three scores are added together, and the result is divided by 3 and then multiplied by the degree of difficulty.
    The program will then prompt the user if she/he wants to process another dive. The user can type "Y" or "y" to continue, and "N" or "n" to quit.
    Sample output:
    Diver's name: Sue Jones
    Diver's city: Dallas
    Dive degree of difficulty: 1.9
    Invalid degree of difficulty - Please reenter (Valid Range: 1 - 1.67)
    Dive degree of difficulty: 2
    Invalid degree of difficulty - Please reenter (Valid Range: 1 - 1.67)
    Dive degree of difficulty: 1.2
    Judge #1 score: 45
    Invalid score - Please reenter (Valid Range: 0 - 10)
    Judge #1 score: 3
    Judge #2 score: 4.5
    Judge #3 score 6.7
    Judge #4 score 89
    Invalid score - Please reenter (Valid Range: 0 - 10)
    Judge #4 score 8
    Judge #5 score: 9.2
    Diver: Sue Jones
    City: Dallas
    Dive score: 7.68
    Do you want to process another dive (Y/N)? y
    Diver's name: Dave Smith
    Diver's city: Houston
    Dive degree of difficulty: 1.1
    Judge #1 score: 5.7
    Judge #2 score: 6.8
    Judge #3 score:: 7.6
    Judge #4 score: 8.7
    Judge #5 score: 6.7
    Diver: Dave Smith
    City: Houston
    Dive score: 7.74
    Do you want to process another diver (Y/N)? N

    Tips
    Best practice: Note that a good way to implement the code is to write a first version for only a single dive without validating input. Put yourself in the place of the program. What steps would you personally need to perform in order to process a single dive yourself? Write out those steps on paper as pseudocode and/or in Visual Studio as C# comments, and then implement them one by one, testing as you go. After you have a single dive process working, implement one of the input validations, or the outer loop that repeats the whole process. Whichever you choose, remember to not write too much at one time. Always add and test functionality incrementally!
    Pseudocode: Although there are several valid ways to write the program, the following is an outline of one way to design the overall logic.
    Declare and initialize variables: name, city, judge score, highest score, lowest score, total score
    Loop while there are dives to process
    Get diver's name and city
    Get degree of difficulty
    Loop to validate input
    End Loop
    Loop five times to get judges' scores
    Loop to Validate input
    End Loop
    Update highest and lowest scores if need be
    Add score to total score
    End Loop Calculate the final score (subtract highest and lowest scores from total score, divide by 3, multiply by degree of difficulty) Display the diver's information and final dive score Prompt the user if he or she wants to process another dive
    End-Loop

    Learn More
  2. CIS 170 Week 4 iLab 4 Phone Dialing Program

    CIS 170 Week 4 iLab 4 of 7 Methods Phone Dialing Program

    $15.00

    CIS 170 Week 4 iLab 4 of 7 Methods Phone Dialing Program

    Scenario/Summary
    You will code, build, and execute a program that simulates the dialing of a phone using methods.

    Phone Dialing Program
    Your mission: A prepaid phone service needs a program that converts alphanumeric keyboard input into a phone number. The user will input eight characters and the program will output either an error message or the translated seven-digit phone number. The input may contain digits, letters, or both. Letters can be uppercase or lowercase.
    The program will perform the conversion per a standard telephone keypad layout.
    0
    1
    2
    A B C
    3
    D E F
    4
    G H I
    5
    J K L
    6
    M N O
    7
    P Q R S
    8
    T U V
    9
    W X Y Z

    The program implements the following methods.
    Main(): Declares seven character variables and passes these to the following methods by reference:
    ProcessInput(): gets user input and performs the conversion
    ShowResults(): displays the results
    GetInput(): Gets seven characters from the user and stores them into the seven variables Main() has passed by reference.
    ProcessInput(): Calls ToDigit() for each, passing each character variable by reference, and returns one of these codes to Main() by value:
    0 if there were no input errors
    -1 if there were input errors

    Input errors include the following:
    The first character is 0 (seven-digit phone numbers can't start with 0).
    The first three characters are "555" (no phone numbers start with 555).
    Any character is not a digit or an uppercase or lowercase letter.
    ToDigit(): Converts a character (passed by reference) to its corresponding digit per the table above, and returns one of these codes to ProcessInput() by value:
    0 if the character is valid (a digit or uppercase or lowercase letter)
    -1 if the character is not valid
    ShowResults(): Writes converted telephone number to the screen, inserting a dash (-) between the third and fourth digits, and accepts the seven character variables from Main() by reference.

    Sample Output:
    Enter a 7 character phone number: 2132121
    The converted phone number is: 213-2121
    Enter a 7 character phone number: 2scdfER
    The converted phone number is: 272-3337
    Enter a 7 character phone number: 555resw
    Invalid input, please try again.
    Enter a 7 character phone number: 0988765
    Invalid input, please try again.
    Enter a 7 character phone number: 12345678
    Invalid input, please try again.
    Enter a 7 character phone number: @34*uy
    Invalid input, please try again.

    Tips
    Best practice: Don't try to write too much at a time! First, write an outline in comments based on the requirements and the pseudocode. Then, implement declaring seven char variables. Make sure to fix any compiler errors before implementing more. Then, write and call an empty GetInput() method that accepts parameters, but does nothing but return a dummy value. Make sure you can pass the seven character variables by reference without compiler errors before implementing any of the GetInput() logic. Keep working incrementally like this, testing as you go. Set breakpoints and use the debugger at each phase to make sure your logic is working correctly. Then, use the same approach to implement the other methods. Test each phase with valid input before handling any invalid conditions.

    Pseudocode
    ProcessInput( ) Method
    Get 7 characters from the user and store them in the 7 variables that Main() has passed by reference
    Call ToDigit() for each of the 7 characters
    If toDigit returns an error code (-1), return an error code (-1)
    If the first character is 0, return an error code (-1) to Main()
    If the first three characters are 555, return an error code (-1)
    If there are no errors, return 0
    ToDigit ( ) Method
    Convert the characters (passed from ProcessInput() by reference) to upper case
    Use a switch statement to translate characters into their corresponding digits.
    Write a case statement for each digit and for each valid uppercase letter
    Write a default case that returns an error code (-1) for invalid letters
    If there are no invalid letters, return 0
    ShowResults ( ) Method
    Display the Phone Number using the character variables Main() has passed by reference
    Main() Method
    Declare 7 char variables
    Get user input by calling the GetInput() method, passing it the 7 variables by reference
    Perform the conversion by calling the ProcessInput( ) method, passing it the 7 variables by reference
    Display an error message or call ShowResults(), depending on the code ProcessInput() returns

    END OF LAB

    Learn More
  3. Pizza Parlour Splash Screen

    Pizza Parlour Visual Basic Program

    $20.00

    Pizza Parlour Visual Basic Program

    I need to create an order form for ordering pizzas. the first screen should be splash screen that displays the name of the Pizza Parlour, a picture and my name and date I created the project.

    It should then go to a main form that has the same picture and a menu at the top. The menu should show Order Pizza as the first menu item, Display the Specials as the second menu item and Exit as the third menu item across the top. When the user clicks the first option, a form will be displayed for them to order the pizza they want, for the second one, a form should be displayed to display the specials for the day. When they click on Exit, the program ends with a nice little message telling them, “Goodbye”.

    When the user selects the menu option to Order Pizza, the main form should close and the new form should be displayed. On this form I need the following components.
    - A textbox to allow them to enter the number of pizzas they want
    - Three radio buttons to allow the user to select the size of the pizza where the first one is small for 6.00, the second one is medium for 8.00 and the third one is large for 10.00.
    - Three radio buttons for the type of crust they want. , ex. Thin, Thick and
    - Display a message that the first topping comes with the price of size of the pizza but every topping after that is 1.00 extra.
    - Display a minimum of 8 check boxes for different toppings.
    - I need a button that displays a message like, Make my order!
    - When the button is pressed, you will add the choices starting with the price, then the size and then the crust type and all of the toppings they chose into an array.
    - You are to then close this form and open another form to display the selections.

    In this form (called from step 3 to display the selections, I need to put the same menu at the top as is on the first form in step 2..
    - I need a combobox of email addresses on the screen where the person will select their email address.
    - Also, a button under this stating, Show Order.
    - I need to create a data connection to the customer table in the PizzaDelivery Access database. I want to copy the table from the solution explorer right onto the form to create a grid which will display the name of the customer whose email address has been selected. The grid should not be displayed until after the button has been pressed.
    - After the customer data has been displayed, I need to fill a listbox with the contents of the array created in the last form to show the user what they ordered.
    - Then it should display the total amount due. This includes the sales tax of .06 and any additional items the user selected for toppings.
    - The datagrid, listbox and button and label to display the total should all be hidden until the user has entered the email address.

    Next is the form to display the specials for the day. On this form as in the last, I need to copy the menu from the form in step 2 to the top.

    I need to have a label telling the user to select which, if any, specials they want. They are to click the Calculate Total button displayed at the bottom, to get the number of items selected and how much it would cost.

    In here, I need to copy the contents from a sequential file called specials.txt into a list box. The sequential file should contain descriptions and prices. I need at least 6 of each.

    Example:
    3 large pepperoni pizzas with Coke
    15.60 would be displayed in the list box.

    Once they select the Calculate Total button, they are shown the number of items they selected and the total including tax.
    For every amount entered in a text box, it must be validated in a subprogram and they must select something from the size and crust type for the pizza order.

    Learn More
  4. CIS407 Lab 1 Week 1 Annual Salary Calculator ASP.NET Web Application

    CIS407 Lab 1 Week 1 Annual Salary Calculator ASP.NET Web Application

    $10.00

    This course has expired to download the latest version of CIS407A Labs click here

    CIS 407 iLab 1 of 7: "Annual Salary Calculator" ASP.NET Web Application

    iLAB OVERVIEW
    Scenario/Summary
    In this iLab, you will create an Annual Salary Calculator ASP.NET web application using Visual Studio.NET 2008.
    For the iLabs, you will use the Microsoft Visual Studio 2008 software application. You have two options for using this application:
    • You may use a copy of Visual Studio 2008 that is installed on your local PC. If you do not already have this software, there is a link in the Syllabus (in the Textbook and Required Materials section) that you can follow to obtain a copy at low or no cost through the DeVry Student Software Fulfillment Center.
    or
    • You may run Visual Studio 2008 over the Web from the DeVry iLab (Citrix) server. Instructions for using the iLab (Citrix) server are on the iLab page under Course Home.
    Throughout this course, you will be creating a web application for a fictitious company called CoolBiz Productions, Inc. To get familiar with the development environment, follow the Lab Steps to create a simpleAnnual Salary Calculator ASP.NET web application. You will be adding to this application each week.
    Instructions for Week 1 iLab: "Hello World, and more" ASP.NET Web Application
    Click on the link above to view the tutorial.
    Please watch this tutorial before beginning the iLab.
    The tutorial has audio.

    Overview of Fictitious Company
    CoolBiz Productions, Inc.
    We are a mid-size indie (independent) film studio that is in need of a payroll system. We have outgrown our current system, a simple spreadsheet, to the extent that it takes three people over one week to pay everyone on a timely basis.
    Overview of Our Company
    We have over 2,000 full-time and part-time employees. We produce comedy, fiction, and science fiction films with budgets of $250K–$20 million. We have produced over 50 films since we first began 20 years ago.
    We are very profitable and have strong links to many of the industry's most powerful people.
    Current Payroll System
    Our current system consists of mostly manual processing using an MS Excel spreadsheet to control who gets paid.
    The system consists of the three payroll staff members reviewing each of the full-time staff members' wages, calculating how many hours they worked based on their hourly rate, and paying them by issuing a check.
    The check needs to be entered in another worksheet for each of the people who were paid so that we can tell when it went out, how much it was for, and if it was cashed or not. If a [Date_Cashed] is entered, we deduct that amount from our working payroll capital account to track how much money we have for payroll.
    This process is then repeated for all part-time staff and independent contractors.
    Our Needs
    We need a more automated way to pay our staff. We need to use the same logical flow as a basis, yet improve on it by having a way to
    1. easily calculate the projected annual salary based on rate and number of hours;
    2. search, enter, update, and delete staff and independent employee information in one place;
    3. search, enter, update, and delete payroll automation information for the employee to set up recurring payments or one-time payments;
    4. produce reports to show the following: (a) summary of who got paid per week, (b) summary of all payments per week, (c) details of any employee to-date (allow entry of a specific employee ID);
    5. allow transactions to be rolled back in case we pay someone too much;
    6. make use of transaction processing in case the system unexpectedly shuts down;
    7. ensure the system is secure (logins required);
    8. allow only authorized payroll personnel to control all aspects of the system;
    9. allow only authorized payroll personnel to view transactions and user activity;
    10. allow only authorized payroll personnel to e-mail reports to users using the e-mail on file; and
    11. incorporate error handling into all processes in the system and e-mail any errors to the technical support people.

    Deliverables
    All files are located in the subdirectory of the website. The website should function as follows: You should have a page that, when run, displays a page showing the text "Hello, World." You should also have a second page that is the annual salary calculator that properly calculates the annual salary, given an hourly rate and the number of hours projected to be worked in a year. Once you have verified both pages work, save your website, zip up all files, and submit in the Dropbox.

    iLAB STEPS
    STEPS 1 through 3: Create Website and Home Page (10 points)
    In this ilab, we will learn how to create a simple ASP.NET web application using Microsoft Visual Studio.NET 2008. The application will display the text "Hello, World" on the home page.
    1. Open Microsoft Visual Studio 2008.
    2. Create a new ASP.NET website called "PayrollSystem." To do this, select "File, New Website."
    When the "New Website" dialog opens, select "ASP.NET Website" as the Template, select "File System" as the Location, and select "Visual C#" as the Language. Click Browse and navigate to the folder where you want to save your website. Add "PayrollSystem" at the end of the file path. Click OK if you are prompted to create a new folder. Click OK in the New Website dialog to finish creating the website.
    3. Edit the Default.aspx file (the home page for your site) to add the message "Hello, World." To do this, if necessary, click the Design button below the editing window to switch to Design view, then click in the editing window and type "Hello, World" (without the quotes).
    Click the Save button on the toolbar to save the changes to Default.aspx.

    STEPS 4 through 5: Start Debugging (10 points); NOTE: Citrix users have different steps!
    4. To ensure that everything is working properly, click the Start Debugging button on the toolbar, or press the F5 key on the keyboard, or pull down the Debug menu and select "Start Debugging."
    5. If the "Debugging Not Enabled" dialog box appears, select the option to add or modify the Web.config file to enable debugging and click OK. You should only have to do this the first time you debug the site.
    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

    STEP 6 through 7 : Display the "Hello, World" web page (10 points)
    6. The Internet Explorer web browser will open and display your Default.aspx page containing the "Hello, World" message.
    7. Click here for text description of this image.
    8. Stop debugging and return to the design mode by closing the browser.
    9. Add a new form to your web application called frmSalaryCalculator.aspx. Make sure "Place Code in separate file" is checked when you add the form. To add a new form, click (single-click, not double-click) on the project node in the solution explorer.
    With the project node highlighted, right-click on the project node and select "Add New Item" from the popup menu. The following dialog will be displayed:
    Select the name of the form you will add frmSalaryCalculator.aspx. Make sure "Place code in separate file" is checked and "Select master page" is unchecked.
    10. You will create a web-based salary calculator on this new page. To do this, open the aspx page in Design view and, from the Toolbox, add three labels, two text box controls, and a button control. You can add controls by dragging the control from the Toolbox – Standard section onto your form. Your form should look like this:
    11. Change the text displayed in each label so that the first label displays "Annual Hours"; the second label should display "Rate" and the third label should display "$". (Hint: To change the text displayed, change the Text property of each control.)
    12. Change the button text to display "Calculate Salary." (Hint: To change the text displayed as the button label, change the Text property of the button.) Your form should now look like this:
    13. Set the ID property of the top text box to txtAnnualHours. Set the ID property of the second textbox to txtRate. Set the ID of the bottom label (the one we set the text property to "$") to lblSalary. (Note: We set these IDs as we will be accessing the control values from the C# code. You can set the button ID and the other two labels' ID properties as well, but we won't be accessing them from our code.)
    14. In Design view, add a C# event handler for the button-click event by double-clicking on the Calculate Salary button. This will place you in the page code behind file the editor. (Remember that ASP.Net pages have a file containing the HTML markup with an extension of .aspx and a C# 'code behind' file with an extension of .aspx.cs.) This is the code that should be displayed: (If you changed the ID of the button, it will be a different method name.)
    This code will be called each time the user presses the button. It is important to remember that code in the code behind page executes on the server – not on the user's browser. This means that when the button is pressed, the page is submitted back to the web server and is processed by the ASP.Net application server on the web server. It is this code (between the { and } in this method) that will execute on the server. Once it is done executing the page will be sent back to the browser. Any changes we make to the page or controls on the page will be shown to the user in the updated page.
    15. In this method, add code that will get the text in the txtAnnualHours text box, convert it to a Double, and store it in a double variable. Add code that will get the text from the txtRate text box, convert it to a Double, and store it in another variable. Create a third variable of type Double and set its value to the annual hours variable value multiplied by the rate double variable value. Take this resulting value and convert it to a string (text), and update the lblSalary Text property with this new string.
    Hints: A control's property can be accessed by simply using the control ID followed by a . followed by the name of the property. For example, the value stored in the Text property of the txtAnnualHours control can be accessed by using this: txtAnnualHours.Text. Text properties on controls are of type string.
    To convert a string to a Double you can use the Convert class. If we had a string variable called str1 and a double variable called myNumber, the C# code to convert this would be as follows:
    When converting from one type to another, we are assuming that the value stored in the type being converted is compatible with the type we are converting to. In the example above, if the value stored in str1 was not type compatible with a Double (for example "tiger") an error would be raised.
    To set the value of a control on a web form, you can access the control and set the property directly. If I had a label control called lblCar and I wanted to update the text that was displayed in the label, I could do something like this:
    Note that following code would be incorrect and cause an error:
    lblCar is a Label – it isn't a string so we can't assign a string directly to it, but we can assign a string directly to the Text property of the label.
    All of the base types in C# (double, int etc) have a ToString() method you can call. If you had a double variable that you wanted to convert to a string and set that string to my label's text, you would do the following:
    This would take whatever value was stored in the myNumber Double and convert it to a string.
    To add a $ to output you can use string concatenation in C# like this:
    16. Set your new form as the start page by clicking once on the form name in the Solution Explorer and then right-clicking on the form name and selecting "Set as Start Page." You can now test your application and make sure it works correctly as you did with the Hello World form above. You can switch back and forth between which form runs when you run your application by setting the different forms as the start page.
    Once you have verified that your project works, save your project, zip all files, and submit in the Dropbox.
    NOTE: Please download and review the Doc Sharing files Web Lab and Citrix.zip, which contain information on how to FTP to the DeVry University website and how to use Citrix for the assignments.

    Learn More
  5. CIS407 Lab 3 Week 3 frmMain Web Form

    CIS407 Lab 3 Week 3 User activity monitoring ASP.NET Web Application

    $12.00

    This course has expired to download the latest version of CIS407A Labs click here

    CIS 407 iLab 3 of 7: User activity monitoring

    iLAB OVERVIEW
    Scenario/Summary
    In this lab, we will demonstrate how to save user activity data in a database. We will be creating a new form to display the user activity data, a new dataset to contain the data, a data access class to structure the code, and a function within the data access class to save users' activity data when users visit the Personnel form page (frmPersonnel.aspx). We will also be adding server side validation to the frmPersonnel for you added in the previous lab and update or main menu for the new functionality. INCLUDE A SCREENSHOT OF THE ASSIGNMENT SUCCESSFULLY RUNNING TO RECEIVE CREDIT

    Deliverables
    All files are located in the subdirectory of the project. The project should function as specified: When you visit the Personnel form page (frmPersonnel.aspx), a record should be saved in the tblUserActivity table with the IP address, form name accessed (frmPersonnel), and the date accessed. When you click the "View Activity" button, you should see at least one record with this information. When the user goes to the frmPersonnel web form and enters data the following business rules are to be enforced:
    • Fields may not be empty or filled with spaces. If any field is empty, turn that field background color to yellow and add to/create an error message to be shown in the error label.
    • The end date must be greater than the start date. If the end date is less than the start date turn both date fields yellow and add to/create an error message to be shown in the error label.
    If all fields validate properly, then the session state items should be set properly and the user should see the frmPersonnelVerified form with all the values displayed. You will also add a new item to frmMain that will take the user to the new frmUserActivity form you added. Add the proper link and a hyperlinked image to allow the user to select this new option. Once you have verified that everything works, save your website, zip up all files, and submit in the Dropbox.

    iLAB STEPS
    STEP 1: Data Connection, Dataset and Data Access Class (10 points)
    1. Open Microsoft Visual Studio.NET 2008.
    2. Open the PayrollSystem website by clicking on it in the Recent Projects list, or by pulling down the File menu, selecting Open Website, navigating to the folder where you previously saved the PayrollSystem, and clicking Open.
    3. Download the PayrollSystem_DB.MDB file from Doc Sharing and save it on your local computer. (Note: your operating system may lock or block the file. Once you have copied it locally, right click on the file and select Properties and then Unblock if available). Then add it to the PayrollSystem website as follows: In Visual Studio, in the Solution Explorer click Website, Add Existing Item, then navigate to the PayrollSystem_DB.MDB file you downloaded and click the Add button.
    4. Now we need to create a new connection to the PayrollSystem_DB.MDB. To begin, click View Server Explorer.
    5. When the Server Explorer toolbox appears, click the Connect to Database button.
    6.When the Add Connection dialog appears, click the Change button. In the "Change Data Source" dialog, select MS Access Database File; Uncheck Always use this Selection; then click OK.
    7. Click the Browse button to navigate to the PayrollSystem_DB.mdb file in your website folder, then click "Open". (NOTE: Be sure you select the PayrollSystem_DB.mdb file in your PayrollSystem website folder, not the one you originally downloaded from Doc Sharing!) Click Test Connection. You should receive a message that the test connection succeeded. Click OK to acknowledge the message, then click "OK" again to close the Add Connection dialog.
    8. The PayrollSystem_DB.mdb should be added to the Server Explorer. Expand the database, then expand the Tables entry under the database until you see tblUserActivity. Leave the Server Explorer window open for now as you will be returning to it in a moment.
    9. Create a new dataset by selecting Website Add New Item. Under Templates, select the Dataset item. Enter dsUserActivity.xsd for the name. Click Add.
    10. Click here for text discription of this image.
    11. If the following message appears, select Yes. You want to make this dataset available to your entire website.
    12. If the TableAdapter Configuration Wizard dialog appears, click Cancel. (We will be configuring a Data Adapter for this dataset later in C# code, so we do not need to run this wizard.)
    13. Drag-and-drop the tblUserActivity table from the Server Explorer window into the dsUserActivity dataset in the editor window.
    NOTE: If you see a message that says your connection uses a local data file that is not in the current project, that indicates you did not select the correct PayrollSystem_DB.mdb file when you created your data connection. To fix this problem, click No, then right-click on PayrollSystem_DB.mdb in the Server Explorer window and choose Modify Connection. Click the Browse button, navigate to the PayrollSystem_DB.mdb file that is in your PayrollSystem website folder, and click Open. Test the connection, then click OK.
    14. Click the Save icon on the toolbar to save the dsUserActivity.xsd dataset.
    15. Click here for text discription of this image.
    16. (You can now close the Server Explorer window if you wish.)
    17. Create a new class to contain the C# code that will access this dataset. To do so, click Website, Add New Item. In the Add New Item dialog, select the Class template, and enter clsDataLayer for the name. Make sure the Language is set to Visual C#. Click "Add".
    18. Click here for text discription of this image.
    19. If the following message appears, select Yes. You want to make this class available to everything in your solution.
    20. Add the following to the top of your class, below any other using statements created for you by Visual Studio:
    // Add your comments here
    using System.Data.OleDb;
    using System.Net;
    using System.Data;
    21. Add the following three functions inside the squiggly braces for the "public class clsDataLayer" class, above the beginning of the "public clsDataLayer()" constructor:
    // This function gets the user activity from the tblUserActivity
    public static dsUserActivity GetUserActivity(string Database)
    {
    // Add your comments here
    dsUserActivity DS;
    OleDbConnection sqlConn;
    OleDbDataAdapter sqlDA;
    // Add your comments here
    sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" +
    "Data Source=" + Database);
    // Add your comments here
    sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn);
    // Add your comments here
    DS = new dsUserActivity();
    // Add your comments here
    sqlDA.Fill(DS.tblUserActivity);
    // Add your comments here
    return DS;
    }
    // This function saves the user activity
    public static void SaveUserActivity(string Database, string FormAccessed)
    {
    // Add your comments here
    OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" +
    "Data Source=" + Database);
    conn.Open();
    OleDbCommand command = conn.CreateCommand();
    string strSQL;
    strSQL = "Insert into tblUserActivity (UserIP, FormAccessed) values ('" +
    GetIP4Address() + "', '" + FormAccessed + "')";
    command.CommandType = CommandType.Text;
    command.CommandText = strSQL;
    command.ExecuteNonQuery();
    conn.Close();
    }
    // This function gets the IP Address
    public static string GetIP4Address()
    {
    string IP4Address = string.Empty ;
    foreach (IPAddress IPA in
    Dns.GetHostAddresses(HttpContext.Current.Request.UserHostAddress)) {
    if (IPA.AddressFamily.ToString() == "InterNetwork") {
    IP4Address = IPA.ToString();
    break;
    }
    }
    if (IP4Address != string.Empty) {
    return IP4Address;
    }
    foreach (IPAddress IPA in Dns.GetHostAddresses(Dns.GetHostName())) {
    if (IPA.AddressFamily.ToString() == "InterNetwork") {
    IP4Address = IPA.ToString();
    break;
    }
    }
    return IP4Address;
    }

    STEP 2: frmUserActivity, frmPersonnel, frmMain (10 points)
    18. Create a new Web form called frmUserActivity. Switch to Design Mode and add a Label and GridView (found under the Toolbox, Data tab) having the following properties:
    Property Value
    Label - Text User Activity
    GridView - (ID) grdUserActivity
    19. Go to the Page_Load method and add the following code:
    if (!Page.IsPostBack) {
    // Declares the DataSet
    dsUserActivity myDataSet = new dsUserActivity();
    // Fill the dataset with what is returned from the function
    myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_DB.mdb"));
    // Sets the DataGrid to the DataSource based on the table
    grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"];
    // Binds the DataGrid
    grdUserActivity.DataBind();
    }
    20. Open the frmMain form, add a new link button and image button to point to the new frmUserActivity. Find an image to use for the image button and add the new option as View User Activity.
    21. Go to the frmMain Page_Load and add the following code:
    // Add your comments here
    clsDataLayer.SaveUserActivity(Server.MapPath("PayrollSystem_DB.mdb"), "frmPersonnel");
    22. On the frmUserActivity form, add the CoolBiz logo hyperlinked logo at the top of the page so that when clicked the user is returned to frmMain.
    23. In the Solution Explorer, right click on the frmMain.aspx form and select Set As Start Page. Run your project. When you open the project, a record should be saved in the tblUserActivity table with the IP address, form name accessed (frmPersonnel), and the date accessed. When you click the View Activity button, you should see at least one record with this information.
    24. You will now add server side validation code to the frmPersonnel page. Currently, when the Submit button is pressed, the frmPersonnelVerified page is displayed. This is because the frmPersonnelVerified page is set as the Submit button's PostBackUrl property. Instead of having the page go directly to the frmPersonnelVerified page when the Submit button is pressed, we want to do some server side validation. If any of the validation rules fail, we will redisplay the frmPersonnel page with the fields in question highlighted in yellow with an error message displayed.
    First, it is important to understand what is currently happening when the submit button is pressed. This is causing a postback of the form to the frmPersonnelVerified form. When this postback happens, all of the data in the fields on the frmPersonnel form are sent to the frmPersonnelVerified form as name value pairs. In the Page_Load code of frmPersonnelVerified these values are picked up from the Request object and displayed. Each name value pair will be in the Request object as the ID of the control containing the value and the value itself. We can pass data between pages by using Session state instead. In order to do validation on the values but still have the values visible on the frmPersonnelVerified page, we will need to change not only the PostBack URL of the frmPersonnel page but also how the frmPersonnelVerified form is getting the data – it will need to get it from Session state rather than from the Request object.
    Make the following changes:
    1. Clear the Submit button PostBackURLProperty on the frmPersonnel form.
    2. In the btnSubmit_Click event handler get each value from the data entry fields and set Session state items for each.
    3. Change the frmPersonnelVerified code behind to get the values from the Session state items you created in the previous step.
    When you are done with these steps, you should be able to enter data on the frmPersonnel data entry form and then click the Submit button. The frmPersonnelVerified page should then be displayed with the values that were in the data entry fields on frmPersonnel.
    Make sure this is all working before proceeding to the next steps.
    25. Add a label to the frmPersonnel form with an ID of lblError. Do not place the label to the right or left of any of the controls on the form. Add it below the controls or above the controls. The text property of this label should be set to an empty string.
    26. Add code to perform server side validation in response to the submit button being clicked. Here are the business rules we want to enforce (remember this will be server C# code in the frmPersonnel code behind): Fields may not be empty or filled with spaces. If any field is empty, turn that field background color to yellow and add to/create an error message to be shown in the error label. The end date must be greater than the start date. If the end date is less than the start date, turn both date fields yellow and add to/create an error message to be shown in the error label. If all fields validate properly then the session state items should be set properly and the user should see the frmPersonnelVerified form with all the values displayed.
    27. Lab Hints: To set a value in session state do the following:
    Session["txtFirstName"] = txtFirstName.Text;
    28. "txtFirstName" is the key and txtFirstName.Text is the value.
    29. To get this same value back from the session we use the key and the Session object as follows:
    Session["txtLastName"].ToString()
    30. There is a Trim method on the string object that will automatically remove spaces from the beginning and end of a string. Remember, you can turn an object like a Session item object into a string using the Convert class or just using it's ToString() method.
    31. You may want to create variables to work with for validation rather than using the Request item objects directly.
    32. To turn a string into a DateTime object you can use the DateTime method Parse. If you had a date value stored in a string called strDate, you could turn it into a DateTime object like this:
    DateTime myDateTimeObject = DateTime.Parse(strDate);
    33. You can compare two DateTime objects by using the DateTime.Compare method. If you had two DateTime objects called dt1 and dt2 you can check to see if dt1 is greater than dt2 by doing this:
    if (DateTime.Compare(dt1,dt2) > 0)
    34. DateTime.Compare will return a 0 if the two dates are equal, a 1 if dt1 is greater than dt2, and a -1 if dt1 is less than dt2.
    35. If you put in an invalid date for either of the date fields, you will get an exception/server error when trying to parse the values. We will address this in a later lab – for now make sure you enter valid dates (valid meaning a date in the form of mm/dd/yyyy).
    36. If I had a TextBox control that was called txtAge and you wanted to set it's background color you could do this:
    txtAge.BackColor = System.Drawing.Color.Yellow;
    37. Remember to clear the PostBackURL property of the submit button!

    STEP 3: Verify and submit (10 points)
    28. View the video above on what functions your lab should have so far.
    29. Run your project. When you open the project, and go to the main menu form a record should be saved in the tblUserActivity table with the IP address, form name accessed (frmPersonnel), and the date accessed. When you click the View Activity button you should see at least one record with this information. The validation and error display should work for entering data. All navigation and hyperlinks should work.
    Once you have verified that it works, save your project, zip up all files, and submit in the Dropbox.

    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 five point deduction per item (form, class, function) will be made. You basically put two forward slashes, which start the comment; anything after the // on that line is disregarded by the compiler. Then type a brief statement describing what is happening in following code. 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.

    Learn More
  6. CIS407 Lab 4 Week 4 frmMain Web Form

    CIS407 Lab 4 Week 4 Web forms with database interaction ASP.NET Web Application

    $12.00

    This course has expired to download the latest version of CIS407A Labs click here

    CIS 407 iLab 4 of 7: Web forms with database interaction

    iLAB OVERVIEW
    Scenario/Summary
    In this lab, we will start with the form we created in Week 2 (frmPersonnel) and add functionality to INSERT records into a database table and SELECT records for display to the user. We will create a typed dataset, a Data Layer class, several functions to access the data, and a connection to a database. We also will add a search form to allow the user to search records in the database and display the results of that search.
    Instructions for Week 4 iLab: Web Forms with Database Interaction

    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 having the FirstName, LastName, PayRate, StartDate, and EndDate you entered on the form. Add a search feature to the project. Update your main navigation page with the new options. Once you have verified that it works, save your website, zip up all files, and submit it in the Dropbox.

    iLAB STEPS
    STEP 1: Data Layer (10 points)
    1. Open Microsoft Visual Studio.NET 2008.
    2. Click the ASP.NET project called PayrollSystem to open it.
    3. Open the clsDataLayer class and add the following function:
    // This function saves the personnel data
    public static bool SavePersonnel(string Database, string FirstName, string LastName,
    string PayRate, string StartDate, string EndDate)
    {
    bool recordSaved;
    try {
    // Add your comments here
    OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" +
    "Data Source=" + Database);
    conn.Open();
    OleDbCommand command = conn.CreateCommand();
    string strSQL;
    // 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();
    // Add your comments here
    conn.Close();
    recordSaved = true;
    } catch (Exception ex) {
    recordSaved = false;
    }
    return recordSaved; }
    4. In the frmPersonnelVerified form, go to the Page_Load() event and add the following code after the existing code (but in the Page_Load event handler):
    // Add your comments here
    if (clsDataLayer.SavePersonnel(Server.MapPath("PayrollSystem_DB.mdb"),
    Session["txtFirstName"].ToString(),
    Session ["txtLastName"].ToString(),
    Session ["txtPayRate"].ToString(),
    Session ["txtStartDate"].ToString(),
    Session ["txtEndDate"].ToString()))
    {
    txtVerifiedInfo.Text = txtVerifiedInfo.Text +
    "\nThe information was successfully saved!";
    }
    else
    {
    txtVerifiedInfo.Text = txtVerifiedInfo.Text +
    "\nThe information was NOT saved.";
    5. Add comments for all code containing // Add your comments here.
    6. Test your work to make sure no errors occur! (Make sure to put in valid date values for the date data entry fields).

    STEP 2: Data Display and Search (10 points)
    7. Using the skills you learned in Week 3, create a new DataSet for the tblPersonnel table (called the DataSet dsPersonnel).
    8. Using the skills you learned in Week 3, create a new function called GetPersonnel in the clsDataLayer class. This function should retrieve all data from the tblPersonnel table and return it in the form of a dsPersonnel DataSet. Use the GetUserActivity function as an example.
    9. Create a new Web form called frmViewPersonnel.
    10. Using the skills you learned in Week 3, add a GridView control (called grdViewPersonnel) to the form. This GridView control will be used to display data from the tblPersonnel table. Add the CoolBiz logo at the top of the page and make sure it links back to frmMain.
    11. Add the following code to the Page_Load() function in frmViewPersonnel:
    if (!Page.IsPostBack) {
    // Declare the DataSet
    dsPersonnel myDataSet = new dsPersonnel();
    // Fill the dataset with what is returned from the function
    myDataSet = clsDataLayer.GetPersonnel(Server.MapPath("PayrollSystem_DB.mdb"));
    // Set the DataGrid to the DataSource based on the table
    grdViewPersonnel.DataSource = myDataSet.Tables["tblPersonnel"];
    // Bind the DataGrid
    grdViewPersonnel.DataBind();
    }
    12. Return to the frmPersonnel Web form and add a button ((ID) = btnViewPersonnel, Text = View Personnel) which, when clicked, will display form frmViewPersonnel.
    13. Using the skills you learned in Week 3, open the frmPersonnelVerified form and add a button ((ID) = btnViewPersonnel, Text = View Personnel) which, when clicked, will display form frmViewPersonnel. NOTE: This is the same button with the same functionality that you added to form frmPersonnel in the previous step. Also add a new link and linked image to frmMain called View Personnel that will go to the new frmViewPersonnel page you created.
    14. You will now add a search feature to allow the user to find and display data. The user will enter a last name and the web application will display the grid of employees with all employees that match that last name.
    15. Create a new web form called frmSearchPersonnel. Add the hyperlinked Cool Biz logo to this page. Also add a new item on frmMain (with a link button and image button) called Search Personnel.
    16. On the frmSearchPersonnel form, add a label that displays "Search for employee by last name:". Next to the label, add a text box with an ID of txtSearchName. Add a button with an ID of btnSearch and set the text of the button to "Search".
    17. When the frmSearchPersonnel Search button is pressed, the frmViewPersonnel is displayed. At this point, no searching is actually happening, but you have the forms you need and the navigation working. Now you can focus on the coding you will need to do to have the grid only display matching employees.
    18. Before calling the GetPersonnel method you added previously in the lab, get the value that is in the Request["txtSearch"] item. When the form posts the search page results to the frmViewPersonnel, the name value pair for the search value is passed as part of the Request object. Assign this value to a string variable.
    19. Modify the GetPersonnel method you added to include a new parameter called strSearch of type string. This parameter needs to be after the Database string parameter that is already in the method.
    20. When calling the GetPersonnel method, pass the value you received to the strSearch parameter.
    21. In the GetPersonnel method, you now need to use the passed in strSearch parameter value as part of the SQL string being used to retrieve data. You also need to add logic so that, if strSearch is empty or has no value, all employees are returned in the query.
    22. Test the search so that when you enter a last name, employees with that last name are returned. Make sure that when you access frmViewPersonnel and you are not searching, all employees are returned.
    23. Lab Hints:
    Make sure you re-establish your database connection if you copied the files from a previous lab.
    Before you pass the search value into the GetPersonnel method, make sure you check to see if the Request item is null. If it is, you need to pass an empty string into the method or check for null inside the method. If you don't do this, you will get a server error. To check to see if an object is null, you compare the object to the keyword null.
    To create an SQL statement that will search for a given last name in the tblPersonnel table, you can do the following (assume that the search variable was called strSearch).
    "select * from tblPersonnel where LastName = '" + strSearch + "'"
    24. Add the new Search option and the View Employees option to your main navigation page.

    STEP 3: Test and submit (10 points)
    Run your project and test it as follows:
    The frmMain form should be displayed first (set this form as your start page).
    Homepage
    Click on the Add New Employee hyperlink to go to the frmPersonnel data entry form. Click the View Personnel button on this form. The frmViewPersonnel form should be displayed in the browser, but at this point, there should not be any personnel listed (because you haven't entered any yet).
    Use the Back button in your web browser to return to the frmPersonnel form and enter some personnel data, similar to the following:
    Entering Personnel Data
    Now click the Submit button. The frmPersonnelVerified form should be displayed, showing the data you entered, and you should get a message saying that the data was successfully saved, like this:
    Verifying Personnel Data
    Finally, click the View Personnel data button on this form. The frmViewPersonnel form should be displayed and should show the personnel record you just entered, retrieved from the database, like this:
    Viewing Personnel Data
    You also should be able to view the employee records by clicking the link on the home page.
    Test the search feature and make sure that entering no search string returns all the data and that typing in a last name will return all employees with the same last name.
    Search
    Search Results
    NOTE: Make sure you include comments in the code provided where specified (where the " // Your comments here" line appears) and for any code you write, or else a five point deduction per item (form, class, function) will be made.

    Learn More
  7. CIS407 Lab 5 Week 5 frmMain Web Form

    CIS407 Lab 5 Week 5 Transaction Processing ASP.NET Web Application

    $12.00

    This course has expired to download the latest version of CIS407A Labs click here

    CIS 407 iLab 5 of 7: Transaction Processing

    iLAB 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 we created last week so that it saves 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 that 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.
    Instructions for Week 5 iLab: "Transaction Processing"

    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 you entered. Test that the transaction will rollback by entering invalid information in one or more items, such as Hello for a StartDate. Check tht 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 to the Dropbox.

    iLAB STEPS
    STEP 1: Modify the clsDataLayer to use a two-step process (10 points)
    1. Open Microsoft Visual Studio.NET 2008.
    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 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, where 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();
    5. 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();
    6. 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 before. To test this, 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 the entered data values, including the PayRate, StartDate, and EndDate, were stored correctly. Close the browser window.
    7. 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:
    frmPersonnel With Bad Data
    8. Click here for text description of this image.
    9. Now when you click Submit, the frmPersonnelVerified form should display a message indicating the record was not saved:
    frmPersonnel Verified With Error Message
    10. Click here for text description of this image.
    11. 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:
    Incomplete Personnel Record
    12. Click here for text description of this image.
    13. 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 (10 points)
    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.
    // 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.Jet.OLEDB.4.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 the 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 the items, the "successfully saved" message should appear indicating that the transaction was committed.
    frmPersonnelVerified After Commit
    9. Click here for text description of this image.
    10. Click the View Personnel button and verify that the new record was in fact added to the database table correctly.
    frmViewPersonnel After Commit
    11. Click here for text description of this image.
    12. 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.
    frmPersonnel Verified After Rollback
    13. Click here for text description of this image.
    14. Click the View Personnel button and verify that this time, as desired, an incomplete record was not added to the database table.
    frmViewPersonnel After Rollback
    15. Click here for text description of this image.
    16. 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 you added in the frmPersonnel code and add a try/catch with logic to prevent an invalid date from causing a server error.
    17. In the Week 3 and Week 5 labs, 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.
    18. Add validation controls to the frmPersonnel form as follows: For the first and last name, make sure each field has data in it. Use the RequiredFieldValidator for this. Add the control to the right of the text box you are validating. The location of the validator control is where the error message (if there is one) will appear for the control you link the validator to. You will be adding one validator control for each text box 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.
    frmPersonnel Validation Controls
    19. Click here for text description of this image.
    20. Remove the View Personnel and Cancel buttons from the frmPersonnel form as they will cause a Postback and invoke the client-side editing 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.
    21. 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. Add a new main form option called Edit Employees. Add the link and image for this. This option will take the user to a new form called frmEditPersonnel.
    frmMain with links added
    22. Click here for text description of this image.
    23. Add the new form frmEditPersonnel. On frmEditPersonnel, add the CoolBiz log at the top of the form. Add a label that says "Edit Employees." Add a GridView control with an ID of grdEditPersonnel.
    24. 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).
    25. 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.
    26. There is a small > indicator in the design view of the SQL Data Source control 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."
    27. Press the New Connection button and select the database.
    28. Press the Next button.
    29. When asked if you want to save the connection in the application configuration file, check the Yes check box and press Next.
    30. Select the tblPersonnel table.
    31. Select all columns (you can use the * for this).
    32. Press the Advanced button and check the Generate Insert, Update, and Delete option and press the OK button.
    33. Press the Next button.
    34. Press the Test Query button and make sure everything works as it is supposed to. If it does not repeat the above steps to make sure you did everything properly. Press the Finish button.
    7. Click on the grid 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!
    Edit Employees
    8. Click here for text description of this image.
    9. Hints: Make sure you re-establish your database connection if you copied the files from a previous lab.
    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$
    Experiment with the editable grid and command buttons for different display styles.

    STEP 3: Test and submit (10 points)
    29. Once you have verified that everything works as it is supposed to, save your project, zip up all files, and submit in the Dropbox.
    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 five point deduction per item (form, class, function) will be made.

    Learn More
  8. CIS407 Lab 7 Week 7 Error Notification Form Login

    CIS407 Lab 7 Week 7 Error Notification via E-Mail

    $12.00

    This course has expired to download the latest version of CIS407A Labs click here

    iLab 7 of 7: Error Notification via E-Mail

    iLAB OVERVIEW
    Scenario/Summary
    In this lab, we will incorporate error handling into the login process so that a notice of each invalid login is automatically e-mailed to the technical support staff.

    Deliverables
    When you try to log in, if your user name is not Mickey, Minnie, or another user you added (that is, if the user name is not found in tblUserLogin), then an e-mail should be sent to the addressrecipient@recipientdomain.com. If the user attempts to bypass the login page by typing a page name in the URL, your web application should redirect the user back to the login page. Once you have verified that it works, save your project, zip up all files, and submit in the Dropbox.
    NOTE: E-mails may be blocked due to firewalls, antivirus software, or even Internet service providers that turned off SMTP because of some known security issues. If the code works (does not produce an error when submitting), you will get full credit for this project even if no e-mail message is actually transmitted. Consult with your instructor before submitting if an error occurs or if no e-mail is generated, to be sure.

    iLAB STEPS
    STEP 1: Business Layer Functionality
    1. Open Microsoft Visual Studio.NET 2008.
    2. Click the ASP.NET website named PayrollSystem to open it.
    3. Create a new class called clsBusiness Layer.
    4. Add the following code in the clsBusinessLayer class:
    // **** Add the following at the top of the class file,
    // Add your comments here
    using System.Net.Mail;
    //**** Add the following code inside the body of public class clsBusinessLayer ****
    public static bool SendEmail(string Sender, string Recipient, string bcc, string cc,
    string Subject, string Body)
    {
    try {
    // Add your comments here
    MailMessage MyMailMessage = new MailMessage();
    // Add your comments here
    MyMailMessage.From = new MailAddress(Sender);
    // Add your comments here
    MyMailMessage.To.Add(new MailAddress(Recipient));
    // Add your comments here
    if (bcc != null && bcc != string.Empty) {
    // Add your comments here
    MyMailMessage.Bcc.Add(new MailAddress(bcc));
    }
    // Add your comments here
    if (cc != null && cc != string.Empty) {
    // Add your comments here
    MyMailMessage.CC.Add(new MailAddress(cc));
    }
    // Add your comments here
    MyMailMessage.Subject = Subject;
    // Add your comments here
    MyMailMessage.Body = Body;
    // Add your comments here
    MyMailMessage.IsBodyHtml = true;
    // Add your comments here
    MyMailMessage.Priority = MailPriority.Normal;
    // Add your comments here
    SmtpClient MySmtpClient = new SmtpClient();
    // Add your comments here
    MySmtpClient.Port = 25;
    MySmtpClient.Host = "127.0.0.1";
    // Add your comments here
    MySmtpClient.Send(MyMailMessage);
    // Add your comments here
    return true;
    } catch (Exception ex) {
    // Add your comments here
    return false;
    }
    }

    STEP 2: Integration
    5. Open the frmLogin web form code behind file and add the following code to the body of the if (dsUserLogin.tblUserLogin.Count < 1) statement, just above the return statement:
    // Add your comments here
    // Add your comments here
    if (clsBusinessLayer.SendEmail("youremail@yourdomain.com",
    "receiver@receiverdomain.com", "", "", "Login Incorrect",
    "The login failed for UserName: " + Login1.UserName +
    " Password: " + Login1.Password))
    {
    Login1.FailureText = Login1.FailureText +
    " Your incorrect login information was sent to receiver@receiverdomain.com";
    }

    6. NOTE: Change the youremail@yourdomain.com and receiver@receiverdomain.com to your e-mail and someone else's e-mail for testing.
    7. Optional: Perform this step only if you are doing this lab using Visual Studio 2008 installed on your own computer, your computer has Internet Information Services (IIS) installed, and you have administrative rights to IIS. If you are doing this lab using the iLab (Citrix) server, or if you do not have access to IIS, skip to step 8.
    Open IIS (Start > Control Panel > Administrative Tools > Internet Information Services), navigate to the Default SMTP Virtual Server, right-click on it, and left-click on Properties.

    8. Click here for text description of this image.
    9. Click the Access tab, then the Relay button, then Add, and add the IP 127.0.0.1. Click OK, OK, and APPLY when finished.

    10. Click here for text description of this image.
    11. We have a security hole in our web application. If you start the web application by going to the login page, you can bypass the login page by simply typing the name of a form in the URL (try it). There is some limited protection because of the check we are doing for user role, but it still allows a user to get to pages we don't want them to get to unless the role is set properly. Add a security check in the Page_Load of each sensitive page (Manage Users, Add New Employee, View User Activity, Edit Employees), check for the Session role item with a value of "A," and, if the user is accessing these pages without the proper permissions, redirect back to the frmLogin.aspx page.
    12. This still leaves the possibility of a person bypassing the login page. We will fix that by using forms authentication. Add the following to the web.config file. (There should already be an authentication section – replace it with this.)
    <authentication mode="Forms">
    <forms loginUrl="frmLogin.aspx" />
    </authentication>
    <authorization >
    <deny users="?" />
    </authorization>
    13. This will redirect users to the login page if they have not yet gone through it for login. This process will use a cookie – when the user successfully logs in in a cookie is set that allows the user to go to other pages. If that cookie is not set then the user is redirected to the login page if they try to go to any other page. Add the cookie code by adding this code in the frmLogin.aspx C# code after each place that you have e.Authenticated = true:
    FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false);
    14. Hints: Make sure you reestablish your database connection if you copied the files from a previous lab. Also, make sure to update the web.config file with the database connection string.
    Update any DataSource controls you added with the new payroll database location.
    When you manually try to go to a second page by skipping the login page, a cookie is set specifying the name of the page you were attempting to go to. Once you login successfully, ASP.Net will automatically attempt to navigate back to that page. You can reset the cookie so that the next page is frmMain, as expected, by typing that page in the URL for the browser before logging in.

    Submit Final Lab (includes all previous lab assignments)
    STEP 3: Test and Submit
    12. Run your project. When you try to log in, enter a user name that is not Mickey or Minnie (i.e., a user name that is not found in tblUserLogin). An e-mail should be sent to therecipient@recipientdomain.com e-mail address.

    Test that frmMain reconfigures properly based on user role. Make sure the user cannot bypass the login page.

    Once you have verified that everything works, save your website, zip up all files, and submit in the Dropbox.

    NOTE: E-mails may be blocked due to firewalls, antivirus software, or even Internet service providers that turned SMTP off because of some known security issues. If the code works (does not produce an error when submitting), you will get full credit for this project even if no e-mail message is actually transmitted. Consult with your instructor before submitting if an error occurs or if no e-mail is generated. It is expected that no e-mail will be sent if you are using the DeVry iLab (Citrix) server for this lab or if you were not able to configure IIS in step 7.

    NOTE: Make sure you include comments in the code provided where specified (where the " // Add your comments here" is mentioned), including code you wrote, or else a 5 point deduction per item (form, class, function) will be made.

    Learn More
  9. Penn Foster Final Graded Project 03784400 Hangman Game

    Penn Foster Final Graded Project 03784400 Hangman Game

    $25.00

    Penn Foster Final Graded Project 03784400 Hangman Game

    OVERVIEW
    Now that you've completed the lessons and required textbook reading, you're ready to put it all together for the final project. This project is a final assessment on the entire course and covers all the lessons. This is a new Windows application that's not based on the output of any previous graded projects. You may find it helpful to review the instructions of previous graded projects and the completed output from Lesson 5 graded project.
    Make sure that you follow all directions completely and verify your results before submitting the project. Remember to include all required components in your solution.

    YOUR PROJECT
    You've been tasked to create an educational game for a fifth grade reading class. The game must test student's spelling skills using a variation of the classic game Hangman. If you're unfamiliar with the rules and general game play, please consult the online reference at http://en.wikipedia.org/wiki/Hangman_(game) for more information.

    Database
    The application will use the HangManDB.mdf file. The HangManDB database contains the tables in Figure 58. The UnitID column in the Words table is a foreign key to the ID column in the Units table. The Word column contains the actual word to guess, while the Description column contains the description of words for that unit.

    User Interface
    The user interface will consist of a single Windows form. The user interface will resemble Figure 59.
    When the application first loads, the textbox for the letter guess should be disabled (Figure 60). If the New option is chosen in the menu, then a new word and the unit description should be loaded from the database. If the Quit option is chosen in the menu, then the application should quit.

    After each guess, one of two things should happen. If it's a correct guess, then all occurrences of that letter should appear in the labels at the bottom. If it's an incorrect guess, then the next stage of the hangman should appear in the picture box. In either case, the textbox should highlight the letter, so that the user can make another guess. The textbox should not be cleared or the user may attempt to guess the same letter (Figure 61).

    The game ends when either all letters of the word are guessed correctly or the hangman picture is completed. When the game is won (Figure 62) or lost (Figure 63), a message box should display, prompting to play again.

    In either case, clicking the Yes button should have the same effect as clicking the New option in the menu, and clicking the No button should exit out of the application.

    Application Files
    This application will consist of the following files in the solution explorer:
    1. GameForm.vb. The only form in the application.
    2. HangmanDB.mdf. The database that contains the questions and unit descriptions.
    3. Images folder. The images needed for the different visual states of the hangman.
    4. QuestionDataSet.xsd. The DataSet for the HangmanDB database. Should contain both tables Words and Units.
    HangmanDB.MDF and the Images folder will be provided to you.

    Provided Files
    You'll be provided with the following files:
    - The HangmanDB.mdf database
    - The Images folder that contains the image files
    Hangman-0.png, Hangman-1.png, Hangman-2.png, Hangman-3.png, Hangman-4.png, Hangman-5.png, and Hangman-6.png
    - The HelperMethodsCode.txt file with suggested code

    INSTRUCTIONS
    1. In Visual Studio, create a new Windows Forms Application project named HangmanApp.
    2. Create the Images folder in the project by using the Add > New Folder option in the Solution Explorer or the New Folder option in the Project menu
    3. Add each hangman image to the Image folder. You can either click and drag them into the Solution Explorer or use the Add > Existing Item... option and select all images using the Shift key. If using the second method, make sure to change filter to All Files (*.*).
    4. In the Properties panel, set the Copy To Output Directory property to Copy Always for each image file. You can use the Shift key to select all image files at once.
    5. Add the HangmanDB.mdf database to the project. Use the Add > Existing Item... option. Make sure to change filter to All Files (*.*).
    6. In the Data Source Configuration Wizard dialog, choose the DataSet option and then click the Next button.
    7. Check the checkbox next to Tables and then click the Finish button. This will create a default dataset named HangmanDBDataSet with the Units and Words data tables.
    8. Rename the Form1.vb file to GameForm.vb.
    9. Click the Yes button in the dialog to rename the Form1 class as well.

    10. Create the user interface for GameForm.vb. See the User Interface section above for the layout. The form will consist of the following controls:
    a. One MenuStrip control that contains the Game menu with the options New and Quit.
    b. One Label control for instruction with the text Guess a letter; 14-point font recommended.
    c. One Label control for the unit description.
    d. One TextBox control for the user to type in letter choices.
    e. A PictureBox control that will display the hangman images. You'll set the ImageLocation property to load the hangman images.
    f. A Panel control that will contain the displayed letter labels.
    g. Eleven Label controls, one for each letter of the word. These labels should be in the panel and will have an initial placeholder until the user guesses a letter.
    You can choose to set the control properties to whatever you like, but below are some helpful suggestions. If you don’t name the controls with the recommended names, you will need to modify some provided code shown in Table 4.

    6. In the body of GameForm, you should define the following variables:
    a. dsQuestions. A HangmanDBDataSet object
    b. numWord. The index of which word is being guessed.
    c. strWord. The actual word being guessed.
    d. numRightGuesses. Number of right guesses in a game.
    e. numWrongGuesses. Number of wrong guesses in a game.
    f. blnGameStarted. Indicates whether the game has started or not.

    7. In the body of GameForm, you should define the following utility methods:
    a. A method named CheckProgress that calculates the total number of tries (numRightGuesses + numWrongGuesses), displays the correct message box for winning or losing, and starts the next game or exits the application depending on the message box button
    b. A method named WonGame that checks each letter in the word is matched by its label and returns True if this is the case
    c. A method named LostGame that checks to see if the number of wrong guesses is greater than six and returns True if this is the case
    d. A method named ResetAllLabels that sets each character label to blank text

    8. Open the HelperMethodsCode.txt file and copy and paste its contents into the GameForm class.
    Note: These handy methods will reduce your development time. Think of it as help from a colleague, because you’ll rarely develop a business application alone and most often will work within a team.

    9. In the body of GameForm, you should have the following event procedures:
    a. Form Load event handler. Disable the txtGuess textbox, initialize numWord to -1 to indicate no word has been chosen, and call the LoadData method.
    b. Quit button Click event handler. Exit the application
    c. In the New button Click event handler, perform the following tasks:
    I. Initialize all variables, especially numRightGuesses, numWrongGuesses, blnGameStarted, and numWord. Make sure to increment numWord to the next index. Each game will increment this number by one.
    II. Initialize controls. Clear the text of all controls, including the labels, textbox, and picture box. For the picture box, you can just set its ImageLocation to “”.
    III. Enable and set the focus of the txtGuess textbox.
    IV. Set controls using the DataSet. If you followed the same names, then you can use this code:
    ‘Get a word column row
    strWord = CStr(dsQuestions.Words(numWord)(1))
    ‘Gets unitdescription
    lblUnitDescription.Text = CStr(dsQuestions.Words(numWord).UnitsRow(1))
    V. Set the Text property to the underscore character (_) for each label control based on the number of characters in the word.
    D. In the txt Guess text box Text Changed event, perform the following tasks:
    I. Check if the game is started using the blnGameStarted variable and that the txtGuess textbox contains a value. Clearing a textbox will trigger a TextChanged event, so you’ll need to
    verify a letter was actually typed by the user.
    II. Check to see if the word (strWord) contains the guess (txtGuess).
    III. If it does, then call the SetRightLetterLabels method and increment the numRightGuesses variable.
    IV. If it doesn't, set the image in the pboxHangman and increment the numWrongGuesses variable.
    Your code should resemble the following:
    pboxHangman.ImageLocation ="images\Hangman-" & numWrongGuesses & ".png"
    numWrongGuesses + = 1
    V. Check to see if the game has been won or lost yet. Use the CheckProgress method.
    VI. Select the text in the txtGuess textbox.

    10. Save and run the application. Verify that all controls and menus work correctly. You’ll submit the compiled application for this project.

    SUBMISSION GUIDELINES
    You’ll submit the HangmanApp.exe file for your project.
    To find this file, you should go to directory to where you saved the HangmanApp project and copy the HangmanApp.exe file from the bin\Debug folder. Make sure the HangmanApp.exe file executes before submission. The Images folder and HangmanDB.mdf must be in the same directory as the HangmanApp.exe to execute as expected.

    Use the following procedure to submit your project online:
    1. Log in to view your student homepage and go to the My Courses page.
    2. Click the Take Exam link next to the lesson you’re working on.
    3. Attach our files as follows:
    a. Click the Browse button.
    b. Locate the file you wish to attach.
    c. Double-click on the file.
    d. Click the Upload File button.
    4. Enter your email address in the box provided.
    (Note: Your email address is required for online submissions.)
    5. If you wish to include comments about this project to your instructor, enter your comments in the Message textbox.
    6. Click Submit Files.

    Learn More
  10. POS 409 Week 3 Sorting and Searching C# Program

    POS 409 Week 3 Sorting and Searching C# Program

    $20.00

    POS 409 Week 3 Sorting and Searching C# Program

    Create a text file with one record of text data. This text file will be read by the program and the data in the text file will serve as a search term.

    Design, implement, test, and debug a C# program using the following guidelines.

    In the form load event, read the text file you built. This row of data will be a word or phrase that may occur in the data entered on the form (referred to later as "search term"). Convert the text read to uppercase.

    Create a form with textboxes for 10 input fields. Designate the fields in such a way that the user enters specific data (for example, movies, books, names, or sports). The data entered should be of type string.

    Add a button, "Accept Input", to accept the input. In the click event for the button, validate the input and load the input into an array.
    Validate the input by calling a value-returning method. Pass the 10 input fields to the method and return a value to indicate whether or not the data passed validation (for example, you can return a zero if the data passed validation and a 1 if it did not). Validation should consist of checking if data was entered in the field. Notify the user if the data is not valid and stop execution.
    Add a void method that loads the input fields into an array and converts the data in them to uppercase.

    Add another button, "Sort Input", to sort the input data. In the click event for the button, add a void method to do the sorting. In the void method, use the selection sort algorithm presented in chapter 7 to sort the data. After sorting, in the button click event, create a loop to iterate through the array of sorted data and display the data in a listbox on the form.

    Add a final button to the form, "Check Input". In the click event for the button, call a value-returning method. This method will compare the data in the array and the search term (data read in the form load event). Count the number of elements in the array in which the search term is found. Pass the number of times the word or phrase is found back as the value returned. Put the results in a label on the form. For example, if my search term is "the", the label might say "Search term - the - is found 3 times in the input data". The search should count as a match if the search term is only a portion of the array element. For example, if your search term is "the" and the array element is "The Old Man and The Sea", it should count as a match because "the" is contained within the array element. However, you do not need to count all occurrences of the search term in the array element. So, in "The Old Man and The Sea" example, count once, not twice.

    Here is an example. My search term is "the". The array elements are: "The Old Man and The Sea", "Jane Eyre", "Moby Dick", "The Great Gatsby", "MacBeth", "The Iliad and the Odyssey", "Huckleberry Finn", "Catch-22", "To Kill a Mockingbird", and "The Bell Jar". With this data, the program should find 4 occurrences of the search term (those array elements that are underlined).

    The type of application to be developed is a Windows Forms application.

    Please note that the reason the selection sort algorithm is required for this assignment is two-fold. First, it will give you a chance to look at someone else's code and learn it well enough to figure out how to modify it. Second, it will give you additional practice with string handling when you learn how to compare strings. It is not acceptable to try to find another way to sort the data.

    Include identifying information in the form of block comments at the top of each class in the project (programmer name, date, program description). Include adequate comments throughout the program, utilize meaningful names for controls, variables, fields, and forms. Include white space for readability purposes in the code. The focus of the project is on learning the C#.Net syntax. However, ensure the form is simple and easy to understand for the user. Refer to the Individual Assignment grading form to view grading criteria.

    Zip the files of the project together and submit the zipped file. Include the text file used in your zip file also.

    Learn More

Items 1 to 10 of 16 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Descending Direction
[profiler]
Memory usage: real: 15466496, emalloc: 14972640
Code ProfilerTimeCntEmallocRealMem