-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrders(Staff).cs
62 lines (57 loc) · 1.87 KB
/
Orders(Staff).cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Walmart_OMS
{
public partial class Orders_Staff_ : Form
{
public Orders_Staff_()
{
InitializeComponent();
}
SqlConnection con;
SqlCommand cmd;
SqlDataAdapter da;
private void Orders_Staff__Load(object sender, EventArgs e)
{
con = new SqlConnection("Data Source=HANSANA-3501;Initial Catalog=WalmartOMS_DB;Integrated Security=True");
}
private void btn_searchOrder_Click(object sender, EventArgs e)
{
try
{
con.Open();
cmd = new SqlCommand("select * from Carts where Order_ID = '" + txt_orderID.Text + "'", con);
da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
con.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btn_searchAmount_Click(object sender, EventArgs e)
{
try
{
// TODO: This line of code loads data into the 'cart_rp.Orders' table. You can move, or remove it, as needed.
this.ordersTableAdapter.Fill(this.cart_rp.Orders, Convert.ToInt32(txt_totAmount.Text));
this.reportViewer1.RefreshReport();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}