-
Notifications
You must be signed in to change notification settings - Fork 0
/
Orders.cs
99 lines (90 loc) · 3 KB
/
Orders.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
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 : Form
{
public Orders()
{
InitializeComponent();
}
SqlConnection con;
SqlDataAdapter da;
SqlDataAdapter da1;
public static string orderID;
public static string OID
{
get { return orderID; }
set { orderID = value; }
}
private void Orders_Load(object sender, EventArgs e)
{
try
{
con = new SqlConnection("Data Source=HANSANA-3501;Initial Catalog=WalmartOMS_DB;Integrated Security=True");
con.Open();
da = new SqlDataAdapter("SELECT Order_ID,User_ID,Mobile_Fixed_No,Order_Date,Order_Type,Shipping_Address,Total_Amount FROM Orders WHERE User_ID='" + Login.UID + "'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dgv_orders.DataSource = dt;
con.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btn_search_Click(object sender, EventArgs e)
{
try
{
con.Open();
da1 = new SqlDataAdapter("select * from Carts where Order_ID='" + txt_oid.Text + "'", con);
DataTable dt1 = new DataTable();
da1.Fill(dt1);
dgv_carts.DataSource = dt1;
con.Close();
OID = txt_oid.Text;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btn_neworder_Click(object sender, EventArgs e)
{
Order_Dashboard_User_ od = new Order_Dashboard_User_();
od.Show();
}
private void btn_refresh_Click(object sender, EventArgs e)
{
try
{
con.Open();
da = new SqlDataAdapter("SELECT Order_ID,User_ID,Mobile_Fixed_No,Order_Date,Order_Type,Shipping_Address,Total_Amount FROM Orders WHERE User_ID='" + Login.UID + "'", con);
DataTable dt = new DataTable();
da.Fill(dt);
dgv_orders.DataSource = dt;
con.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btn_invoice_Click(object sender, EventArgs e)
{
Invoice inv = new Invoice();
inv.Show();
}
}
}