Project 7: Northwind Traders Order Entry

1 / 34
About This Presentation
Title:

Project 7: Northwind Traders Order Entry

Description:

Project 7: Northwind Traders Order Entry * * Submission Project is due before 11:59 PM, Monday night, April 25. Deliverables: Entire project folder, zipped Please use ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 35
Provided by: Rollins9
Learn more at: https://www.cse.usf.edu

less

Transcript and Presenter's Notes

Title: Project 7: Northwind Traders Order Entry


1
Project 7 Northwind Traders Order Entry
2
Northwind Order Entry
  • Extend the Select Customer program from Project 6
    to permit the user to enter orders.
  • Add orders to the database.
  • Print invoices.
  • Refer the Concept Document for background
    material
  • http//www.cse.usf.edu/turnerr/Software_Systems_D
    evelopment/Downloads/Northwind_Call_Center/
  • Note This project is just a start. It does not
    fully implement the system described in the
    Concept Document.

3
Database Tables
  • Use copies of the Northwind Traders Database
    tables in your own database on scorpius.
  • Do not use the real Northwind database, which is
    read only.
  • You should have already added these tables to
    your scorpius database.

4
Orders Table
For this project, use only OrderID, CustomerID,
and OrderDate. Note that OrderID is an Identity
field.
5
Order Details Table
For this project, set Discount to 0.00. Other
columns will have real values.
6
Products Table
For this project, ignore SupplierID,
QuantityPerUnit, UnitsInStock, UnitsOnOrder,
ReorderLevel, and Discontinued.
7
Entity Classes
  • Define an Entity class corresponding to each
    database table used by the project.
  • Customers
  • Order Details
  • Orders
  • Products

8
Database Classes
  • Objects of Entity classes encapsulate information
    corresponding to one row of a database table.
  • The Entity classes encapsulate knowledge of how
    to access the database as well as information
    from the database.

9
Home Form
  • Add a button to the Home Form labeled Enter
    Order.
  • Enabled only when a customer is selected.
  • This button brings up a new form that permits the
    user to enter an order for the selected customer.

10
Home Form
11
Order Entry Form
12
Order Entry Form
  • The Category dropdown list is bound to the
    Categories table.
  • Display Member Category Name
  • Value Member CategoryID
  • List never changes.
  • When a category is selected, the Product list is
    set up with products having the selected category.

13
Order Entry Form
  • The Product dropdown list is bound to the
    Products table, but only lists products in the
    selected category.
  • When a product is selected, its Unit Cost should
    appear in the Unit Cost textbox, a default value
    of 1 should appear in the Quantity textbox, and
    the Add to Order button should be enabled.

14
Adding an Item to the Order
  • After selecting a product, the user can enter a
    different value into the Quantity textbox if
    desired.
  • Must be a positive integer.
  • Less than 1000.

15
Order Item Information Set Up
16
Adding an Item to the Order
  • When the user clicks Add to Order, a line item is
    added to the order as shown in the DataGridView
    below the dropdown lists.
  • At this time the Submit Order button should be
    enabled.
  • It should be disabled until the first line item
    is added to the order.
  • In this project, we will not implement
    reservations for products in pending orders as
    described in the concept document.

17
Order with One Line Item
18
Entering an Order
  • The user can continue adding line items up to a
    maximum of 10.
  • The user can click Cancel to delete the current
    order and return to the Home form.
  • When all items have been entered, the user clicks
    Submit Order to add this order to the database.
  • One row is added to the Orders table.
  • One row is added to the Order Details table for
    each line item of the order.

19
Entering an Order
  • When the user clicks Submit Order the Print
    Invoice button is enabled.
  • The Submit Order button is now disabled.
  • The text on the Cancel button becomes Return.
  • User can no longer cancel the order.

20
Ready to Submit Order
21
After Order Entered
22
Print Invoice
  • The Print Invoice button outputs order
    information to a printer.
  • Use a Print Dialog to let the user select a
    printer.
  • Always print all pages.
  • There will only be one page
  • Use a fixed width font for line items so that
    columns of numbers can be aligned.

23
Invoice
24
Implementation Specifications
  • Use a DataGridView to show the line items of the
    order on the Order Entry form.
  • Use a DataTable to hold the order information as
    the order is being entered.
  • Do not put anything into the database until the
    user clicks Submit Order.

25
Implementation Specifications
  • Declare the DataTable as a member of the Order
    Entry Form class.
  • Add columns programatically in the form class
    constructor.
  • Add rows to the DataTable as line items are added
    to the order.

26
Implementation Specifications
  • Bind the DataGridView to the DataTable in the
    form class constructor.
  • Set DataGridView column widths and style
    programatically.
  • http//www.cse.usf.edu/turnerr/Software_Systems_D
    evelopment/044_DataGridView.pdf

27
Printing Tip
  • Numerical quantities should be right aligned in
    their boxes.
  • DrawString specifies position of left edge.
  • Where to you put the left edge of the string so
    that the right edge comes out at the right edge
    of the box?
  • We need to know how long the printed string will
    be.

28
Printing Tip
  • In Visual Studio Help
  • Search for MeasureText
  • http//msdn.microsoft.com/en-us/library/system.win
    dows.forms.textrenderer.measuretext(VS.80).aspx
  • http//msdn.microsoft.com/en-us/library/y4xdbe66(V
    S.80).aspx

29
TextRendered.MeasureText Method
30
TextRendered.MeasureText Method
31
MeasureText Example
  • private void print_line_item(Graphics g,
    Order_Detail od, ref int y_pos)
  • Font f new Font("Courier New", 10)
  • int h invoice_font.Height
  • Brush b invoice_brush
  • Rectangle r
  • Pen p SystemPens.WindowText
  • Size size
  • String str " "
  • int space
  • r new Rectangle(50, y_pos,
    dataGridView1.Columns0.Width, h)
  • g.DrawString(od.Product.ProductName, f, b,
    r.X 5, y_pos)
  • g.DrawRectangle(p, r)
  • r.X dataGridView1.Columns0.Width
  • r.Width dataGridView1.Columns1.Width
  • str od.Product.UnitPrice.ToString("C")
  • size TextRenderer.MeasureText(str, f)

32
Ground Rules
  • You may work with one other person.
  • OK to work alone if you prefer.
  • If you do work as a pair
  • Both members are expected to contribute.
  • Submit a single program.
  • Both members should understand the program in
    detail.
  • It is OK to discuss the project, but ...
  • Do not share your work with other students.
  • Before or after submitting the project.
  • Do not copy any other students work.
  • Dont look at anyone elses program.

33
Ground Rules
  • Except for code currently posted on the class web
    site
  • Do not copy code from the Internet
  • or any other source.
  • Write your own code.

34
Submission
  • Project is due before 1159 PM, Monday night,
    April 25.
  • Deliverables
  • Entire project folder, zipped
  • Please use Windows Send to command to zip the
    folder.
  • Submit your project using the Blackboard
    Assignment for this class.
  • If done as a pair, only one member should submit
    the project.
  • Include both names in the assignment comments and
    in source file comments.
  • Other student submit just a comment with both
    names.
  • End of Presentation
Write a Comment
User Comments (0)