ソースを参照

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 年 前
コミット
76967d9b6d

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

61
             // 
61
             // 
62
             // contextMenuStrip1
62
             // contextMenuStrip1
63
             // 
63
             // 
64
+            this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
64
             this.contextMenuStrip1.Name = "contextMenuStrip1";
65
             this.contextMenuStrip1.Name = "contextMenuStrip1";
65
             this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
66
             this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
66
             // 
67
             // 
79
             this.pnlSplitGrids.Controls.Add(this.btnReExport);
80
             this.pnlSplitGrids.Controls.Add(this.btnReExport);
80
             this.pnlSplitGrids.Controls.Add(this.btnOrder);
81
             this.pnlSplitGrids.Controls.Add(this.btnOrder);
81
             this.pnlSplitGrids.Dock = System.Windows.Forms.DockStyle.Top;
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
             this.pnlSplitGrids.Name = "pnlSplitGrids";
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
             this.pnlSplitGrids.TabIndex = 3;
87
             this.pnlSplitGrids.TabIndex = 3;
86
             this.pnlSplitGrids.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlSplitGrids_Paint);
88
             this.pnlSplitGrids.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlSplitGrids_Paint);
87
             // 
89
             // 
89
             // 
91
             // 
90
             this.btnOrderReport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
92
             this.btnOrderReport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
91
             this.btnOrderReport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset201clear;
93
             this.btnOrderReport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset201clear;
94
+            this.btnOrderReport.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
92
             this.btnOrderReport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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
             this.btnOrderReport.Name = "btnOrderReport";
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
             this.btnOrderReport.TabIndex = 5;
100
             this.btnOrderReport.TabIndex = 5;
97
             this.btnOrderReport.UseVisualStyleBackColor = true;
101
             this.btnOrderReport.UseVisualStyleBackColor = true;
98
             this.btnOrderReport.Click += new System.EventHandler(this.btnOrderReport_Click);
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
             // btnViewPINs
105
             // btnViewPINs
102
             // 
106
             // 
103
             this.btnViewPINs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
107
             this.btnViewPINs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
104
             this.btnViewPINs.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
108
             this.btnViewPINs.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
105
             this.btnViewPINs.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset601clear;
109
             this.btnViewPINs.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset601clear;
110
+            this.btnViewPINs.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
106
             this.btnViewPINs.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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
             this.btnViewPINs.Name = "btnViewPINs";
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
             this.btnViewPINs.TabIndex = 4;
116
             this.btnViewPINs.TabIndex = 4;
111
             this.btnViewPINs.UseVisualStyleBackColor = false;
117
             this.btnViewPINs.UseVisualStyleBackColor = false;
112
             this.btnViewPINs.Click += new System.EventHandler(this.btnViewPINs_Click);
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
             // btnExport
121
             // btnExport
116
             // 
122
             // 
117
             this.btnExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
123
             this.btnExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
118
             this.btnExport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset501clear;
124
             this.btnExport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset501clear;
125
+            this.btnExport.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
119
             this.btnExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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
             this.btnExport.Name = "btnExport";
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
             this.btnExport.TabIndex = 4;
131
             this.btnExport.TabIndex = 4;
124
             this.btnExport.UseVisualStyleBackColor = false;
132
             this.btnExport.UseVisualStyleBackColor = false;
125
             this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
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
             // btnReprint
136
             // btnReprint
129
             // 
137
             // 
130
             this.btnReprint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
138
             this.btnReprint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
131
             this.btnReprint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(100)))), ((int)(((byte)(176)))));
139
             this.btnReprint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(100)))), ((int)(((byte)(176)))));
132
             this.btnReprint.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset801clear;
140
             this.btnReprint.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset801clear;
141
+            this.btnReprint.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
133
             this.btnReprint.Enabled = false;
142
             this.btnReprint.Enabled = false;
134
             this.btnReprint.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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
             this.btnReprint.Name = "btnReprint";
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
             this.btnReprint.TabIndex = 4;
148
             this.btnReprint.TabIndex = 4;
139
             this.btnReprint.UseVisualStyleBackColor = false;
149
             this.btnReprint.UseVisualStyleBackColor = false;
140
             this.btnReprint.Click += new System.EventHandler(this.btnReprint_Click);
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
             // grpFilter
153
             // grpFilter
144
             // 
154
             // 
153
             this.grpFilter.Controls.Add(this.dtpFilterStartDate);
163
             this.grpFilter.Controls.Add(this.dtpFilterStartDate);
154
             this.grpFilter.Dock = System.Windows.Forms.DockStyle.Right;
164
             this.grpFilter.Dock = System.Windows.Forms.DockStyle.Right;
155
             this.grpFilter.ForeColor = System.Drawing.Color.White;
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
             this.grpFilter.Name = "grpFilter";
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
             this.grpFilter.TabIndex = 3;
172
             this.grpFilter.TabIndex = 3;
161
             this.grpFilter.TabStop = false;
173
             this.grpFilter.TabStop = false;
162
             this.grpFilter.Text = "Filter";
174
             this.grpFilter.Text = "Filter";
164
             // rdoFilterExported
176
             // rdoFilterExported
165
             // 
177
             // 
166
             this.rdoFilterExported.AutoSize = true;
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
             this.rdoFilterExported.Name = "rdoFilterExported";
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
             this.rdoFilterExported.TabIndex = 3;
183
             this.rdoFilterExported.TabIndex = 3;
171
             this.rdoFilterExported.Text = "Exported Vouchers";
184
             this.rdoFilterExported.Text = "Exported Vouchers";
172
             this.rdoFilterExported.UseVisualStyleBackColor = true;
185
             this.rdoFilterExported.UseVisualStyleBackColor = true;
175
             // rdoFilterReprinted
188
             // rdoFilterReprinted
176
             // 
189
             // 
177
             this.rdoFilterReprinted.AutoSize = true;
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
             this.rdoFilterReprinted.Name = "rdoFilterReprinted";
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
             this.rdoFilterReprinted.TabIndex = 3;
195
             this.rdoFilterReprinted.TabIndex = 3;
182
             this.rdoFilterReprinted.Text = "Reprinted Vouchers";
196
             this.rdoFilterReprinted.Text = "Reprinted Vouchers";
183
             this.rdoFilterReprinted.UseVisualStyleBackColor = true;
197
             this.rdoFilterReprinted.UseVisualStyleBackColor = true;
187
             // 
201
             // 
188
             this.rdoFilterUnprinted.AutoSize = true;
202
             this.rdoFilterUnprinted.AutoSize = true;
189
             this.rdoFilterUnprinted.Checked = true;
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
             this.rdoFilterUnprinted.Name = "rdoFilterUnprinted";
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
             this.rdoFilterUnprinted.TabIndex = 3;
208
             this.rdoFilterUnprinted.TabIndex = 3;
194
             this.rdoFilterUnprinted.TabStop = true;
209
             this.rdoFilterUnprinted.TabStop = true;
195
             this.rdoFilterUnprinted.Text = "Unprinted Vouchers";
210
             this.rdoFilterUnprinted.Text = "Unprinted Vouchers";
199
             // rdoFilterPrinted
214
             // rdoFilterPrinted
200
             // 
215
             // 
201
             this.rdoFilterPrinted.AutoSize = true;
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
             this.rdoFilterPrinted.Name = "rdoFilterPrinted";
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
             this.rdoFilterPrinted.TabIndex = 3;
221
             this.rdoFilterPrinted.TabIndex = 3;
206
             this.rdoFilterPrinted.Text = "Printed Vouchers";
222
             this.rdoFilterPrinted.Text = "Printed Vouchers";
207
             this.rdoFilterPrinted.UseVisualStyleBackColor = true;
223
             this.rdoFilterPrinted.UseVisualStyleBackColor = true;
210
             // label2
226
             // label2
211
             // 
227
             // 
212
             this.label2.AutoSize = true;
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
             this.label2.Name = "label2";
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
             this.label2.TabIndex = 2;
233
             this.label2.TabIndex = 2;
217
             this.label2.Text = "To:";
234
             this.label2.Text = "To:";
218
             // 
235
             // 
219
             // label1
236
             // label1
220
             // 
237
             // 
221
             this.label1.AutoSize = true;
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
             this.label1.Name = "label1";
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
             this.label1.TabIndex = 2;
243
             this.label1.TabIndex = 2;
226
             this.label1.Text = "From:";
244
             this.label1.Text = "From:";
227
             // 
245
             // 
228
             // dtpFilterEndDate
246
             // dtpFilterEndDate
229
             // 
247
             // 
230
             this.dtpFilterEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
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
             this.dtpFilterEndDate.Name = "dtpFilterEndDate";
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
             this.dtpFilterEndDate.TabIndex = 0;
253
             this.dtpFilterEndDate.TabIndex = 0;
235
             this.dtpFilterEndDate.CloseUp += new System.EventHandler(this.dtpFilterEndDate_CloseUp);
254
             this.dtpFilterEndDate.CloseUp += new System.EventHandler(this.dtpFilterEndDate_CloseUp);
236
             // 
255
             // 
237
             // dtpFilterStartDate
256
             // dtpFilterStartDate
238
             // 
257
             // 
239
             this.dtpFilterStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
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
             this.dtpFilterStartDate.Name = "dtpFilterStartDate";
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
             this.dtpFilterStartDate.TabIndex = 0;
263
             this.dtpFilterStartDate.TabIndex = 0;
244
             this.dtpFilterStartDate.CloseUp += new System.EventHandler(this.dtpFilterStartDate_CloseUp);
264
             this.dtpFilterStartDate.CloseUp += new System.EventHandler(this.dtpFilterStartDate_CloseUp);
245
             // 
265
             // 
249
             this.btnLogout.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset101clear;
269
             this.btnLogout.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset101clear;
250
             this.btnLogout.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
270
             this.btnLogout.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
251
             this.btnLogout.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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
             this.btnLogout.Name = "btnLogout";
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
             this.btnLogout.TabIndex = 1;
276
             this.btnLogout.TabIndex = 1;
256
             this.btnLogout.UseVisualStyleBackColor = false;
277
             this.btnLogout.UseVisualStyleBackColor = false;
257
             this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
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
             // btnPrint
281
             // btnPrint
261
             // 
282
             // 
262
             this.btnPrint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
283
             this.btnPrint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
263
             this.btnPrint.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset401clear;
284
             this.btnPrint.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset401clear;
285
+            this.btnPrint.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
264
             this.btnPrint.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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
             this.btnPrint.Name = "btnPrint";
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
             this.btnPrint.TabIndex = 0;
291
             this.btnPrint.TabIndex = 0;
269
             this.btnPrint.UseVisualStyleBackColor = false;
292
             this.btnPrint.UseVisualStyleBackColor = false;
270
             this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
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
             // btnReExport
296
             // btnReExport
274
             // 
297
             // 
275
             this.btnReExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
298
             this.btnReExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
276
             this.btnReExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(100)))), ((int)(((byte)(176)))));
299
             this.btnReExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(100)))), ((int)(((byte)(176)))));
277
             this.btnReExport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset701clear;
300
             this.btnReExport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset701clear;
301
+            this.btnReExport.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
278
             this.btnReExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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
             this.btnReExport.Name = "btnReExport";
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
             this.btnReExport.TabIndex = 0;
307
             this.btnReExport.TabIndex = 0;
283
             this.btnReExport.UseVisualStyleBackColor = false;
308
             this.btnReExport.UseVisualStyleBackColor = false;
284
             this.btnReExport.Click += new System.EventHandler(this.btnReExport_Click);
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
             // btnOrder
312
             // btnOrder
288
             // 
313
             // 
291
             this.btnOrder.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
316
             this.btnOrder.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
292
             this.btnOrder.FlatAppearance.BorderColor = System.Drawing.Color.Black;
317
             this.btnOrder.FlatAppearance.BorderColor = System.Drawing.Color.Black;
293
             this.btnOrder.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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
             this.btnOrder.Name = "btnOrder";
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
             this.btnOrder.TabIndex = 0;
323
             this.btnOrder.TabIndex = 0;
298
             this.btnOrder.UseVisualStyleBackColor = false;
324
             this.btnOrder.UseVisualStyleBackColor = false;
299
             this.btnOrder.Click += new System.EventHandler(this.btnOrder_Click);
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
             // dgvBatches
328
             // dgvBatches
303
             // 
329
             // 
312
             this.dgvBatches.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
338
             this.dgvBatches.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
313
             this.dgvBatches.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
339
             this.dgvBatches.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
314
             this.dgvBatches.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
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
             this.dgvBatches.MultiSelect = false;
343
             this.dgvBatches.MultiSelect = false;
317
             this.dgvBatches.Name = "dgvBatches";
344
             this.dgvBatches.Name = "dgvBatches";
318
             this.dgvBatches.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
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
             this.dgvBatches.TabIndex = 4;
347
             this.dgvBatches.TabIndex = 4;
321
             this.dgvBatches.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvBatches_CellContentClick);
348
             this.dgvBatches.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvBatches_CellContentClick);
322
             // 
349
             // 
331
             this.lblLoading.AutoSize = true;
358
             this.lblLoading.AutoSize = true;
332
             this.lblLoading.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
359
             this.lblLoading.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
333
             this.lblLoading.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
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
             this.lblLoading.Name = "lblLoading";
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
             this.lblLoading.TabIndex = 6;
365
             this.lblLoading.TabIndex = 6;
338
             this.lblLoading.Text = "Loading...";
366
             this.lblLoading.Text = "Loading...";
339
             // 
367
             // 
344
             // 
372
             // 
345
             // BatchForm
373
             // BatchForm
346
             // 
374
             // 
347
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
375
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
348
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
376
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
349
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
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
             this.Controls.Add(this.lblLoading);
379
             this.Controls.Add(this.lblLoading);
352
             this.Controls.Add(this.dgvBatches);
380
             this.Controls.Add(this.dgvBatches);
353
             this.Controls.Add(this.pnlSplitGrids);
381
             this.Controls.Add(this.pnlSplitGrids);
354
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
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
             this.Name = "BatchForm";
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
             this.Text = "Bulk Printing";
387
             this.Text = "Bulk Printing";
359
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BatchForm_FormClosing);
388
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BatchForm_FormClosing);
360
             this.Load += new System.EventHandler(this.BatchForm_Load);
389
             this.Load += new System.EventHandler(this.BatchForm_Load);

+ 16 - 90
BulkPrinting/BulkPrinting/BatchForm.cs

19
 {
19
 {
20
     public partial class BatchForm : ObservedForm
20
     public partial class BatchForm : ObservedForm
21
     {
21
     {
22
+        EventWaitHandle LoadingThreadEvent;
22
         Thread LoadingThread;
23
         Thread LoadingThread;
24
+
23
         public BatchForm()
25
         public BatchForm()
24
         {
26
         {
25
             InitializeComponent();
27
             InitializeComponent();
247
             dtpFilterStartDate.Value = DateTime.Now.AddMonths(-3);
249
             dtpFilterStartDate.Value = DateTime.Now.AddMonths(-3);
248
             Globals.OpenBatches = new List<int>();
250
             Globals.OpenBatches = new List<int>();
249
 
251
 
252
+            LoadingThreadEvent = new EventWaitHandle(true, EventResetMode.AutoReset);
250
             LoadingThread = new Thread(() =>
253
             LoadingThread = new Thread(() =>
251
             {
254
             {
252
                 Invoke(new Action(() =>
255
                 Invoke(new Action(() =>
255
                     PopulateGrid();
258
                     PopulateGrid();
256
                     this.Enabled = true;
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
             LoadingThread.Start();
274
             LoadingThread.Start();
268
             Utility.InitialiseUserLimits();
275
             Utility.InitialiseUserLimits();
349
                 return;
356
                 return;
350
             }
357
             }
351
 
358
 
352
-            if (LoadingThread.IsAlive)
359
+            if ((LoadingThread != null) && (LoadingThread.IsAlive))
353
             {
360
             {
354
                 LoadingThread.Abort();
361
                 LoadingThread.Abort();
355
             }
362
             }
525
             ViewPINs.Show();
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
             Button b = sender as Button;
537
             Button b = sender as Button;
601
             if (!b.Enabled)
538
             if (!b.Enabled)
607
 
544
 
608
         private void ReSyncTimer_Tick(object sender, EventArgs e)
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
     <value>398, 3</value>
127
     <value>398, 3</value>
128
   </metadata>
128
   </metadata>
129
   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
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
   </metadata>
131
   </metadata>
132
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
132
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
133
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
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
 {
9
 {
10
     public static class Configuration
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
         public const string MaxDBFileName = "maxdata.dat";
14
         public const string MaxDBFileName = "maxdata.dat";
15
         public const string MaxDataPathName = "M@X";
15
         public const string MaxDataPathName = "M@X";
16
         //public const IDictionary<string>
16
         //public const IDictionary<string>

+ 2 - 2
BulkPrinting/BulkPrinting/Globals.cs

23
         public static Printer MaxPrinter;
23
         public static Printer MaxPrinter;
24
         public static List<int> OpenBatches;
24
         public static List<int> OpenBatches;
25
         public static UserLimits UserCurrentUsage;
25
         public static UserLimits UserCurrentUsage;
26
+        public static EventWaitHandle LogSyncThreadEvent;
26
         public static Thread LogSyncThread;
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
 using System;
1
 using System;
2
 using System.Collections.Generic;
2
 using System.Collections.Generic;
3
 using System.Linq;
3
 using System.Linq;
4
+using System.Runtime.InteropServices;
5
+using System.Security;
4
 using System.Text;
6
 using System.Text;
5
 using System.Threading.Tasks;
7
 using System.Threading.Tasks;
6
 using Newtonsoft.Json;
8
 using Newtonsoft.Json;
50
         public string Username { get; set; }
52
         public string Username { get; set; }
51
 
53
 
52
         [JsonProperty("password")]
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
     public class OrderPlacementData
79
     public class OrderPlacementData

+ 11 - 14
BulkPrinting/BulkPrinting/UserLoginForm.cs

1
-using System;
1
+using Newtonsoft.Json;
2
+using System;
2
 using System.Collections.Generic;
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
 using System.Linq;
6
 using System.Linq;
7
 using System.Text;
7
 using System.Text;
8
-using System.Threading.Tasks;
9
 using System.Windows.Forms;
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
 namespace BulkPrinting
10
 namespace BulkPrinting
18
 {
11
 {
33
             UserLoginData.SerialNumber = Globals.HDDSerialNumber;
26
             UserLoginData.SerialNumber = Globals.HDDSerialNumber;
34
             UserLoginData.UserId = int.Parse(this.txtUserID.Text);
27
             UserLoginData.UserId = int.Parse(this.txtUserID.Text);
35
             UserLoginData.Username = this.txtUsername.Text;
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
             if (chkOffline.Checked == true) {
35
             if (chkOffline.Checked == true) {
38
                 byte[] userKey;
36
                 byte[] userKey;
39
                 if (Globals.SessionSalt == null || Globals.SessionIterations == 0){
37
                 if (Globals.SessionSalt == null || Globals.SessionIterations == 0){
128
                             Globals.DBConnection.Open();
126
                             Globals.DBConnection.Open();
129
                         }
127
                         }
130
                         Migrations.CheckMigrations();
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
 
164
 
167
         private void UserLoginForm_Load(object sender, EventArgs e)
165
         private void UserLoginForm_Load(object sender, EventArgs e)
168
         {
166
         {
169
-            Globals.LogSyncWaiting = false; //Ensure LogSync starts in correct state
170
             this.lblHDDSerial.Text = Globals.HDDSerialNumber;
167
             this.lblHDDSerial.Text = Globals.HDDSerialNumber;
171
             this.txtUsername.Text = Utility.LoadSetting("Username");
168
             this.txtUsername.Text = Utility.LoadSetting("Username");
172
             this.txtUserID.Text = Utility.LoadSetting("UserID");
169
             this.txtUserID.Text = Utility.LoadSetting("UserID");

+ 27 - 33
BulkPrinting/BulkPrinting/Utility.cs

55
             string PostData = JsonConvert.SerializeObject(UserLoginData);
55
             string PostData = JsonConvert.SerializeObject(UserLoginData);
56
             byte[] data = Encoding.ASCII.GetBytes(PostData);
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
             request.ServerCertificateValidationCallback = delegate { return true; };
59
             request.ServerCertificateValidationCallback = delegate { return true; };
60
 
60
 
61
             request.Method = "POST";
61
             request.Method = "POST";
122
         public static bool RESTRequest<T, R>(T POSTData, ref R Result, string RESTPath) {
122
         public static bool RESTRequest<T, R>(T POSTData, ref R Result, string RESTPath) {
123
             string MaxDBPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Configuration.MaxDataPathName);
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
             request.ServerCertificateValidationCallback = delegate { return true; };
127
             request.ServerCertificateValidationCallback = delegate { return true; };
127
             request.Headers.Add("Authorization", "Bearer " + Globals.SessionData.AccessToken);
128
             request.Headers.Add("Authorization", "Bearer " + Globals.SessionData.AccessToken);
128
             request.ContentType = "application/json";
129
             request.ContentType = "application/json";
337
             string Sql;
338
             string Sql;
338
             SQLiteCommand Command;
339
             SQLiteCommand Command;
339
             Page<Voucher> VoucherBatch = new Page<Voucher>();
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
             if (PageNumber == 1) //Execute on first pass only
342
             if (PageNumber == 1) //Execute on first pass only
342
             {
343
             {
343
                 Sql = "DELETE FROM Voucher WHERE BatchId=@id";
344
                 Sql = "DELETE FROM Voucher WHERE BatchId=@id";
548
                 Command.Parameters.Add(new SQLiteParameter("@value", SessionDataJson));
549
                 Command.Parameters.Add(new SQLiteParameter("@value", SessionDataJson));
549
                 Command.ExecuteNonQuery();
550
                 Command.ExecuteNonQuery();
550
                 Utility.LogEvent(VendorEvent.VendorEventType.Logout);
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
                 Globals.DBConnection.Close();
562
                 Globals.DBConnection.Close();
576
 
582
 
577
         public static bool SyncLogs()
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
                 int LastSyncedLogID = GetLastSyncedLogID();
587
                 int LastSyncedLogID = GetLastSyncedLogID();
585
                 string Sql = "SELECT MAX(Id) FROM Logs";
588
                 string Sql = "SELECT MAX(Id) FROM Logs";
586
                 SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
589
                 SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
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
             return true;
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
         public static void LogBulkEvents(List<EventLog> EventLogs)
689
         public static void LogBulkEvents(List<EventLog> EventLogs)
682
         {
690
         {
683
             string Sql = "INSERT INTO Logs (UserId, VoucherId, EventDate, EventType, Retry) VALUES (@userid, @voucherid, @eventdate, @eventtype, @retry)";
691
             string Sql = "INSERT INTO Logs (UserId, VoucherId, EventDate, EventType, Retry) VALUES (@userid, @voucherid, @eventdate, @eventtype, @retry)";
703
             //SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
711
             //SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
704
             if (Globals.SessionMode == SessionModes.Online)
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
             //SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
731
             //SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
732
             if (Globals.SessionMode == SessionModes.Online)
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
             return UnprintedVouchers;
1056
             return UnprintedVouchers;
1065
         }
1057
         }
1066
 
1058
 
1059
+        /*
1067
         public class BulkLogger : IDisposable
1060
         public class BulkLogger : IDisposable
1068
         {
1061
         {
1069
             SQLiteTransaction transaction;
1062
             SQLiteTransaction transaction;
1153
             }
1146
             }
1154
             #endregion
1147
             #endregion
1155
         }
1148
         }
1149
+        */
1156
     }
1150
     }
1157
 }
1151
 }
1158
 
1152