Bladeren bron

Ensure that only one logging or download thread runs at a time.
Increase the number of vouchers per page.
Add HTTP compression support.
Use SecureString for password.

Brett Credo 8 jaren geleden
bovenliggende
commit
76967d9b6d

+ 82 - 53
BulkPrinting/BulkPrinting/BatchForm.Designer.cs

@@ -61,6 +61,7 @@
61 61
             // 
62 62
             // contextMenuStrip1
63 63
             // 
64
+            this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
64 65
             this.contextMenuStrip1.Name = "contextMenuStrip1";
65 66
             this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
66 67
             // 
@@ -79,9 +80,10 @@
79 80
             this.pnlSplitGrids.Controls.Add(this.btnReExport);
80 81
             this.pnlSplitGrids.Controls.Add(this.btnOrder);
81 82
             this.pnlSplitGrids.Dock = System.Windows.Forms.DockStyle.Top;
82
-            this.pnlSplitGrids.Location = new System.Drawing.Point(0, 10);
83
+            this.pnlSplitGrids.Location = new System.Drawing.Point(0, 12);
84
+            this.pnlSplitGrids.Margin = new System.Windows.Forms.Padding(4);
83 85
             this.pnlSplitGrids.Name = "pnlSplitGrids";
84
-            this.pnlSplitGrids.Size = new System.Drawing.Size(1287, 103);
86
+            this.pnlSplitGrids.Size = new System.Drawing.Size(1716, 127);
85 87
             this.pnlSplitGrids.TabIndex = 3;
86 88
             this.pnlSplitGrids.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlSplitGrids_Paint);
87 89
             // 
@@ -89,56 +91,64 @@
89 91
             // 
90 92
             this.btnOrderReport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
91 93
             this.btnOrderReport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset201clear;
94
+            this.btnOrderReport.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
92 95
             this.btnOrderReport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
93
-            this.btnOrderReport.Location = new System.Drawing.Point(118, 0);
96
+            this.btnOrderReport.Location = new System.Drawing.Point(157, 0);
97
+            this.btnOrderReport.Margin = new System.Windows.Forms.Padding(4);
94 98
             this.btnOrderReport.Name = "btnOrderReport";
95
-            this.btnOrderReport.Size = new System.Drawing.Size(100, 100);
99
+            this.btnOrderReport.Size = new System.Drawing.Size(133, 123);
96 100
             this.btnOrderReport.TabIndex = 5;
97 101
             this.btnOrderReport.UseVisualStyleBackColor = true;
98 102
             this.btnOrderReport.Click += new System.EventHandler(this.btnOrderReport_Click);
99
-            this.btnOrderReport.Paint += new System.Windows.Forms.PaintEventHandler(this.btnOrderReport_Paint);
103
+            this.btnOrderReport.Paint += new System.Windows.Forms.PaintEventHandler(this.btn_Paint);
100 104
             // 
101 105
             // btnViewPINs
102 106
             // 
103 107
             this.btnViewPINs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
104 108
             this.btnViewPINs.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
105 109
             this.btnViewPINs.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset601clear;
110
+            this.btnViewPINs.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
106 111
             this.btnViewPINs.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
107
-            this.btnViewPINs.Location = new System.Drawing.Point(696, 0);
112
+            this.btnViewPINs.Location = new System.Drawing.Point(928, 0);
113
+            this.btnViewPINs.Margin = new System.Windows.Forms.Padding(4);
108 114
             this.btnViewPINs.Name = "btnViewPINs";
109
-            this.btnViewPINs.Size = new System.Drawing.Size(100, 100);
115
+            this.btnViewPINs.Size = new System.Drawing.Size(133, 123);
110 116
             this.btnViewPINs.TabIndex = 4;
111 117
             this.btnViewPINs.UseVisualStyleBackColor = false;
112 118
             this.btnViewPINs.Click += new System.EventHandler(this.btnViewPINs_Click);
113
-            this.btnViewPINs.Paint += new System.Windows.Forms.PaintEventHandler(this.btnViewPINs_Paint);
119
+            this.btnViewPINs.Paint += new System.Windows.Forms.PaintEventHandler(this.btn_Paint);
114 120
             // 
115 121
             // btnExport
116 122
             // 
117 123
             this.btnExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
118 124
             this.btnExport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset501clear;
125
+            this.btnExport.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
119 126
             this.btnExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
120
-            this.btnExport.Location = new System.Drawing.Point(436, 0);
127
+            this.btnExport.Location = new System.Drawing.Point(581, 0);
128
+            this.btnExport.Margin = new System.Windows.Forms.Padding(4);
121 129
             this.btnExport.Name = "btnExport";
122
-            this.btnExport.Size = new System.Drawing.Size(100, 100);
130
+            this.btnExport.Size = new System.Drawing.Size(133, 123);
123 131
             this.btnExport.TabIndex = 4;
124 132
             this.btnExport.UseVisualStyleBackColor = false;
125 133
             this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
126
-            this.btnExport.Paint += new System.Windows.Forms.PaintEventHandler(this.btnExport_Paint);
134
+            this.btnExport.Paint += new System.Windows.Forms.PaintEventHandler(this.btn_Paint);
127 135
             // 
128 136
             // btnReprint
129 137
             // 
130 138
             this.btnReprint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
131 139
             this.btnReprint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(100)))), ((int)(((byte)(176)))));
132 140
             this.btnReprint.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset801clear;
141
+            this.btnReprint.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
133 142
             this.btnReprint.Enabled = false;
134 143
             this.btnReprint.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
135
-            this.btnReprint.Location = new System.Drawing.Point(908, 0);
144
+            this.btnReprint.Location = new System.Drawing.Point(1211, 0);
145
+            this.btnReprint.Margin = new System.Windows.Forms.Padding(4);
136 146
             this.btnReprint.Name = "btnReprint";
137
-            this.btnReprint.Size = new System.Drawing.Size(100, 100);
147
+            this.btnReprint.Size = new System.Drawing.Size(133, 123);
138 148
             this.btnReprint.TabIndex = 4;
139 149
             this.btnReprint.UseVisualStyleBackColor = false;
140 150
             this.btnReprint.Click += new System.EventHandler(this.btnReprint_Click);
141
-            this.btnReprint.Paint += new System.Windows.Forms.PaintEventHandler(this.btnReprint_Paint);
151
+            this.btnReprint.Paint += new System.Windows.Forms.PaintEventHandler(this.btn_Paint);
142 152
             // 
143 153
             // grpFilter
144 154
             // 
@@ -153,10 +163,12 @@
153 163
             this.grpFilter.Controls.Add(this.dtpFilterStartDate);
154 164
             this.grpFilter.Dock = System.Windows.Forms.DockStyle.Right;
155 165
             this.grpFilter.ForeColor = System.Drawing.Color.White;
156
-            this.grpFilter.Location = new System.Drawing.Point(1014, 0);
157
-            this.grpFilter.MaximumSize = new System.Drawing.Size(273, 100);
166
+            this.grpFilter.Location = new System.Drawing.Point(1352, 0);
167
+            this.grpFilter.Margin = new System.Windows.Forms.Padding(4);
168
+            this.grpFilter.MaximumSize = new System.Drawing.Size(364, 123);
158 169
             this.grpFilter.Name = "grpFilter";
159
-            this.grpFilter.Size = new System.Drawing.Size(273, 100);
170
+            this.grpFilter.Padding = new System.Windows.Forms.Padding(4);
171
+            this.grpFilter.Size = new System.Drawing.Size(364, 123);
160 172
             this.grpFilter.TabIndex = 3;
161 173
             this.grpFilter.TabStop = false;
162 174
             this.grpFilter.Text = "Filter";
@@ -164,9 +176,10 @@
164 176
             // rdoFilterExported
165 177
             // 
166 178
             this.rdoFilterExported.AutoSize = true;
167
-            this.rdoFilterExported.Location = new System.Drawing.Point(132, 69);
179
+            this.rdoFilterExported.Location = new System.Drawing.Point(176, 85);
180
+            this.rdoFilterExported.Margin = new System.Windows.Forms.Padding(4);
168 181
             this.rdoFilterExported.Name = "rdoFilterExported";
169
-            this.rdoFilterExported.Size = new System.Drawing.Size(115, 17);
182
+            this.rdoFilterExported.Size = new System.Drawing.Size(149, 21);
170 183
             this.rdoFilterExported.TabIndex = 3;
171 184
             this.rdoFilterExported.Text = "Exported Vouchers";
172 185
             this.rdoFilterExported.UseVisualStyleBackColor = true;
@@ -175,9 +188,10 @@
175 188
             // rdoFilterReprinted
176 189
             // 
177 190
             this.rdoFilterReprinted.AutoSize = true;
178
-            this.rdoFilterReprinted.Location = new System.Drawing.Point(132, 46);
191
+            this.rdoFilterReprinted.Location = new System.Drawing.Point(176, 57);
192
+            this.rdoFilterReprinted.Margin = new System.Windows.Forms.Padding(4);
179 193
             this.rdoFilterReprinted.Name = "rdoFilterReprinted";
180
-            this.rdoFilterReprinted.Size = new System.Drawing.Size(119, 17);
194
+            this.rdoFilterReprinted.Size = new System.Drawing.Size(155, 21);
181 195
             this.rdoFilterReprinted.TabIndex = 3;
182 196
             this.rdoFilterReprinted.Text = "Reprinted Vouchers";
183 197
             this.rdoFilterReprinted.UseVisualStyleBackColor = true;
@@ -187,9 +201,10 @@
187 201
             // 
188 202
             this.rdoFilterUnprinted.AutoSize = true;
189 203
             this.rdoFilterUnprinted.Checked = true;
190
-            this.rdoFilterUnprinted.Location = new System.Drawing.Point(6, 69);
204
+            this.rdoFilterUnprinted.Location = new System.Drawing.Point(8, 85);
205
+            this.rdoFilterUnprinted.Margin = new System.Windows.Forms.Padding(4);
191 206
             this.rdoFilterUnprinted.Name = "rdoFilterUnprinted";
192
-            this.rdoFilterUnprinted.Size = new System.Drawing.Size(119, 17);
207
+            this.rdoFilterUnprinted.Size = new System.Drawing.Size(155, 21);
193 208
             this.rdoFilterUnprinted.TabIndex = 3;
194 209
             this.rdoFilterUnprinted.TabStop = true;
195 210
             this.rdoFilterUnprinted.Text = "Unprinted Vouchers";
@@ -199,9 +214,10 @@
199 214
             // rdoFilterPrinted
200 215
             // 
201 216
             this.rdoFilterPrinted.AutoSize = true;
202
-            this.rdoFilterPrinted.Location = new System.Drawing.Point(6, 46);
217
+            this.rdoFilterPrinted.Location = new System.Drawing.Point(8, 57);
218
+            this.rdoFilterPrinted.Margin = new System.Windows.Forms.Padding(4);
203 219
             this.rdoFilterPrinted.Name = "rdoFilterPrinted";
204
-            this.rdoFilterPrinted.Size = new System.Drawing.Size(106, 17);
220
+            this.rdoFilterPrinted.Size = new System.Drawing.Size(138, 21);
205 221
             this.rdoFilterPrinted.TabIndex = 3;
206 222
             this.rdoFilterPrinted.Text = "Printed Vouchers";
207 223
             this.rdoFilterPrinted.UseVisualStyleBackColor = true;
@@ -210,36 +226,40 @@
210 226
             // label2
211 227
             // 
212 228
             this.label2.AutoSize = true;
213
-            this.label2.Location = new System.Drawing.Point(137, 19);
229
+            this.label2.Location = new System.Drawing.Point(183, 23);
230
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
214 231
             this.label2.Name = "label2";
215
-            this.label2.Size = new System.Drawing.Size(23, 13);
232
+            this.label2.Size = new System.Drawing.Size(29, 17);
216 233
             this.label2.TabIndex = 2;
217 234
             this.label2.Text = "To:";
218 235
             // 
219 236
             // label1
220 237
             // 
221 238
             this.label1.AutoSize = true;
222
-            this.label1.Location = new System.Drawing.Point(6, 19);
239
+            this.label1.Location = new System.Drawing.Point(8, 23);
240
+            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
223 241
             this.label1.Name = "label1";
224
-            this.label1.Size = new System.Drawing.Size(33, 13);
242
+            this.label1.Size = new System.Drawing.Size(44, 17);
225 243
             this.label1.TabIndex = 2;
226 244
             this.label1.Text = "From:";
227 245
             // 
228 246
             // dtpFilterEndDate
229 247
             // 
230 248
             this.dtpFilterEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
231
-            this.dtpFilterEndDate.Location = new System.Drawing.Point(160, 16);
249
+            this.dtpFilterEndDate.Location = new System.Drawing.Point(213, 20);
250
+            this.dtpFilterEndDate.Margin = new System.Windows.Forms.Padding(4);
232 251
             this.dtpFilterEndDate.Name = "dtpFilterEndDate";
233
-            this.dtpFilterEndDate.Size = new System.Drawing.Size(96, 20);
252
+            this.dtpFilterEndDate.Size = new System.Drawing.Size(127, 22);
234 253
             this.dtpFilterEndDate.TabIndex = 0;
235 254
             this.dtpFilterEndDate.CloseUp += new System.EventHandler(this.dtpFilterEndDate_CloseUp);
236 255
             // 
237 256
             // dtpFilterStartDate
238 257
             // 
239 258
             this.dtpFilterStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
240
-            this.dtpFilterStartDate.Location = new System.Drawing.Point(40, 16);
259
+            this.dtpFilterStartDate.Location = new System.Drawing.Point(53, 20);
260
+            this.dtpFilterStartDate.Margin = new System.Windows.Forms.Padding(4);
241 261
             this.dtpFilterStartDate.Name = "dtpFilterStartDate";
242
-            this.dtpFilterStartDate.Size = new System.Drawing.Size(96, 20);
262
+            this.dtpFilterStartDate.Size = new System.Drawing.Size(127, 22);
243 263
             this.dtpFilterStartDate.TabIndex = 0;
244 264
             this.dtpFilterStartDate.CloseUp += new System.EventHandler(this.dtpFilterStartDate_CloseUp);
245 265
             // 
@@ -249,40 +269,45 @@
249 269
             this.btnLogout.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset101clear;
250 270
             this.btnLogout.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
251 271
             this.btnLogout.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
252
-            this.btnLogout.Location = new System.Drawing.Point(12, 0);
272
+            this.btnLogout.Location = new System.Drawing.Point(16, 0);
273
+            this.btnLogout.Margin = new System.Windows.Forms.Padding(4);
253 274
             this.btnLogout.Name = "btnLogout";
254
-            this.btnLogout.Size = new System.Drawing.Size(100, 100);
275
+            this.btnLogout.Size = new System.Drawing.Size(133, 123);
255 276
             this.btnLogout.TabIndex = 1;
256 277
             this.btnLogout.UseVisualStyleBackColor = false;
257 278
             this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
258
-            this.btnLogout.Paint += new System.Windows.Forms.PaintEventHandler(this.btnLogout_Paint);
279
+            this.btnLogout.Paint += new System.Windows.Forms.PaintEventHandler(this.btn_Paint);
259 280
             // 
260 281
             // btnPrint
261 282
             // 
262 283
             this.btnPrint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
263 284
             this.btnPrint.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset401clear;
285
+            this.btnPrint.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
264 286
             this.btnPrint.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
265
-            this.btnPrint.Location = new System.Drawing.Point(330, 0);
287
+            this.btnPrint.Location = new System.Drawing.Point(440, 0);
288
+            this.btnPrint.Margin = new System.Windows.Forms.Padding(4);
266 289
             this.btnPrint.Name = "btnPrint";
267
-            this.btnPrint.Size = new System.Drawing.Size(100, 100);
290
+            this.btnPrint.Size = new System.Drawing.Size(133, 123);
268 291
             this.btnPrint.TabIndex = 0;
269 292
             this.btnPrint.UseVisualStyleBackColor = false;
270 293
             this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
271
-            this.btnPrint.Paint += new System.Windows.Forms.PaintEventHandler(this.btnPrint_Paint);
294
+            this.btnPrint.Paint += new System.Windows.Forms.PaintEventHandler(this.btn_Paint);
272 295
             // 
273 296
             // btnReExport
274 297
             // 
275 298
             this.btnReExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
276 299
             this.btnReExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(100)))), ((int)(((byte)(176)))));
277 300
             this.btnReExport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset701clear;
301
+            this.btnReExport.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
278 302
             this.btnReExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
279
-            this.btnReExport.Location = new System.Drawing.Point(802, 0);
303
+            this.btnReExport.Location = new System.Drawing.Point(1069, 0);
304
+            this.btnReExport.Margin = new System.Windows.Forms.Padding(4);
280 305
             this.btnReExport.Name = "btnReExport";
281
-            this.btnReExport.Size = new System.Drawing.Size(100, 100);
306
+            this.btnReExport.Size = new System.Drawing.Size(133, 123);
282 307
             this.btnReExport.TabIndex = 0;
283 308
             this.btnReExport.UseVisualStyleBackColor = false;
284 309
             this.btnReExport.Click += new System.EventHandler(this.btnReExport_Click);
285
-            this.btnReExport.Paint += new System.Windows.Forms.PaintEventHandler(this.btnReExport_Paint);
310
+            this.btnReExport.Paint += new System.Windows.Forms.PaintEventHandler(this.btn_Paint);
286 311
             // 
287 312
             // btnOrder
288 313
             // 
@@ -291,13 +316,14 @@
291 316
             this.btnOrder.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
292 317
             this.btnOrder.FlatAppearance.BorderColor = System.Drawing.Color.Black;
293 318
             this.btnOrder.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
294
-            this.btnOrder.Location = new System.Drawing.Point(224, 0);
319
+            this.btnOrder.Location = new System.Drawing.Point(299, 0);
320
+            this.btnOrder.Margin = new System.Windows.Forms.Padding(4);
295 321
             this.btnOrder.Name = "btnOrder";
296
-            this.btnOrder.Size = new System.Drawing.Size(100, 100);
322
+            this.btnOrder.Size = new System.Drawing.Size(133, 123);
297 323
             this.btnOrder.TabIndex = 0;
298 324
             this.btnOrder.UseVisualStyleBackColor = false;
299 325
             this.btnOrder.Click += new System.EventHandler(this.btnOrder_Click);
300
-            this.btnOrder.Paint += new System.Windows.Forms.PaintEventHandler(this.btnOrder_Paint);
326
+            this.btnOrder.Paint += new System.Windows.Forms.PaintEventHandler(this.btn_Paint);
301 327
             // 
302 328
             // dgvBatches
303 329
             // 
@@ -312,11 +338,12 @@
312 338
             this.dgvBatches.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
313 339
             this.dgvBatches.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
314 340
             this.dgvBatches.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
315
-            this.dgvBatches.Location = new System.Drawing.Point(12, 119);
341
+            this.dgvBatches.Location = new System.Drawing.Point(16, 146);
342
+            this.dgvBatches.Margin = new System.Windows.Forms.Padding(4);
316 343
             this.dgvBatches.MultiSelect = false;
317 344
             this.dgvBatches.Name = "dgvBatches";
318 345
             this.dgvBatches.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
319
-            this.dgvBatches.Size = new System.Drawing.Size(1263, 544);
346
+            this.dgvBatches.Size = new System.Drawing.Size(1684, 670);
320 347
             this.dgvBatches.TabIndex = 4;
321 348
             this.dgvBatches.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvBatches_CellContentClick);
322 349
             // 
@@ -331,9 +358,10 @@
331 358
             this.lblLoading.AutoSize = true;
332 359
             this.lblLoading.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
333 360
             this.lblLoading.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
334
-            this.lblLoading.Location = new System.Drawing.Point(516, 377);
361
+            this.lblLoading.Location = new System.Drawing.Point(688, 464);
362
+            this.lblLoading.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
335 363
             this.lblLoading.Name = "lblLoading";
336
-            this.lblLoading.Size = new System.Drawing.Size(245, 55);
364
+            this.lblLoading.Size = new System.Drawing.Size(302, 69);
337 365
             this.lblLoading.TabIndex = 6;
338 366
             this.lblLoading.Text = "Loading...";
339 367
             // 
@@ -344,17 +372,18 @@
344 372
             // 
345 373
             // BatchForm
346 374
             // 
347
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
375
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
348 376
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
349 377
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
350
-            this.ClientSize = new System.Drawing.Size(1287, 675);
378
+            this.ClientSize = new System.Drawing.Size(1716, 831);
351 379
             this.Controls.Add(this.lblLoading);
352 380
             this.Controls.Add(this.dgvBatches);
353 381
             this.Controls.Add(this.pnlSplitGrids);
354 382
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
355
-            this.MinimumSize = new System.Drawing.Size(1149, 714);
383
+            this.Margin = new System.Windows.Forms.Padding(4);
384
+            this.MinimumSize = new System.Drawing.Size(1526, 868);
356 385
             this.Name = "BatchForm";
357
-            this.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0);
386
+            this.Padding = new System.Windows.Forms.Padding(0, 12, 0, 0);
358 387
             this.Text = "Bulk Printing";
359 388
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BatchForm_FormClosing);
360 389
             this.Load += new System.EventHandler(this.BatchForm_Load);

+ 16 - 90
BulkPrinting/BulkPrinting/BatchForm.cs

@@ -19,7 +19,9 @@ namespace BulkPrinting
19 19
 {
20 20
     public partial class BatchForm : ObservedForm
21 21
     {
22
+        EventWaitHandle LoadingThreadEvent;
22 23
         Thread LoadingThread;
24
+
23 25
         public BatchForm()
24 26
         {
25 27
             InitializeComponent();
@@ -247,6 +249,7 @@ namespace BulkPrinting
247 249
             dtpFilterStartDate.Value = DateTime.Now.AddMonths(-3);
248 250
             Globals.OpenBatches = new List<int>();
249 251
 
252
+            LoadingThreadEvent = new EventWaitHandle(true, EventResetMode.AutoReset);
250 253
             LoadingThread = new Thread(() =>
251 254
             {
252 255
                 Invoke(new Action(() =>
@@ -255,14 +258,18 @@ namespace BulkPrinting
255 258
                     PopulateGrid();
256 259
                     this.Enabled = true;
257 260
                 }));
258
-                if (Globals.SessionMode == SessionModes.Online)
261
+
262
+                while (LoadingThreadEvent.WaitOne())
259 263
                 {
260
-                    Utility.SyncAllBatches();
264
+                    if (Globals.SessionMode == SessionModes.Online)
265
+                    {
266
+                        Utility.SyncAllBatches();
267
+                        Invoke(new Action(() =>
268
+                        {
269
+                            PopulateGrid();
270
+                        }));
271
+                    }
261 272
                 }
262
-                Invoke(new Action(() =>
263
-                {
264
-                    PopulateGrid();
265
-                }));
266 273
             });
267 274
             LoadingThread.Start();
268 275
             Utility.InitialiseUserLimits();
@@ -349,7 +356,7 @@ namespace BulkPrinting
349 356
                 return;
350 357
             }
351 358
 
352
-            if (LoadingThread.IsAlive)
359
+            if ((LoadingThread != null) && (LoadingThread.IsAlive))
353 360
             {
354 361
                 LoadingThread.Abort();
355 362
             }
@@ -525,77 +532,7 @@ namespace BulkPrinting
525 532
             ViewPINs.Show();
526 533
         }
527 534
 
528
-        private void btnLogout_Paint(object sender, PaintEventArgs e)
529
-        {
530
-            Button b = sender as Button;
531
-            if (!b.Enabled)
532
-            {
533
-                e.Graphics.Clear(Color.Gray);
534
-                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
535
-            }
536
-        }
537
-
538
-        private void btnOrderReport_Paint(object sender, PaintEventArgs e)
539
-        {
540
-            Button b = sender as Button;
541
-            if (!b.Enabled)
542
-            {
543
-                e.Graphics.Clear(Color.Gray);
544
-                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
545
-            }
546
-        }
547
-
548
-        private void btnOrder_Paint(object sender, PaintEventArgs e)
549
-        {
550
-            Button b = sender as Button;
551
-            if (!b.Enabled)
552
-            {
553
-                e.Graphics.Clear(Color.Gray);
554
-                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
555
-            }
556
-        }
557
-
558
-        private void btnPrint_Paint(object sender, PaintEventArgs e)
559
-        {
560
-            Button b = sender as Button;
561
-            if (!b.Enabled)
562
-            {
563
-                e.Graphics.Clear(Color.Gray);
564
-                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
565
-            }
566
-        }
567
-
568
-        private void btnExport_Paint(object sender, PaintEventArgs e)
569
-        {
570
-            Button b = sender as Button;
571
-            if (!b.Enabled)
572
-            {
573
-                e.Graphics.Clear(Color.Gray);
574
-                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
575
-            }
576
-        }
577
-
578
-        private void btnViewPINs_Paint(object sender, PaintEventArgs e)
579
-        {
580
-            Button b = sender as Button;
581
-            if (!b.Enabled)
582
-            {
583
-                e.Graphics.Clear(Color.Gray);
584
-                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
585
-            }
586
-        }
587
-
588
-        private void btnReExport_Paint(object sender, PaintEventArgs e)
589
-        {
590
-            Button b = sender as Button;
591
-            if (!b.Enabled)
592
-            {
593
-                e.Graphics.Clear(Color.Gray);
594
-                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
595
-            }
596
-        }
597
-
598
-        private void btnReprint_Paint(object sender, PaintEventArgs e)
535
+        private void btn_Paint(object sender, PaintEventArgs e)
599 536
         {
600 537
             Button b = sender as Button;
601 538
             if (!b.Enabled)
@@ -607,18 +544,7 @@ namespace BulkPrinting
607 544
 
608 545
         private void ReSyncTimer_Tick(object sender, EventArgs e)
609 546
         {
610
-            LoadingThread = new Thread(() =>
611
-            {
612
-                if (Globals.SessionMode == SessionModes.Online)
613
-                {
614
-                    Utility.SyncAllBatches();
615
-                    Invoke(new Action(() =>
616
-                    {
617
-                        PopulateGrid();
618
-                    }));
619
-                }
620
-            });
621
-            LoadingThread.Start();
547
+            LoadingThreadEvent.Set();
622 548
         }
623 549
     }
624 550
 }

+ 1 - 1
BulkPrinting/BulkPrinting/BatchForm.resx

@@ -127,7 +127,7 @@
127 127
     <value>398, 3</value>
128 128
   </metadata>
129 129
   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
130
-    <value>25</value>
130
+    <value>59</value>
131 131
   </metadata>
132 132
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
133 133
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

+ 2 - 2
BulkPrinting/BulkPrinting/Configuration.cs

@@ -9,8 +9,8 @@ namespace BulkPrinting
9 9
 {
10 10
     public static class Configuration
11 11
     {
12
-        public const string ServerDN = "196.31.118.146";//"localhost";
13
-        public const string ServerPort = "443";//"50069";
12
+        public const string ServerBaseURL = "https://196.31.118.146";
13
+        //public const string ServerBaseURL = "http://localhost:50069";
14 14
         public const string MaxDBFileName = "maxdata.dat";
15 15
         public const string MaxDataPathName = "M@X";
16 16
         //public const IDictionary<string>

+ 2 - 2
BulkPrinting/BulkPrinting/Globals.cs

@@ -23,8 +23,8 @@ namespace BulkPrinting
23 23
         public static Printer MaxPrinter;
24 24
         public static List<int> OpenBatches;
25 25
         public static UserLimits UserCurrentUsage;
26
+        public static EventWaitHandle LogSyncThreadEvent;
26 27
         public static Thread LogSyncThread;
27
-        public static bool LogSyncWaiting;
28
-        public static bool LogSyncRunning;
28
+        public static bool LogSyncThreadAborted;
29 29
     }
30 30
 }

+ 24 - 1
BulkPrinting/BulkPrinting/Models.cs

@@ -1,6 +1,8 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3 3
 using System.Linq;
4
+using System.Runtime.InteropServices;
5
+using System.Security;
4 6
 using System.Text;
5 7
 using System.Threading.Tasks;
6 8
 using Newtonsoft.Json;
@@ -50,7 +52,28 @@ namespace BulkPrinting
50 52
         public string Username { get; set; }
51 53
 
52 54
         [JsonProperty("password")]
53
-        public string Password { get; set; }
55
+        public string Password
56
+        {
57
+            get
58
+            {
59
+                if (SecurePassword != null)
60
+                {
61
+                    IntPtr valuePtr = IntPtr.Zero;
62
+                    try
63
+                    {
64
+                        valuePtr = Marshal.SecureStringToGlobalAllocUnicode(SecurePassword);
65
+                        return Marshal.PtrToStringUni(valuePtr);
66
+                    }
67
+                    finally
68
+                    {
69
+                        Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
70
+                    }
71
+                }
72
+                return null;
73
+            }
74
+        }
75
+
76
+        public SecureString SecurePassword;
54 77
     }
55 78
 
56 79
     public class OrderPlacementData

+ 11 - 14
BulkPrinting/BulkPrinting/UserLoginForm.cs

@@ -1,18 +1,11 @@
1
-using System;
1
+using Newtonsoft.Json;
2
+using System;
2 3
 using System.Collections.Generic;
3
-using System.ComponentModel;
4
-using System.Data;
5
-using System.Drawing;
4
+using System.Data.SQLite;
5
+using System.IO;
6 6
 using System.Linq;
7 7
 using System.Text;
8
-using System.Threading.Tasks;
9 8
 using System.Windows.Forms;
10
-using System.IO;
11
-using System.Net;
12
-using System.Management;
13
-using Newtonsoft.Json;
14
-using Newtonsoft.Json.Serialization;
15
-using System.Data.SQLite;
16 9
 
17 10
 namespace BulkPrinting
18 11
 {
@@ -33,7 +26,12 @@ namespace BulkPrinting
33 26
             UserLoginData.SerialNumber = Globals.HDDSerialNumber;
34 27
             UserLoginData.UserId = int.Parse(this.txtUserID.Text);
35 28
             UserLoginData.Username = this.txtUsername.Text;
36
-            UserLoginData.Password = this.txtPassword.Text;
29
+            UserLoginData.SecurePassword = new System.Security.SecureString();
30
+            foreach (var c in txtPassword.Text)
31
+            {
32
+                UserLoginData.SecurePassword.AppendChar(c);
33
+            }
34
+            UserLoginData.SecurePassword.MakeReadOnly();
37 35
             if (chkOffline.Checked == true) {
38 36
                 byte[] userKey;
39 37
                 if (Globals.SessionSalt == null || Globals.SessionIterations == 0){
@@ -128,7 +126,7 @@ namespace BulkPrinting
128 126
                             Globals.DBConnection.Open();
129 127
                         }
130 128
                         Migrations.CheckMigrations();
131
-                        Utility.SyncLogs(); //Perform log sync before any logging happens to ensure synchronicity with server
129
+                        Utility.TriggerLogSync(); //Perform log sync before any logging happens to ensure synchronicity with server
132 130
                     }
133 131
                 }
134 132
             }
@@ -166,7 +164,6 @@ namespace BulkPrinting
166 164
 
167 165
         private void UserLoginForm_Load(object sender, EventArgs e)
168 166
         {
169
-            Globals.LogSyncWaiting = false; //Ensure LogSync starts in correct state
170 167
             this.lblHDDSerial.Text = Globals.HDDSerialNumber;
171 168
             this.txtUsername.Text = Utility.LoadSetting("Username");
172 169
             this.txtUserID.Text = Utility.LoadSetting("UserID");

+ 27 - 33
BulkPrinting/BulkPrinting/Utility.cs

@@ -55,7 +55,7 @@ namespace BulkPrinting
55 55
             string PostData = JsonConvert.SerializeObject(UserLoginData);
56 56
             byte[] data = Encoding.ASCII.GetBytes(PostData);
57 57
 
58
-            HttpWebRequest request = WebRequest.Create("https://" + Configuration.ServerDN + ":" + Configuration.ServerPort + "/api/login") as HttpWebRequest;
58
+            HttpWebRequest request = WebRequest.Create(Configuration.ServerBaseURL + "/api/login") as HttpWebRequest;
59 59
             request.ServerCertificateValidationCallback = delegate { return true; };
60 60
 
61 61
             request.Method = "POST";
@@ -122,7 +122,8 @@ namespace BulkPrinting
122 122
         public static bool RESTRequest<T, R>(T POSTData, ref R Result, string RESTPath) {
123 123
             string MaxDBPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Configuration.MaxDataPathName);
124 124
 
125
-            HttpWebRequest request = WebRequest.Create("https://" + Configuration.ServerDN + ":" + Configuration.ServerPort + RESTPath) as HttpWebRequest;
125
+            HttpWebRequest request = WebRequest.Create(Configuration.ServerBaseURL + RESTPath) as HttpWebRequest;
126
+            request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
126 127
             request.ServerCertificateValidationCallback = delegate { return true; };
127 128
             request.Headers.Add("Authorization", "Bearer " + Globals.SessionData.AccessToken);
128 129
             request.ContentType = "application/json";
@@ -337,7 +338,7 @@ namespace BulkPrinting
337 338
             string Sql;
338 339
             SQLiteCommand Command;
339 340
             Page<Voucher> VoucherBatch = new Page<Voucher>();
340
-            bool BatchResult = Utility.RESTRequest<Page<Voucher>>(ref VoucherBatch, String.Format("/api/batches/{0}/vouchers/?page={1}&pageSize=1000", BatchItem.Id,PageNumber));
341
+            bool BatchResult = Utility.RESTRequest<Page<Voucher>>(ref VoucherBatch, String.Format("/api/batches/{0}/vouchers/?page={1}&pageSize=2000", BatchItem.Id,PageNumber));
341 342
             if (PageNumber == 1) //Execute on first pass only
342 343
             {
343 344
                 Sql = "DELETE FROM Voucher WHERE BatchId=@id";
@@ -548,9 +549,14 @@ namespace BulkPrinting
548 549
                 Command.Parameters.Add(new SQLiteParameter("@value", SessionDataJson));
549 550
                 Command.ExecuteNonQuery();
550 551
                 Utility.LogEvent(VendorEvent.VendorEventType.Logout);
551
-                while (Globals.LogSyncRunning || Globals.LogSyncThread.IsAlive)
552
+                if (Globals.LogSyncThread != null)
552 553
                 {
553
-                    Globals.LogSyncThread.Join();
554
+                    Globals.LogSyncThreadAborted = true;
555
+                    Globals.LogSyncThreadEvent.Set();
556
+                    if (Globals.LogSyncThread.IsAlive)
557
+                    {
558
+                        Globals.LogSyncThread.Join();
559
+                    }
554 560
                 }
555 561
 
556 562
                 Globals.DBConnection.Close();
@@ -576,11 +582,8 @@ namespace BulkPrinting
576 582
 
577 583
         public static bool SyncLogs()
578 584
         {
579
-            Globals.LogSyncRunning = true;
580
-            bool ReSyncLogs = true;
581
-            while (ReSyncLogs)
585
+            while (Globals.LogSyncThreadEvent.WaitOne() && ! Globals.LogSyncThreadAborted)
582 586
             {
583
-                ReSyncLogs = false;
584 587
                 int LastSyncedLogID = GetLastSyncedLogID();
585 588
                 string Sql = "SELECT MAX(Id) FROM Logs";
586 589
                 SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
@@ -668,16 +671,21 @@ namespace BulkPrinting
668 671
                         }
669 672
                     }
670 673
                 }
671
-                if (Globals.LogSyncWaiting)
672
-                {
673
-                    Globals.LogSyncWaiting = false;
674
-                    ReSyncLogs = true;
675
-                }
676 674
             }
677
-            Globals.LogSyncRunning = false;
678 675
             return true;
679 676
         }
680 677
 
678
+        public static void TriggerLogSync()
679
+        {
680
+            if (Globals.LogSyncThread == null)
681
+            {
682
+                Globals.LogSyncThreadEvent = new EventWaitHandle(false, EventResetMode.AutoReset);
683
+                Globals.LogSyncThread = new Thread(() => SyncLogs());
684
+                Globals.LogSyncThread.Start();
685
+            }
686
+            Globals.LogSyncThreadEvent.Set();
687
+        }
688
+
681 689
         public static void LogBulkEvents(List<EventLog> EventLogs)
682 690
         {
683 691
             string Sql = "INSERT INTO Logs (UserId, VoucherId, EventDate, EventType, Retry) VALUES (@userid, @voucherid, @eventdate, @eventtype, @retry)";
@@ -703,15 +711,7 @@ namespace BulkPrinting
703 711
             //SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
704 712
             if (Globals.SessionMode == SessionModes.Online)
705 713
             {
706
-                //if (Globals.LogSyncTask != null && Globals.LogSyncTask.Status == TaskStatus.Running)
707
-                if (Globals.LogSyncRunning)
708
-                {
709
-                    Globals.LogSyncWaiting = true;
710
-                    return;
711
-                }
712
-                Globals.LogSyncThread = new Thread(() => SyncLogs());
713
-                Globals.LogSyncThread.Start();
714
-                //var Result = await Task.Run(() => SyncLogs()).ConfigureAwait(false);
714
+                TriggerLogSync();
715 715
             }
716 716
         }
717 717
 
@@ -731,15 +731,7 @@ namespace BulkPrinting
731 731
             //SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
732 732
             if (Globals.SessionMode == SessionModes.Online)
733 733
             {
734
-                //if (Globals.LogSyncTask != null && Globals.LogSyncTask.Status == TaskStatus.Running)
735
-                if (Globals.LogSyncRunning)
736
-                {
737
-                    Globals.LogSyncWaiting = true;
738
-                    return;
739
-                }
740
-                Globals.LogSyncThread = new Thread(() => SyncLogs());
741
-                Globals.LogSyncThread.Start();
742
-                //var Result = await Task.Run(() => SyncLogs()).ConfigureAwait(false);
734
+                TriggerLogSync();
743 735
             }
744 736
         }
745 737
 
@@ -1064,6 +1056,7 @@ namespace BulkPrinting
1064 1056
             return UnprintedVouchers;
1065 1057
         }
1066 1058
 
1059
+        /*
1067 1060
         public class BulkLogger : IDisposable
1068 1061
         {
1069 1062
             SQLiteTransaction transaction;
@@ -1153,6 +1146,7 @@ namespace BulkPrinting
1153 1146
             }
1154 1147
             #endregion
1155 1148
         }
1149
+        */
1156 1150
     }
1157 1151
 }
1158 1152