MIS3502 – Project 2 Scenario: To review: the FoxTrade Corporation is a small brokerage firm that provides personalized service for its customers. The company’s customer service representatives perform several duties. First, they maintain their database of customers and make sure it is up to date. Second, they take customer requests to buy and sell stocks. Third, they take questions from customers regarding their accounts; therefore, they need up to date information on the buy and sell orders each customer has executed and their portfolio of stocks. The first project was a “proof of concept” application that managed the customer database and provided a simple reporting facility. This project is a full-service application that will handle stock transactions and more complex reporting. The business rules for FoxTrade are straightforward: 1) Each buy and sell order must be handled as a separate transactions and can only be carried out for a single stock. For example, if a customer wants to buy 20 shares of Coca-Cola and sell 15 shares of McDonalds, they must be handled as two separate transactions. 2) Stock purchases are deducted from the customer’s cash account. 3) When a customer sells stock, the value of that sale is added to their account balance. 4) A customer cannot buy more shares than the value of his or her account balance. If the customer tries to purchase more shares than they can afford, the entire transaction is cancelled. 5) A customer cannot sell more shares of a stock than are in his or her portfolio. If the customer tries to sell more shares than they have, the entire transaction is cancelled. Requirements: Create an ASP.NET application that allows employees from the FoxTrade Corporation to maintain customer information, perform buy and sell orders from those customers, and run simple reports on customer activity. The application will again use the FoxTrade.mdb Microsoft Access database (available on Blackboard, but make sure you’re using the latest version). MIS3502 Project 2 Page 2 The following is the metadata for the Stock, Customer, and Transactions tables: Stocks Table Metadata Field Type Description Ticker FullName Price Exchange String String Double String The ticker symbol for the stock The full name of the company The current price of a share The exchange on which the stock is traded Customer Table Metadata Field Type Description Customer_ID C_SS C_FName C_MName C_LName C_Address1 C_Address2 C_City C_State C_Zip C_Phone C_AccountBalance Long Integer Long Integer String String String String String String String Long Integer String Double The customer’s identification number The customer’s social security number The customer’s first name The customer’s middle name The customer’s last name First line of the customer’s address Second line of the customer’s address The city where the customer resides The state where the customer resides The zip code where the customer resides The customer’s primary telephone number The customer’s account balance (in dollars) Transactions Table Metadata Field TransactionID TransactionDate CustomerID Ticker Shares SalePrice Type Long Integer Date/Time Long Integer String Long Integer Double Description The unique identifier for a transaction The date of the transaction The customer that bought the stock The stock that was purchased The number of shares purchased The price of a share at the time of sale Refer primarily to the notes for “Coding ADO.NET objects.” You will be using the GridView and AccessDataSource controls for this project, but only for reporting – for the “Customer Management” and “Record Transaction” forms, you’ll be writing code for everything and not using GridView or DetailsView! This prototype will be developed as a web application although it will run from your local computer (i.e., it won’t be run from a server). The application will have four pages: 1) 2) 3) 4) A main menu A form to edit and create customers A form to record customer transactions (buy and sell orders) A form to generate a customer activity report MIS3502 Project 2 Each of these pages is described below: Main Menu The “Main Menu” screen will have the following components: 1) A hyperlink to the Customer Management form 2) A hyperlink to the Record Transaction form 3) A hyperlink to the Customer Activity report Feel free to create an attractive layout for the menu. Customer Management Form Page 3 MIS3502 Project 2 Page 4 The “Customer Management” form will have the following components: 1) A drop-down list that displays the Customer_ID (from the Customer table) and the full name of the customers in the Customer table. The format of the item will look like this: Customer_ID: LastName, FirstName (i.e., 5: Pujolis, Anne) The value for each drop-down list item should be the Customer_ID. 2) When a customer is selected from the drop-down list, the rest of the form fields (a series of Textboxes) will be populated with values from the Customer table. 3) An “Update Record” button that retrieves the data from the form fields and uses that data to construct a SQL UPDATE query. Use the SelectedValue from the Customer drop-down list to update the appropriate record in the Customer table. When you edit a customer record, those changes should be reflected in the drop-down list (i.e., first name and last name). 4) “Create New Customer” button that retrieves the data from the form fields and uses that data to construct a SQL INSERT query. The new record will have a Customer_ID value one greater than the highest existing Customer_ID in the table (like the first project). When you add a customer record, it should also update the drop-down list so that it includes the new customer. HINT: Instead of looping through the rows of the table in order to find the highest Customer_ID value, you could use a SQL SELECT MAX query. 5) A “Delete Customer” button that deletes the Customer record that corresponds to the SelectedValue from the customer drop-down list. The data for that customer in the Transactions table should also be deleted. You will need to use two SQL DELETE queries. When you delete a customer record, it should also update the drop-down list so it removes that customer. 6) A Hyperlink to the main menu. 7) Input for numeric fields should be validated to prevent non-numeric (and out of “reasonable range” data from being entered in those fields. MIS3502 Project 2 Page 5 Record Transaction Form The “Record Transaction” form will have the following components: 1) A drop-down list that displays the Customer_ID (from the Customer table). The value for each drop-down list item should also be the Customer_ID. 2) A second drop-down list that displays the Ticker (from the Stock table). The value for each drop-down list item should also be the Ticker value. 3) When either a Customer or Stock is selected from the drop-down lists, the rest of the form fields will be populated with values from the appropriate tables: Full name of the stock and its current price comes from the Stock table The customer’s account balance comes from the Customer table The customer’s current shares of the stock comes from the Transaction table Figuring out the current shares of stock owned by a customer is a little tricky. Keep in mind that there will be multiple transactions for a single stock/customer combination, like this: MIS3502 Project 2 Page 6 So if I want to figure out how many shares of Comcast (CMCSA) stock are owned by the customer with the ID of 17, you’d need to SUM the number of shares for that customer ID and that stock ticker. You can do it within a single SQL statement. 4) A “Buy Shares” button that inserts (as in SQL INSERT) a new record into the Transactions table. The record data will come from the form (Labels, Textboxes, and DropDownLists). The number of shares should be recorded as a positive number. Once you update the Transaction table, you should also update the Customer table with the new balance (the old balance less the value of the shares purchased). HINT: Remember that you should first check to make sure that the customer can afford the purchase. The amount of the transaction (number of shares x current share price) must be less than or equal to their account balance. You can get the information right from the populated form. HINT: Each transaction should have a unique TransactionID. You should use a SQL SELECT MAX query to find the highest TransactionID in the table. 5) A “Sell Shares” button that inserts a new record into the Transactions table. Again, the record data will come from the form (Labels, Textboxes, and DropDownLists). The number of shares should be recorded as a negative number. Once you update the Transaction table, you should also update the Customer table with the new account balance (the old balance plus the value of shares sold). HINT: Remember that you should first check to make sure that the customer has enough shares to sell. The number of shares to sell should be less than or equal to the number of shares they own. You can get the information right from the populated form. 6) A Hyperlink to the main menu. 7) Input for numeric fields should be validated to prevent non-numeric (and out of “reasonable range”) data from being entered. Be careful to configure the validation controls properly or you might make it impossible for the user to create a new transaction at all! Test your application! MIS3502 Project 2 Page 7 Customer Activity Report Form The “Customer Activity Report” form will have the following components (note that this is the only part of the project where you should use the GridView and the AccessDataSource): 1) A drop-down list that displays the Customer_ID (from the Customer table). The value for each drop-down list item should also be the Customer_ID. You can either populate the DropDownList by using the ADO.NET code (as you did for the other forms), or use an AccessDataSource with a custom query. 2) A GridView that displays the list of transactions recorded for the selected customer. For this, you must use an AccessDataSource with the GridView. The GridView field for TransactionDate should be formatted as a date (no time) and the field for SalePrice should be formatted as currency. 3) A GridView that displays the shares of stock owned by the selected customer. For this, you must use an AccessDataSource with the GridView. The query is similar (but not identical) to the one you did in the “Record Transaction” form. You’ll still want to SUM all the shares for the selected customer, but you’ll also want to “group” them by stock ticker. Again, this can be done within a single SQL statement. 4) A Label that displays the total cash value of the portfolio, based on the total number of shares for each stock the customer owns, and the current share price. For this, you must use an AccessDataSource with the Label. The Label should be populated using the DataView and DataRowView objects. MIS3502 Project 2 Page 8 You can refer to the lab “Unbound Controls and the AccessDataSource.” The query for this requires you to sum the product of shares and price for each transaction recorded in the Transactions table for the selected customer. Note that price comes from the stocks table, so you will need to do a join of the Transactions and Stocks tables in order to do this query. Notice that the total portfolio amount is formatted as currency. To do this, you can use the String.Format("{0:C}", value) method, where value is a double value representing the share price. 5) A Hyperlink to the main menu. You will also the following analysis and design documentation for your application (refer to the course notes regarding how to do each one of these): 1) A use case diagram depicting the following use cases: Select a customer Create a new customer Delete a customer Update a customer Buy shares Sell shares Generate customer report 2) Brief descriptions of all use cases. 3) A test plan (and its results) for your application. Your test plan should include a procedure for testing each use case and the results from the test. Deliverables (What gets turned in and how to submit your assignment): Submit your completed assignment by sending an email to me. Keep a copy of the sent message in the “Sent Items” folder on your machine. Do NOT use the Blackboard email or dropbox services. In the subject line of your email, enter 3502P2 and your name. Do not leave any spaces in 3502P2. We use the subject of the email to file your assignment. The email should have two attachments: 1) A Word document containing the systems analysis documentation (including the test plan) described above. 2) A “Zip” file containing all of your project files. The best way to this is to zip your entire project folder. MIS3502 Project 2 Page 9 Getting Help This is an individual project and therefore you should do your own work without collaborating with your classmates. However, you are welcome to ask me any question you would like about the project. You are also welcome to request clarification regarding any part of these instructions. If my office hours are not convenient for you, contact me via phone or email and I will schedule a time when we can talk. Grading Breakdown You will be evaluated on the successful completion of the project listed above. You will receive no credit for the project if your application does not compile, and you will not receive credit for any part of the application which does not work properly. The weight for each component of the project is as follows: Application: Main menu Select a customer Update a customer Insert a customer Delete a customer Buy stocks Sell stocks Customer report Validation for data Documentation: 5% 5% 5% 5% 5% 10% 10% 10% 5% Code documentation Use case diagram Use case descriptions Test plan 5% 5% 10% 20%