-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmRequestAproval.cs
274 lines (242 loc) · 8.69 KB
/
frmRequestAproval.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
using System;
using System.Windows.Forms;
using UpgradeHelpers.DB.ADO;
using UpgradeHelpers.Gui;
namespace SKS
{
internal partial class frmRequestApproval
: System.Windows.Forms.Form
{
private string Id = "";
public frmRequestApproval()
: base()
{
if (m_vb6FormDefInstance == null)
{
if (m_InitializingDefInstance)
{
m_vb6FormDefInstance = this;
}
else
{
try
{
//For the start-up form, the first instance created is the default instance.
if (System.Reflection.Assembly.GetExecutingAssembly().EntryPoint != null && System.Reflection.Assembly.GetExecutingAssembly().EntryPoint.DeclaringType == this.GetType())
{
m_vb6FormDefInstance = this;
}
}
catch
{
}
}
}
//This call is required by the Windows Form Designer.
InitializeComponent();
ReLoadForm(false);
}
private void cmbStatus_SelectedIndexChanged(Object eventSender, EventArgs eventArgs)
{
DoSearchRequest();
}
private void cmdApprove_Click(Object eventSender, EventArgs eventArgs)
{
LoadActionOrderRequest(1);
}
private void cmdCancel_Click(Object eventSender, EventArgs eventArgs)
{
LoadActionOrderRequest(2);
}
private void cmdInfo_Click(Object eventSender, EventArgs eventArgs)
{
LoadActionOrderRequest();
}
private void LoadActionOrderRequest(int Action = 0)
{
int OrderId = 0;
if (fgOrders.CurrentRowIndex > 0)
{
OrderId = Convert.ToInt32(Double.Parse(Convert.ToString(fgOrders[fgOrders.CurrentRowIndex, 1].Value)));
frmActionOrderRequest.DefInstance.OrderId = OrderId;
frmActionOrderRequest.DefInstance.Action = Action;
frmActionOrderRequest.DefInstance.LoadData();
frmActionOrderRequest.DefInstance.Show(); //vbModal
}
}
private void dtFrom_ValueChanged(Object eventSender, EventArgs eventArgs)
{
chkFrom.CheckState = CheckState.Checked;
DoSearchRequest();
}
private void dtTo_ValueChanged(Object eventSender, EventArgs eventArgs)
{
chkTo.CheckState = CheckState.Checked;
DoSearchRequest();
}
private void fgOrders_DoubleClick(Object eventSender, EventArgs eventArgs)
{
cmdInfo_Click(cmdInfo, new EventArgs());
}
//UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load method and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
private void Form_Load()
{
InitGrid();
}
private void txtOrderID_TextChanged(Object eventSender, EventArgs eventArgs)
{
DoSearchRequest();
}
private void txtProductID_TextChanged(Object eventSender, EventArgs eventArgs)
{
DoSearchRequest();
}
private void txtCompanyName_TextChanged(Object eventSender, EventArgs eventArgs)
{
DoSearchRequest();
}
private void txtContactLastName_TextChanged(Object eventSender, EventArgs eventArgs)
{
DoSearchRequest();
}
private void txtContactName_TextChanged(Object eventSender, EventArgs eventArgs)
{
DoSearchRequest();
}
//UPGRADE_NOTE: (7001) The following declaration (txtName_Change) seems to be dead code More Information: https://www.mobilize.net/vbtonet/ewis/ewi7001
//private void txtName_Change()
//{
//DoSearchRequest();
//}
private void cmdClose_Click(Object eventSender, EventArgs eventArgs)
{
this.Close();
}
private void cmdCustomers_Click(Object eventSender, EventArgs eventArgs)
{
frmCustomers.DefInstance.ShowDialog();
txtCompanyName.Text = "";
txtContactLastName.Text = "";
txtContactName.Text = "";
DoSearchRequest(Convert.ToInt32(Double.Parse(frmCustomers.DefInstance.CurrentCustomerID)));
frmCustomers.DefInstance.Close();
}
private void DoSearchRequest(int Id = -1)
{
string filter = "";
if (Id != -1)
{
filter = "o.CustomerID = " + Id.ToString();
}
//UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
if (!String.IsNullOrEmpty(txtCompanyName.Text))
{
modFunctions.AppendAND(ref filter);
filter = "c.CompanyName LIKE '%" + txtCompanyName.Text + "%'";
}
//UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
if (!String.IsNullOrEmpty(txtContactName.Text))
{
modFunctions.AppendAND(ref filter);
filter = filter + "c.ContactFirstName LIKE '%" + txtContactName.Text + "%'";
}
//UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
if (!String.IsNullOrEmpty(txtContactLastName.Text))
{
modFunctions.AppendAND(ref filter);
filter = filter + "c.ContactLastName LIKE '%" + txtContactLastName.Text + "%'";
}
//UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
if (!String.IsNullOrEmpty(txtOrderID.Text))
{
modFunctions.AppendAND(ref filter);
filter = filter + "o.OrderID = " + txtOrderID.Text;
}
//UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
if (!String.IsNullOrEmpty(txtProductID.Text))
{
modFunctions.AppendAND(ref filter);
filter = filter + "d.ProductID LIKE '%" + txtProductID.Text + "%'";
}
if (chkFrom.CheckState == CheckState.Checked)
{
modFunctions.AppendAND(ref filter);
//UPGRADE_WARNING: (1068) dtFrom.value of type Variant is being forced to DateTime. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1068
filter = filter + "o.OrderDate >= #" + Convert.ToDateTime(dtFrom.GetValue()).ToString("MM/dd/yyyy") + "#";
}
if (chkTo.CheckState == CheckState.Checked)
{
modFunctions.AppendAND(ref filter);
//UPGRADE_WARNING: (1068) dtTo.value of type Variant is being forced to DateTime. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1068
filter = filter + "o.OrderDate <= #" + Convert.ToDateTime(dtTo.GetValue()).ToString("MM/dd/yyyy") + "#";
}
if (cmbStatus.SelectedIndex != -1 && cmbStatus.Text != "All")
{
modFunctions.AppendAND(ref filter);
filter = filter + "o.Status = '" + cmbStatus.Text + "'";
}
string where = " Where o.OrderID = d.OrderID And c.CustomerID = o.CustomerID And u.Username = o.EmployeeId ";
//UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
if (!String.IsNullOrEmpty(filter))
{
filter = where + " AND " + filter;
}
else
{
filter = where;
}
string sql = "Select o.OrderDate, o.OrderID, c.CompanyName, c.ContactFirstName + ' ' + c.ContactLastName as ContactName, u.Fullname as [Received by], Sum(d.LineTotal) as Price, o.Status " +
"From OrderRequests as o, OrderRequestDetails as d, Customers as c, Users as u " +
filter + " Group by o.orderDate, o.OrderID, c.CompanyName, c.ContactFirstName + ' ' + c.ContactLastName, u.Fullname, o.Status ";
modConnection.ExecuteSql(sql);
modMain.LogStatus("There are " + modConnection.rs.RecordCount.ToString() + " records with the selected criteria", this);
int i = 0;
fgOrders.RowsCount = modConnection.rs.RecordCount + 1;
if (fgOrders.RowsCount == 1)
{
fgOrders.FixedRows = 0;
}
else
{
fgOrders.FixedRows = 1;
}
i = 1;
while (!modConnection.rs.EOF)
{
int tempForEndVar = modConnection.rs.FieldsMetadata.Count - 1;
for (int j = 0; j <= tempForEndVar; j++)
{
if (modConnection.rs.GetField(j) != null)
{
fgOrders[i, j].Value = Convert.ToString(modConnection.rs[j]);
}
}
modConnection.rs.MoveNext();
i++;
}
}
private void InitGrid()
{
fgOrders.RowsCount = 0;
fgOrders.ColumnsCount = 7;
fgOrders.FixedColumns = 0;
fgOrders.AddItem("Date" + "\t" + "Order" + "\t" + "Customer" + "\t" + "Contact" + "\t" + "Received by" + "\t" + "Price" + "\t" + "Status");
fgOrders.RowsCount = 1;
fgOrders.FixedRows = 0;
}
//'''''''''''''''''''''''''''''
//''UNUSED CODE Start
//UPGRADE_NOTE: (7001) The following declaration (MakeTextBoxVisible) seems to be dead code More Information: https://www.mobilize.net/vbtonet/ewis/ewi7001
//private void MakeTextBoxVisible(TextBox txtBox, UpgradeHelpers.DataGridViewFlex grid)
//{
//txtBox.Text = Convert.ToString(grid[grid.CurrentRowIndex, grid.CurrentColumnIndex].Value);
//txtBox.SetBounds(grid.CellLeft / 15 + grid.Left, grid.CellTop / 15 + grid.Top, grid.CellWidth / 15, grid.CellHeight / 15);
//txtBox.Visible = true;
//Application.DoEvents();
//txtBox.Focus();
//}
private void Form_Closed(Object eventSender, EventArgs eventArgs)
{
}
}
}