1 northwind traders order entry. 2 northwind traders call center add an order entry capability to...
TRANSCRIPT
![Page 1: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/1.jpg)
1
Northwind Traders Order Entry
![Page 2: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/2.jpg)
2
Northwind Traders Call Center
Add an Order Entry capability to the Northwind Traders Call Center application.
Start with the solution for Project 6 Select Customer http://www.cse.usf.edu/~turnerr/Software_Systems_Develo
pment/Downloads/Project_Solutions/ File P6_Select_Customer.zip
Expand .zip file Open solution
![Page 3: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/3.jpg)
3
Add Button to Home Form
“Enter New Order” will be enabled only when a customer is selected.
Brings up new “Order Entry” form.
btnEnterOrder
![Page 4: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/4.jpg)
4
Add Order Entry Form
![Page 5: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/5.jpg)
5
Order Entry Form
Double click on form to create Form Load event handler.
lblCurrentCustomer
![Page 6: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/6.jpg)
6
Order Entry Form
private void Order_Entry_Form_Load(object sender, EventArgs e)
{
lblCurrentCustomer.Text =
"Order for customer: " +
Program.Selected_Customer.CompanyName;
}
![Page 7: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/7.jpg)
7
Enter New Order
Add code to Home form to show Order_Entry_Form.
private void btnEnterOrder_Click(object sender, EventArgs e)
{
Order_Entry_Form f = new Order_Entry_Form ();
this.Hide();
f.ShowDialog();
this.Show();
}
![Page 8: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/8.jpg)
8
Enable Order Entry
In Home Form, enable Enter Order button if, and only if, there is a selected customer.
![Page 9: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/9.jpg)
9
Home_Form.cs
private void btnSelectCustomer_Click(object sender, EventArgs e)
{
Select_Customer_Form sc = new Select_Customer_Form();
this.Hide();
sc.ShowDialog();
this.Show();
btnEnterOrder.Enabled = Program.Customer_Selected;
if (Program.Customer_Selected)
{
Customer c = Program.Selected_Customer;
tbSelectedCustomer.Text = c.CompanyName;
}
else
{
tbSelectedCustomer.Text = "No Customer Selected";
}
}
Build and run.
![Page 10: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/10.jpg)
10
Order Entry Form
![Page 11: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/11.jpg)
11
Order Entry Form
User will specify Product Category. Product Quantity
Click Submit or Cancel
![Page 12: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/12.jpg)
12
Specifying the Product
Use a data bound Dropdown list on the Order Entry form to select Product Category.
Add and configure data source.
Data > Add New Data Source Table Categories
Display: CategoryName Value: CategoryID
![Page 13: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/13.jpg)
13
Add New Data Source
![Page 14: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/14.jpg)
14
New Data Source
![Page 15: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/15.jpg)
15
Specify Connection
Click New Connection
![Page 16: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/16.jpg)
16
Add New Connection
Click OK
![Page 17: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/17.jpg)
17
Configuring the Data Source
Click Next
![Page 18: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/18.jpg)
18
Configuring the Data Source
Click Next
![Page 19: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/19.jpg)
19
Configuring the Data Source
Click Finish
![Page 20: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/20.jpg)
20
Binding the Data Source
We have the data source.
Now add a dropdown list (ComboBox) cbCategory
Bind it to the data source.
Details on following slides.
![Page 21: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/21.jpg)
21
Add ComboBox
cbCategory
Set DataSource
![Page 22: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/22.jpg)
22
Set DisplayMember and ValueMember
![Page 23: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/23.jpg)
23
Set Connection String
Set the connection string for the new Data Source.
private void Order_Entry_Form_Load(object sender, EventArgs e)
{
this.categoriesTableAdapter.Connection.ConnectionString =
"server=scorpius.eng.usf.edu; " +
"User=" + Program.Username + "; " +
"Password=" + Program.Password;
// TODO: This line of code loads data into the 'dataSet3.Categories' // table. You can move, or remove it, as needed.
this.categoriesTableAdapter.Fill(this.dataSet3.Categories);
lblCurrentCustomer.Text =
"Order for customer: " +
Program.Selected_Customer.CompanyName;
}
![Page 24: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/24.jpg)
24
Add Event Handler
Add an event handler for Selected Index Changed in the Categories ComboBox. Double click on the ComboBox.
private void cbCategory_SelectedIndexChanged(object sender,
EventArgs e)
{
MessageBox.Show(cbCategory.SelectedValue.ToString());
}
![Page 25: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/25.jpg)
25
Program in Action
![Page 26: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/26.jpg)
26
Product Selection
Now add a Dropdown List that offers just products of the selected category. Drag ComboBox from Toolbox. Don’t copy and paste the first ComboBox.
New ComboBox: cbProducts New Data Source: Table Products
ProductID ProductName
![Page 27: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/27.jpg)
27
Product Selection
![Page 28: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/28.jpg)
28
Add Query for Products
Note productsTableAdapter Responsible for filling DataSet
Click on cbProducts to select it. Click on smart tag (upper right
corner) and select Add Query Will specify the query that will be used
by the productsTableAdapter to fill the data set that is bound to the Products ComboBox.
![Page 29: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/29.jpg)
29
Smart Tag Clicked
Click Add Query
![Page 30: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/30.jpg)
30
New Query
![Page 31: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/31.jpg)
31
Set Connection String
private void Order_Entry_Form_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the ...
this.productsTableAdapter.Connection.ConnectionString =
"server=scorpius.eng.usf.edu; " +
"User=" + Program.Username + "; " +
"Password=" + Program.Password;
this.productsTableAdapter.Fill(this.productsDataSet.Products);
this.categoriesTableAdapter.Connection.ConnectionString =
"server=scorpius.eng.usf.edu; " +
"User=" + Program.Username + "; " +
"Password=" + Program.Password;
this.categoriesTableAdapter.Fill(this.dataSet3.Categories);
lblCurrentCustomer.Text =
"Order for customer: " +
Program.Selected_Customer.CompanyName;
}
![Page 32: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/32.jpg)
32
Update cbCategory Event Handler
private void cbCategory_SelectedIndexChanged(object sender, EventArgs e)
{
//MessageBox.Show(cbCategory.SelectedValue.ToString());
int category_id = (int)cbCategory.SelectedValue;
this.productsTableAdapter.FillByCategory(this.productsDataSet.Products,
category_id);
cbProducts.Enabled = true;
}
Whenever a new category is selected, the Products table in ProductsDataSet will be refilled using the FillByCategory query.
![Page 33: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/33.jpg)
33
Program in Action
![Page 34: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/34.jpg)
34
Clean Up the Form
We don’t need the fillByCategoryToolStrip
Right click, Delete
![Page 35: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/35.jpg)
35
Delete Event Handler
Delete event handler for fillbyCategoryToolStripButton
//private void fillByCategoryToolStripButton_Click(object sender
// EventArgs e)
//{
// try
// {
// ...
// }
// catch (System.Exception ex)
// {
// System.Windows.Forms.MessageBox.Show(ex.Message);
// }
//}
![Page 36: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/36.jpg)
36
Program in Action
![Page 37: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/37.jpg)
37
Add Event Handler
Double click on cbProduct to add an event handler.
private void cbProduct_SelectedIndexChanged(object sender,
EventArgs e)
{
MessageBox.Show(cbProducts.Text);
}
![Page 38: 1 Northwind Traders Order Entry. 2 Northwind Traders Call Center Add an Order Entry capability to the Northwind Traders Call Center application. Start](https://reader035.vdocuments.site/reader035/viewer/2022081507/5516dd63550346d02f8b456a/html5/thumbnails/38.jpg)
38
Program in Action