-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrderEvent.cs
90 lines (78 loc) · 2.62 KB
/
OrderEvent.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace LMSWarehouse
{
public partial class FrmOrderEvent : Form
{
private int fCompanyID;
private int Event;
private Wrapper WS = new Wrapper();
public FrmOrderEvent(int CompanyID)
{
fCompanyID = CompanyID;
InitializeComponent();
Event = 0;
LoadData();
}
public void LoadData()
{
DataSet ds = WS.GetOrderEvent(fCompanyID);
dgEvent.DataSource = ds.Tables[0];
dgEvent.Columns["Company_ID"].Visible = false;
dgEvent.Columns["OrderEvent_ID"].Visible = false;
}
private void saveToolStripButton_Click(object sender, EventArgs e)
{
if (txtDescription.Text.Length > 1)
{
if (dateTimeEnd.Value > DateTime.Now)
{
WS.SetOrderEvent(Event, fCompanyID, txtDescription.Text, dateTimeStart.Value, dateTimeEnd.Value);
LoadData();
}
else
{
MessageBox.Show("The event end date is invalid");
}
}
else
{
MessageBox.Show("The event Description is invalid");
}
}
private void dateTimePicker2_ValueChanged(object sender, EventArgs e)
{
}
private void dgEvent_SelectionChanged(object sender, EventArgs e)
{
try
{
txtDescription.Text = dgEvent.CurrentRow.Cells["EventName"].Value.ToString();
dateTimeStart.Text = dgEvent.CurrentRow.Cells["DateEventStart"].Value.ToString();
dateTimeEnd.Text = dgEvent.CurrentRow.Cells["DateEventEnd"].Value.ToString();
Event = int.Parse(dgEvent.CurrentRow.Cells["OrderEvent_ID"].Value.ToString());
}
catch
{
//No Code Object not yeat initialised
}
}
private void newToolStripButton_Click(object sender, EventArgs e)
{
txtDescription.Text = "";
dateTimeStart.Text = "";
dateTimeEnd.Text = "";
Event = 0;
}
private void tsBtnDelete_Click(object sender, EventArgs e)
{
WS.SetOrderEvent(Event, fCompanyID, txtDescription.Text, dateTimeStart.Value, DateTime.Now.AddHours(-1));
LoadData();
}
}
}