Skip to content

Description

This course introduces the C# (C-Sharp) programming language using the Microsoft Visual Studio Interactive Development Environment (IDE). Visual Studio Community Edition, is a free download from the Microsoft download website.  The steps and figures in our textbook assume you are using the Community edition of either Visual Studio 2019 or Visual Studio 2022. Your steps and screen might differ slightly in some instances if you are using a different edition of Visual Studio. 

Application project development using graphics user interface forms, event driven programming, procedural and object-oriented paradigms, and fundamental data structures. Applications will access data from forms, files, and databases.

NOTE: Visual Studio for the Mac does not work with C#. You need a Windows machine or use the machines in the CIS classrooms and lab.

Students should have previous programming experience (CIS251).

Objectives

  • Describe the underlying structure and components of an event-driven windows application.
  • Design simple and multi-form solutions that meet user specifications.
  • Apply appropriate simple data types and control structures when developing a .NET application.
  • Create windows applications using object-oriented programming concepts.
  • Utilize appropriate structured data types in a windows application.
  • Integrate a windows application with external sources including files and databases.
  • Create a tested, debugged windows application with an input validated graphics user interface and data storage back-end.
CIS Program web site: https://cis.buffalostate.edu/cis-program

Note: All assignments are DUE by 11:59 PM on the Thursday they are listed as being DUE!
Quizes are available for seven (7) days from when the chapter quiz is listed.
Quizes are based on the chapters from the Murach textbook.

Week Date Textbook Reading Chapter Assignments
& Quizzes
Announced
Assignments
& Quizzes Due
1 Aug 27/29 Getting Started in CIS400

How to get started with Visual Studio
1
Appendix A

Brief Introduction

2 Sep 3/5

How to design a Windows from app

How to code and test a Windows form app

2 & 3

Apply | A1 Design the Invoice Total form

Brief Introduction Due
3 Sep 10/12

How to work with numeric and string data

How to code control structures

4 & 5



4 Sep 17/19

How to code methods and events

How to handle exceptions and validate data

6 & 7

Quiz 1 Chapters 1-6

Apply | A2 Develop the Future Value app

A1 Design the Invoice Totyal form Due

5 Sep 24/26

How to use arrays and collections

How to work with dates and strings

8 & 9 A2 Develop the Future Vaue app Due
6 Oct 1/3

More skills for working with Windows Forms

How to debug an app

10 & 11

Apply | A3 Enhance the Future Value app

Quiz 1 Due

7 Oct 8/10 How to create and use classes 12 A3 Enhance the Future Value App Due 
  Oct 15 Fall Recess - No Classes
8 Oct 17 How to work with indexers, delegates, events, and operators 13

Quiz 2 Chapters 8-12

Apply | A4 Create the Payment app

 Quiz 2 Due
9 Oct 22/24

How to work with inheritance

How to organize, document, and test your classes

14 & 16

A4 Create the Payment app Due
10 Oct 29/31 How to work with file I/O 17 Apply | A5 Create a Customer Maintenance app that uses classes
11 Nov 5/7 An introduction to database programming 19 Apply | A6 Work with a text file and a binary file
12 Nov 12/14 How to use ADO to write your own data access code 21 Apply | A7 Create a Customer Maintenance app that uses a grid A5 Create a Customer maintenace app that uses classes Due 
13 Nov 19/21 How to use the DataGridView control 22 Quiz 3 Chapters 13, 14, 16, 19, 21, 22 A6 Work with a text fioe and a binary file Due 
14 Nov 26 TBD Lab Apply | A8 Create an Invoice Line Item Display app

A7 Create a Customer Maienance app that uses a grid Due 

  Nov 27-30 Thanksgiving Recess - No Classes
15 Dec 3/5 TBD Lab Quiz 3 Due
A8 Create an Invoice Line Item app Due
  Dec 6 Last day of classes All Work Due By 11:59 PM Tonight

Chapters 15, 18, and 20 will not be covered.

Grading

Students will be graded on:

  • A "Brief Introduction" worth two (2) points. 
  • Six (6) assignments, each worth six (8) points. and two (2) assignments worth ten (10) points. These assignments will utilize the C# programming language. 
    Late penalty: -.5 point per week (or part of a week) late. The maximum late penalty is -1.5 points.
  • Three (3) online quizzes, each worth ten (10) points. These quizzes come from the chapters in the Murach textbook. You may submit each quiz multiple times. Your last submission will be the grade that counts.
    Late penalty: -.5 point per week (or part of a week) late.

  • "Connect with Professor Gerland on LinkedIn" will be worth one (1) extra credit point.
  • You may always resubmit any quiz or assignment to be re-graded for additional points.
  • I normally grade assignments within two (2) business days after they are submitted. Quizzes are automatically graded unless there is an essay queston or the quiz is submitted late.
  • Final grades will be based on total points.
  • The final letter grades be based on the following table:
    Numeric Grades to Letter Grade Table
    Grade Range   Grade Range
    A 100 - 95   C+ 79 - 77
    A- 94 - 90   C 76 - 74
    B+ 89 - 87   C- 73 - 70
    B 86 - 84   D 69 - 60
    B- 83 - 80   F 59 - 0

Murach C#Murach's C# 8th Edition
Publisher: Murach
Print ISBN: 9781943873074, 1943873070
etext isbn: 9781943873081,1943873089
Author(s): Joel Murach, Anne Boehm
Edition: 8th
Copyright: 2023

You can download the data files and slides from my CIS400 Murach website. The files and slides for each chapter are also available in the link in the Weeky Module for that chapter.

Book is recommended (online tests are based on this textbook) 

Course Software

  • Visual Studio Community Edition, is a free download from the Microsoft download website.
  • NOTE: Visual Studio for the Mac does not work with C#. You need a Windows machine or use the machines in the CIS classrooms and lab.

Assignments

| Introduction | A1 InvoiceTotal | A2 InvoiceTotal | A3 Future Value
| A4 Payment | A5 CustomerMaintenance | A6 File I/O |
| A7 CustomerMaintennce | A8 InvoiceLineItems |

Brief Introduction (1 Point)

For this assignment you will login to your Brightspace account and post a brief (75-100 words) introduction about yourself to the Brief Introduction Discussion forum for this course. Use the Add New Thread button and make the Subject line your name. Also, include any relevant course(s) you've taken that might help you in this course. This will give me a better idea of where each of us are in our understanding and experience with electronic commerce concepts and design. Please include a photo of yourself so we can get to know each other.

Back to Assignments

A1 Design the Invoice Total form

This assignment is taken from The Murach textbook. 

Chapter 2, Exercise 2-1 Design the Invoice Total form

This exercise will guide you through the process of starting a new project and developing the user interface for the Invoice Total form shown in this chapter.

Set the default path and start a new project

  1. Start Visual Studio. If the Start window is displayed, click the “Continue without code” link to display the IDE.
  2. If you need to, change the development settings, so your menus are the same as the ones in this book, use the procedure described in figure 2-1 to select the default Visual C# settings.
    Fig-2-1
    Figure 2-1
  3. If you want to stop the Start window from being displayed each time you start Visual Studio, use the procedure described in figure 2-1 to change the startup option to “Most recent solution” or “Empty environment”.
  4. Start a new project as shown in figure 2-2. The project should be named InvoiceTotal, it should be stored in the C:\C#\Ch02 folder, and the solution should be stored in its own folder. Add controls to the new form and set the properties.
    Fig-2-2
    Figure 2-2
  5. Use the techniques in figure 2-4 to add controls to the form so they have approximately the same sizes and locations as in figure 2-5. But don’t worry about the size of the labels, just their locations.
    Fig-2-4
    Figure 2-4
    Fig-2-5
    Figure 2-5
  6. Select groups of controls and use the buttons in the Layout toolbar to size and align the controls. But here again, let the labels automatically size themselves. Then, size the form so it looks like the one in Figure 2-4.
  7.  Use the Properties window to set the properties for the form and its controls so it looks like the form in figure 2-3.
    Fig-2-6
    Figure 2-3
    These properties are summarized in figure 2-8.
    Fig-2-7
    Fig-2-8
    Figure 2-8
    Test the user interface.
  8. Press F5 to build and run the project. That should display the form in the center of the screen, and it should look like the one in figure 2-3.
  9. Experiment with the form to see what it can do. When you press the Tab key, notice how the focus moves from one control to another. When you click a button, notice how it indents and then pops back out, just like any other Windows button control. Nothing else happens in response to these button clicks, though, because you haven’t written the code for them yet. Notice that the Calculate button has a dark outline around it to indicate that its function will be executed if you press the Enter key. (If it doesn’t have a dark outline, you haven’t set the AcceptButton property of the form to the button.) When you press the Alt key, notice that an underline appears under the s in Subtotal, the first c in Calculate, and the x in Exit to indicate that you can use an access key to work with these controls. (If the underlines don’t show, you haven’t entered the Text properties correctly.)
  10. If you notice that some of the properties are set incorrectly, click the Close button in the upper right corner of the form to close the form. Then, make the necessary changes and run the project again. When you’re satisfied that the form is working right, close the form to return to the Form Designer. Experiment with the properties for the form and its controls.
  11. In the Form Designer, click on the form so it is selected. Then, if necessary, adjust the Properties window so you can see the description for each property. To do that, drag the bottom boundary of the window up.
  12. Click on the Categorized button at the top of the Properties window to display the properties by category. Then, review the properties in the Appearance, Behavior, Layout, and Window Style categories. Although you won’t under-stand all of the descriptions, you should understand some of them.
  13. In the Window Style category, change the settings for the MaximizeBox and MinimizeBox to false to see how that changes the form. Then, to undo those changes, click twice on the Undo button in the Standard toolbar or press Ctrl+Z twice.
  14. Click on the first text box and review the Appearance, Behavior, and Layout properties for that control. Then, repeat this process for one of the labels and one of the buttons. Here again, you won’t understand all the descriptions, but you should understand some of them.
  15. Select all four of the labels, click on the plus sign before the Font property in the Appearance group, and change the Bold setting to True to see how that changes the form. Then, undo that change.
    Change the name of the form files
  16. Use one of the techniques presented in figure 2-9 to change the name of the form file from Form1.cs to frmInvoiceTotal.cs. When you do that, a dialog is displayed that asks whether you want to change all the references to the form name too. Click on Yes to close that dialog, and Visual Studio changes all references to Form1 in the C# code to frmInvoiceTotal.
    Fig-2-9
    Figure 2-9
  17. Note in the Solution Explorer that this also changes the name of the two subordinate files to frmInvoiceTotal.Designer.cs and frmInvoiceTotal.resx.
    Close the project and exit from Visual Studio
  18. Use the File->Close Solution command to close the project. If you’ve made any changes to the project since the last time you tested it, a dialog is displayed that asks whether you want to save the changes that you made. If you want to save those changes, click Yes.
  19. Use the File->Exit command to exit from Visual Studio.

Chapter 3, Exercise 3-1. Code and test the Invoice Total form

In this exercise, you’ll add code to the Invoice Total form that you designed in exercise 2-1. Then, you’ll build and test the project to be sure it works correctly. You’ll also experiment with debugging and review some help information.
Copy and open the Invoice Total app

  1. Use Windows Explorer to copy the Invoice Total project that you created for chapter 2 from the C:\C#\Ch02 directory to the C:\C#\Ch03 directory.
  2. Open the Invoice Total solution (InvoiceTotal.sln) that’s now in the C:\C#\ ch03\InvoiceTotal directory. Add code to the form and correct syntax errors.
  3. Display the Invoice Total form in the Form Designer, and double-click on the Calculate button to open the Code Editor and generate the method declaration for the Click event of this object. Then, enter the code for this method as shown in figure 3-6.
    Fig-3-6
    Figure 3-6
    As you enter the code, be sure to take advantage of all the Visual Studio features for coding, including snippets.
  4. Return to the Form Designer, and double-click the Exit button to generate the method declaration for the Click event of this object. Enter the statement shown in figure 3-6 for this event handler.
  5. Open the Error List window as described in figure 3-7. If any syntax errors are listed in this window, double-click on each error to move to the error in the Code Editor. Then, correct the error.
    Fig-3-7
    Figure 3-7
    Test the project
  6. Press F5 to build and run the project. If you corrected all the syntax errors in step 5, the build should succeed and the Invoice Total form should appear. If not, you’ll need to correct the errors and press F5 again.
  7. Enter a valid numeric value in the first text box and click the Calculate button or press the Enter key to activate this button. If the calculation works, click the Exit button or press the Esc key to close the form and return to Visual Studio. If either of these methods doesn’t work right, of course, you need to debug the problems and test the project again.
    Enter invalid data and display data tips in break mode.
  8. Run the project again. This time, enter “xx” for the subtotal. Then, click the Calculate button. This will cause Visual Studio to enter break mode and display the Exception Helper as shown in figure 3-14.
    Fig-3-14
    Figure 3-14
  9. Note the highlighted statement and read the message that’s displayed in the Exception Helper. Then, move the mouse pointer over the variable and the property in this statement to display their data tips. This shows that the code for this form needs to be enhanced so it checks for invalid data. You’ll learn how to do that in chapter 7. For now, though, click the Stop Debugging button in the Debug toolbar to end the app.
    Create a syntax error and see how it affects the IDE.
  10. When you return to the Code Editor, hide the Error List window by clicking on its Auto Hide button. Next, change the name of the Subtotal text box from txtSubtotal to txtSubTotal. This creates an error since the capitalization doesn’t match the capitalization used by the Name property of the text box.
  11. Try to run the project, and click No when Visual Studio tells you that the build had errors and asks whether you want to continue with the last successful build. Then, double-click on the error in the Error List window, correct the error, and run the project again to make sure the problem is fixed.
    Use refactoring
  12. Highlight the name of the subtotal variable, then right-click on the name and select the Rename command from the shortcut menu that’s displayed. When the Rename dialog appears, enter the name invoiceSubtotal and notice that all occurrences of the variable are changed.
  13. Press the Enter key to apply the changes, and then run the project to make sure it still works correctly.
    Generate and delete an event handler
  14. Display the Form Designer for the Invoice Total form and double-click a blank area on the form. This should generate an event handler for the Load event of the form.
  15. Delete the event handler for the Load event of the form. Then, run the project and click No when Visual Studio tells you the build had errors.
  16. Double-click on the error in the Error List window that tells you the form does not contain a definition for the Load event handler. This opens the Designer.cs file for the form and jumps to the statement that wires the event handler. Delete this statement to correct the error.
  17. If you’re curious, review the generated code that’s stored in the Designer.cs file for this simple form. Then, click the minus sign to the left of the region named “Windows Form Designer generated code” to collapse this region. 18. Run the project to make sure it’s working correctly. When you return to the Code Editor, close the Designer.cs file for the form.
    Exit from Visual Studio
  18. Click the Close button for the Visual Studio window to close the solution and exit from Visual Studio. If you did everything and got your project to work right, you’ve come a long way!

When you have this Assignment ready for me to view and grade, zip up your folder, then, you should click on this assignment and then upload your your_buff_state_username_A1.zip file, so I can run your code and grade your work.

Back to Assignments

A2 Develop the Invoice Total app

This assignment is taken from The Murach textbook.

Chapter 5, Exercise 5-2 Develop the Invoice Total app

In this exercise, you’ll use if-else and switch statements to determine the discount percent for the Invoice Total app that’s in figure 5-8.

Figure 5-8

Open the app and change the if-else statement

  1. Open the app that’s in the C:\C#\Ch05\InvoiceTotal directory.
  2. Change the if-else statement so customers of type R with a subtotal that is greater than or equal to $250 but less than $500 get a 25% discount and those with a subtotal of $500 or more get a 30% discount. Next, change the if-else app to make sure this works.
  3. Add another customer type to the if-else statement, so customers of type T get a 40% discount for subtotals of less than $500, and a 50% discount for subtotals of $500 or more. Also, make sure that customer types that aren’t R, C, or T get a 10% discount. Then, test the app.
  4. Test the app again, but use lowercase letters for the customer types. Note that these letters aren’t evaluated as capital letters. Now, close the app and modify the code, so the users can enter either capital or lowercase letters for the customer types. Then, test the app to make sure it works correctly.
    Use a switch statement with if-else statements to get the same results
  5. Enter the start of a switch statement right after the if-else statement. Next, enhance this code, so the switch statement provides the structure for handling the three cases for customer types: R, C, and T (but not r, c, and t). Then, within each of these cases, you can copy the related code from the if-else statement above to provide for the discounts that are based on subtotal variations. In other words, the if-else statements will be nested within the switch cases.
  6. Comment out the entire if-else statement above the switch statement. Then, test to make sure the switch statement works correctly. Is this code easier to read and understand?
    Use a switch expression
  7. Comment out the entire switch statement. Then, enter a switch expression that sets the discount percent to 30% for the R customer type, 20% for C, and 50% for T with a default discount percent of 10%.
  8. Test to make sure the switch expression works correctly. Is this code shorter and easier to read than a comparable switch statement?
  9. Close the project.

When you have this Assignment ready for me to view and grade, you should click on this assignment and then upload your your_buffstate_username_A2.zip file, so I can download, unzip, run your code, and grade your work.

Back to Assignments

A3 Enhance the Future Value app

This assignment is taken from The Murach textbook.

Exercise 7-2 Enhance the Future Value app

This exercise guides you through the process of enhancing the Future Value app that you worked on in chapter 6.

  1. Open the app that’s in the C:\C#\Ch07\FutureValue directory.
  2. Add a try-catch statement to the btnCalculate_Click() method that catches and handles any FormatException or OverflowException that might occur. These catch blocks should display dialogs with appropriate messages. Then, test these enhancements.
  3. Add another catch block to the try-catch statement that will catch any other exception that might occur. This catch block should display a dialog that displays the message contained in the exception object, along with the exception type and the stack trace.
  4. Add a throw statement before the return statement in the CalculateFuture-Value() method that throws a new exception of the Exception class regard-less of the result of the calculation. This statement will be used to test the enhancements of step 3, and it should specify a generic message that indicates an unknown error. Then, test the app by entering valid values in the three text boxes and clicking the Calculate button. If the exception is thrown and the last catch block works correctly, end the app and comment out the throw statement.
  5. Code three generic validation methods named IsDecimal(), IsInt32(), and IsWithinRange() that test whether a text box contains a valid decimal value, a valid int value, and a value within a given range. If the validation is unsuccessful, each method should return an error message that includes the name of the text box that’s being validated. If you need help in coding these methods, you can refer to figure 7-9.

    Figure 7-9
  6. Code an IsValidData() method that calls the three generic methods you created in step 5 to validate the data the user enters into the three text boxes. Each text box should be tested for two types of invalid data: (1) invalid format and (2) invalid range. If any errors occur, a dialog should be displayed with those errors. Also, be sure this method returns a Boolean value indicating if the validation was successful.
  7. Modify the code in the event handler for the Calculate button so it uses the IsValidData() method to validate the data before it processes it. Then, test the app to be sure it works correctly. If it does, end the app and comment out the FormatException and OverflowException catch blocks since these exceptions are now prevented by the data validation.
  8. Do a final test of the app, and then close it. 

When you have this Assignment ready for me to view and grade, you should click on this assignment and then upload your your_buffstate_username_A3.zip file, so I can download, unzip, run your code, and grade your work.

Back to Assignments

A4 Create the Payment app

This assignment is taken from The Murach textbook.

Exercise 10-1 Create the Payment app

This exercise will guide you through the process of creating the Payment app that’s described in this chapter. To make that easier for you, you’ll start from an app that contains the Customer form.

Open the project and prepare the two forms

  1. Open the app that’s in the C:\C#\Ch10\Payment directory. This app contains a single form named Form1.
  2. Rename Form1 to frmCustomer. Make sure to change both the file name and the name that’s used in the code. If necessary, modify the Main() method so it displays this form when the app starts.
  3. Add a second form named frmPayment to the project.
    Design the Payment form
  4. Add the controls to the Payment form and set the properties for this form and its controls as described in figures 10-16 and 10-17.

    Figure 10-16

    Figure 10-17
  5. Use Tab Order view to set the tab order for the controls on the Payment form if necessary.

When you have this Assignment ready for me to view and grade, you should click on this assignment and then upload your your_buffstate_username_A4.zip file, so I can download, unzip, run your code, and grade your work.

Back to Assignments

A5 Create a Customer Maintenance app that uses classes

This assignment is taken from The Murach textbook.

Exercise 12-1 Create a Customer Maintenance app the uses classes

In this exercise, you’ll create a Customer Maintenance app that uses three classes. To make this app easier to develop, we’ll give you the starting forms, a complete Validator class, and a complete CustomerDB class for working with the data in a file of customers. Note that the CustomerDB class assumes that the file of customers (Customers.txt) is in the C:\C#\Files directory. If you placed this file in a different directory after downloading and installing the files for this book, you will need to change the path specification in the CustomerDB class.

Open the project and add a Customer class

  1. Open the app in the C:\C#\Ch12\CustomerMaintenance directory. Then, review both forms in the Form Designer window so you get an idea of how this project should work.
  2. Add a class named Customer to this project, and add the properties, method, and constructors that are shown in the table below. Code the properties as auto-implemented properties, code the method as an expression-bodied method, and code the constructor that accepts parameters as an expression-bodied constructor that uses a tuple.
  3. When you complete the Customer class, review the Validator class. Note that one of its methods is IsValidEmail(), which you can use to validate email addresses.

    Add code to implement the Add Customer form
  4. Display the code for the Add Customer form, and declare a class variable named customer of type Customer with an initial value of null.
  5. Add a public method named GetNewCustomer() that displays the form as a dialog and returns a Customer object.
  6. Add an event handler for the Click event of the Save button that validates the data on the form using the methods of the Validator class (all three fields are required and the email field must be a valid email address), and then creates a new Customer object and closes the form if the data is valid.
  7. Add an event handler for the Click event of the Cancel button that simply closes the form.

    Add code to implement the Customer Maintenance form
  8. Display the code for the Customer Maintenance form, and declare a class variable named customers of type List<Customer> with an initial value of null.
  9. Add an event handler for the Load event of the form that uses the GetCustomers() method of the CustomerDB class to load the customers list and then adds the customers to the Customers list box. Use the GetDisplayText() method of the Customer class to format the customer data.
  10. Add an event handler for the Click event of the Add button that creates a new instance of the Add Customer form and executes the GetNewCustomer() method of that form. If the customer object that’s returned by this method is not null, this event handler should add the new customer to the list, call the SaveCustomers() method of the CustomerDB class to save the list, and then refresh the Customers list box.
  11. Add an event handler for the Click event of the Delete button that removes the selected customer from the list, calls the SaveCustomers() method of the CustomerDB class to save the list, and refreshes the Customers list box. Be sure to confirm the delete operation.
  12. Add an event handler for the Click event of the Exit button that closes the form.
    Run and test the app
  13. Run the app and test it to be sure that it works properly. When you’re done, end the app, but leave the solution open if you’re going to continue with the next exercise.

Exercise 12-2 Use a structure or record struct

In this exercise, you’ll modify your solution to exercise 12-1 by converting the Customer class to a structure or a record struct.

  1. If it isn’t open already, open the project in the C:\C#\Ch12\Customer-Maintenance directory.
  2. Modify the Customer class so it defines a structure or a record struct.
  3. Run the app and debug any errors that you encounter. Note that you can’t assign a null value to a Customer object anymore, as it is now a value type. However, you can check if any of the properties of the Customer object are null or empty, as those properties are of the String type.
  4. Update the code to check if a customer is already in the list before adding it.

When you have this Assignment ready for me to view and grade, you should click on this assignment and then upload your your_buffstate_username_A5.zip file, so I can download, unzip, run your code, and grade your work.

Back to Assignments

A6 Work with a text file and a binary file

This assignment is taken from The Murach textbook.

Exercise 17-1 Work with a text file

  1. Open the project in the C:\C#\Ch17\CustomerText directory. This is the Customer Maintenance app that you developed for exercise 12-1, but it doesn’t save or retrieve the data. Test it to see that you can add a customer but the data doesn’t remain when you stop the app and run it again.
  2. In the CustomerDB class, add code to the GetCustomers() and SaveCustomers() methods so they use a text file to read and write a List<Customer> collection of Customer objects. Unless you moved it after downloading and installing the files for this book, the path for this file should be C:\C#\Files\Customers.txt.
  3. Test the app by adding and deleting customers. To verify that the data is now being saved to disk, stop the app and run it again. Or use a text editor like NotePad or VS Code or NotePad++ to open the file after a test run.

Exercise 17-2 Work with a binary file

  1. Use Windows Explorer to copy the directory named CustomerText from the previous exercise within the ch17 directory. Then, rename that directory CustomerBinary, and open the project in that directory.
  2. Modify the CustomerDB class so it uses a binary file named Customers.dat instead of a text file. Also, leave the signatures of the GetCustomers() and SaveCustomers() methods as they are, so you won’t need to modify the code in the form class that calls these methods. Then, test the app by adding and deleting customers.

When you have this Assignment ready for me to view and grade, you should click on this assignment and then upload your your_buffstate_username_A6.zip file, so I can download, unzip, run your code, and grade your work.

Back to Assignments

A7 Create a Customer Maintenance app that uses a grid

This assignment is taken from The Murach textbook.

Exercise 22-1 Create a Customer Maintenance app that uses a grid

In this exercise, you’ll create a Customer Maintenance app that displays customer data in a DataGridView control. This control will also contain button columns that let the user modify and delete customers, and the form will contain an Add button that lets the user add customers. To make this app easier to develop, we’ll give you the Entity Data Model and data access class, the Add/Modify Customer form, the Validator class, and some of the code for the Customer Maintenance form.

The design of the Customer Maintenance form

  1. Open the app in the C:\C#\Ch22\CustomerMaintenance directory.
    Open the project and create the grid
  2.  Add a DataGridView control to the Customer Maintenance form. When the smart tag menu is displayed, set the options so the user can’t add, edit, or delete data directly in the control.
  3. In the MMABooksDataAccess.cs file, immediately after the namespace statement, add a record named CustomerDTO that includes properties for the customer id, name, address, city, state, and zip code. (Since this record is used only by the MMABooksDataAccess class, it makes sense to code this record in the same file as the class.)
  4. Add a method to the data access class that uses a LINQ query to get the customer id, name, address, city, state, and zip code for each customer. Sort the customers by name, and return the results in a List<CustomerDTO> object. To keep things simple, don’t worry about exception handling.
  5. Back in the Customer Maintenance form, bind the DataGridView control to the list that’s returned by the new data access method.
  6. Set the Visible property of the column that contains the customer id so it isn’t displayed. Then, set the widths of the remaining columns so they can display the data they contain. In addition, format the column headers and alternating rows any way you like.
  7. Adjust the width of the grid so you can see all the columns as well as the vertical scrollbar. In addition, adjust the height of the grid so you can see 10 customers at a time. You may have to run the app and adjust the width and height multiple times before you get this right.
    Add two button columns to the grid
  8. Declare a constant that contains the index value for the Modify button column that you’ll add to the grid. Then, declare a constant that contains the index value for the Delete button column. Remember, indexes are zero based and the first column isn’t visible.
  9. Add the button columns to the grid. To do that, use the Insert() method of the Columns collection, and pass in the correct constant for the index argument.Re-adjust the width of the grid so you can see all the columns as well as the vertical scrollbar. Adjust the position of the buttons and the size of the form so it looks as shown on the previous page.
  10. Generate an event handler for the CellClick event of the DataGridView control. This event handler should start by using the constant values to check if a cell that contains a Modify or Delete button was clicked. If it was, it should get the customer id from the row that was clicked and then call the FindCustomer() method in the data access class to get the customer with that id and store it in the selectedCustomer variable. Then, if a Modify button was clicked, it should call the ModifyCustomer() helper method, and if a Delete button was clicked, it should call the DeleteCustomer() helper method.
  11. Test these changes to be sure they work. To test the delete operation, first add a new customer and then delete that customer

Exercise 22-2 Add paging to the Customer Maintenance app

Customer Maintenance app you worked on in exercise 22-1.

  1. Open the app in the C:\C#\Ch22\CustomerMaintenancePaging directory.
  2. Add four buttons between the Add and Exit buttons that will let the user move to the first, previous, next, and last page of customers.
  3. Declare a constant with a value that indicates the maximum number of rows per page. Then, declare class variables to store the total number of rows, the total number of pages, and the current page number.
  4. Add a read-only property to the data access class that returns the total number of customers in the database.
  5. Add code to the event handler for the Load event of the form that assigns the value of this new data access property to the total rows class variable. Then, add code that calculates and sets the total number of pages. Finally, set the current page number class variable to 1 so the DisplayCustomers() method displays the first page of customers.
  6. Modify the GetCustomers() method of the data access class so it accepts two int parameters named skip and take. Then, use those parameters in the LINQ query to return the customers for the requested page. If you need help, you can refer to the code in figure 22-12.

    Figure 22-12
  7. Modify the DisplayCustomers() method so it calculates the skip and takes variables and passes them to the GetCustomers() method. If you need help, you can refer to the code in figure 22-12.
  8. Modify the EnableDisableButtons() method so it enables or disables the appropriate buttons depending on the current page.
  9. Add an event handler for the Click event of the First button. Then, add code to this event handler that sets the current page to the first page and calls the DisplayCustomers() method.
  10. Add event handlers for the remaining paging buttons, and add the code necessary to set the current page number and display that page of customers. If you need help, you can refer to the code in figure 22-12.
  11. Run the app to be sure the paging buttons work and are enabled and disabled as appropriate.

When you have this Assignment ready for me to view and grade, you should click on this assignment and then upload your your_buffstate_username_A7.zip file, so I can download, unzip, run your code, and grade your work.

Back to Assignments

A8 Create an Invoice Line Item Display app

This assignment is taken from The Murach textbook.

Exercise 22-3 Create an Invoice Line Item Display app

In this exercise, you’ll create an app that displays a grid with all the invoices in the Invoices table. Then, when the user selects an invoice, all the line items for that invoice are displayed in a second grid. To make this app easier to develop, the starting point provides the design of the form.

  1. Open the app in the C:\C#\Ch22\InvoiceLineItemDisplay directory, and display the form to see that it contains two DataGridView controls.
  2. In the file that contains the data access class, add a record for a data transfer object that includes properties for the columns in the grid of invoices shown above plus the invoice id. Then, update the GetInvoices() method so it returns a list of the DTO objects.
  3. Add code to the DisplayInvoices() method in the form that binds the Invoices grid to the data returned by the GetInvoices() method.
  4. In the file that contains the data access class, add a record for a data transfer object that includes properties for the columns in the grid of line items shown above. Then, update the GetInvoiceLineItems() method so it returns a list of the DTO objects.
  5. Add code to the DisplayLineItems() method to get the invoice row that was selected and then the invoice id from that row. Then, use that invoice id to bind the Line Items grid to the data returned by the GetInvoiceLineItems() method.
  6. Add code to the Load event handler for the form that calls the DisplayInvoices() method, calls the DisplayLineItems() method to display the line items for the first invoice, and selects the first invoice.
  7. Generate an event handler for the RowHeaderMouseClick event of the Invoices grid. Then, add code to display the line items for the invoice that was clicked.

When you have this Assignment ready for me to view and grade, you should click on this assignment and then upload your your_buffstate_username_A8.zip file, so I can download, unzip, run your code, and grade your work.

Back to Assignments

Communication

This is a hybrid course which will have in-class meetings for discussions and also utilize Brightspace for chapter-based discussions and tests. Students are expected to login at minimum multiple times each week for course announcements, assignments, quizzes, discussions,etc.

Faculty/Instructor: I can be reached by e-mail with questions or for guidance that are concerned with this course. You should expect that I will reply to your message within 1-2 business days. Specific course-related questions (textbook, tests, discussions, etc.) should be posted in Brightspace so everyone can benefit from the questions and answers.

Students: If you have multiple e-mail accounts, please be sure that you access (or forward) your Buffalo State e-mail. Your Buffalo State e-mail is the account I will use to send course-related materials.

Netiquette

About Cell Phones, IPhones and IStuff ("HANDS OFF POLICY")
Before entering the classroom, turn off all cell phones, SmartPhones, IStuff, and other electronic devices. These devices are disruptive and their use during a lecture is rude to the class and instructor.

  1. No electronic devices should be in your hands during class. This means no fiddling with your phones, reading/sending text messages, etc.
  2. If you are expecting an important phone call or are compelled to play with Apps, do not attend class.
  3. If you feel you have a legitimate reason to use an electronic device in the classroom, see me to obtain explicit permission.

This course utilizes BlackboardLearn to facilitate online communication between course participants. Please keep in mind the following "Rules of Netiquette" when communicating online.

  • The rules of the classroom are the same regardless of location. Remember just because you're interacting online, doesn't mean you stop having respect for your professors, and fellow classmates. You're communicating with a real person, not a computer screen.
  • Remember your audience. When communicating online it's important to remember who you're communicating with. When sending a message to a professor, please refrain from using "text speak". For example, Shakespeare never intended for you to type "2B or not 2B". Also, stay away from typing in all capital letters; it will appear as if you're shouting.
  • Avoid b language. Language can easily be misinterpreted in an online setting. Be sure to review your work before submitting, making sure the reader won't be able to misinterpret it as b, or offensive. Sarcasm doesn't translate well online. Your audience can't see your facial expressions, or body language. Try to be as straight forward and professional as possible.
  • Read everything, twice. Be sure to thoroughly read all course materials before beginning to work on your assignments. If you have a question, or need clarification, re-read the materials. You may have glanced over an important detail the first time. If you're still having difficulties, then e-mail your professor.
  • Review all materials before submitting. When responding to discussion board posts, be sure to read all previous postings before you post your own. This way you won't duplicate someone else's comments. Also, it's a good idea to write, and save your work in Microsoft Word first. In case of a technical issue, you have a backup copy.

Policy Regarding Absences, Attendance, Assignments, Exams, etc.

  • Class Attendance and Absences
    As many online activities will be completed throughout the semester, participation in our Brightspace Discussion Forums is expected. In the case of exceptional circumstances that result in you not being able to participate in a timely manner, you must contact me prior to the start of your absence (either by e-mail or by leaving a telephone message). Please be aware that a prolonged absence from Brightspace under these circumstances does not excuse you from any required assignments.
  • Late Assignments
    All assignments are due at the designated time and due date. Late assignments will not be accepted. If there are circumstances that will preclude you from turning in assignments on the due date, it is imperative that you discuss the situation with the instructor prior o the due date.
  • Exams and Final Exam
    See grading for information about quizzes and exams in this course.
  • Disability Policy
    If you have any disability which requires reasonable accommodations to enable you to participate in this course, please contact the Disability Services Office, 120 South Wing, (716) 878-4500, and also the instructor of this course during the first week of class. DSO will provide you with information and review appropriate arrangements for reasonable accommodations. Buffalo State Disability Services Office Web Site
  • Academic Integrity
    Reference: Academic Standards Web Site

    Students who are suspected of academic dishonesty will be dealt with severely in accordance with the Department and College Policy. This may include a grade of 0 for an assignment and/or failure in a course.

  • Academic Dishonesty: Actions that compromise academic integrity include, but are not limited to the following examples:
    • Previously submitted work: submitting academically required material that has been previously submitted - in whole or in substantial part - in another course, without prior and expressed consent of the instructor.
    • Plagiarism. Copying or receiving material from any source and submitting that material as one's own, without acknowledging and citing the particular debts to the source (quotations, paraphrases, asic ideas), or in any other manner representing the work of another as one's own.
    • Cheating. Soliciting and/or receiving information from, or providing information to, another student or any other unauthorized source (including electronic sources such as cellular phones and PDAs), with the intent to deceive while completing an examination or individual assignment.
    • Falsification of academic materials. Fabricating laboratory materials, reports, or any forms of computer data; forging an instructor's name or initials; resubmitting an examination or assignment for re-evaluation which has been altered without the instructor's authorization; or submitting a report, paper, materials, computer data, or examination (or any considerable part thereof) prepared by any person other than the student responsible for the assignment.
    • Misrepresentation of documents. Forgery, alteration, or misuse of any College or Official document, record, or instrument of identification.
    • Confidential academic materials. Procurement, distribution or acceptance of examinations r laboratory results without prior and expressed consent of the instructor.
    • Selling academic assignments. No person shall sell or offer for sale to any person enrolled at the Buffalo State any academic assignments, or any inappropriate assistance in the preparation, research, or writing of any assignment, which the sellers knows, or has reason to believe, is intended for submission in fulfilled of any course or academic program requirement.
    • Purchasing academic assignments. No person shall purchase an academic assignment intended for submission in fulfillment of any course or academic program requirement.