Преглед на файлове

Hide reset to default button on print settings form.
Prevent viewing of PINs for unprinted vouchers.

Andrew Klopper преди 7 години
родител
ревизия
23d421669a

+ 1 - 0
BulkPrinting/BulkPrinting/PrinterSettingsForm.Designer.cs

@@ -79,6 +79,7 @@
79 79
             this.resetButton.TabIndex = 5;
80 80
             this.resetButton.Text = "Reset to Default";
81 81
             this.resetButton.UseVisualStyleBackColor = false;
82
+            this.resetButton.Visible = false;
82 83
             this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
83 84
             // 
84 85
             // okButton

+ 1 - 1
BulkPrinting/BulkPrinting/Properties/AssemblyInfo.cs

@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
33 33
 // by using the '*' as shown below:
34 34
 // [assembly: AssemblyVersion("1.0.*")]
35 35
 [assembly: AssemblyVersion("1.0.*")]
36
-[assembly: AssemblyFileVersion("1.12")]
36
+[assembly: AssemblyFileVersion("1.13")]

+ 28 - 28
BulkPrinting/BulkPrinting/VoucherForm.Designer.cs

@@ -65,12 +65,12 @@
65 65
             this.dgvVouchers.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
66 66
             this.dgvVouchers.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
67 67
             this.dgvVouchers.Location = new System.Drawing.Point(16, 133);
68
-            this.dgvVouchers.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
68
+            this.dgvVouchers.Margin = new System.Windows.Forms.Padding(4);
69 69
             this.dgvVouchers.MultiSelect = false;
70 70
             this.dgvVouchers.Name = "dgvVouchers";
71 71
             this.dgvVouchers.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
72 72
             this.dgvVouchers.Size = new System.Drawing.Size(939, 534);
73
-            this.dgvVouchers.TabIndex = 5;
73
+            this.dgvVouchers.TabIndex = 10;
74 74
             this.dgvVouchers.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvVouchers_CellContentClick);
75 75
             // 
76 76
             // lblBatchDetails
@@ -89,10 +89,10 @@
89 89
             this.rdoPrintDate.AutoSize = true;
90 90
             this.rdoPrintDate.ForeColor = System.Drawing.Color.White;
91 91
             this.rdoPrintDate.Location = new System.Drawing.Point(16, 49);
92
-            this.rdoPrintDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
92
+            this.rdoPrintDate.Margin = new System.Windows.Forms.Padding(4);
93 93
             this.rdoPrintDate.Name = "rdoPrintDate";
94 94
             this.rdoPrintDate.Size = new System.Drawing.Size(163, 21);
95
-            this.rdoPrintDate.TabIndex = 8;
95
+            this.rdoPrintDate.TabIndex = 0;
96 96
             this.rdoPrintDate.Text = "Date Printed (range):";
97 97
             this.rdoPrintDate.UseVisualStyleBackColor = true;
98 98
             this.rdoPrintDate.CheckedChanged += new System.EventHandler(this.rdoPrintDate_CheckedChanged);
@@ -102,10 +102,10 @@
102 102
             this.rdoVoucherRange.AutoSize = true;
103 103
             this.rdoVoucherRange.ForeColor = System.Drawing.Color.White;
104 104
             this.rdoVoucherRange.Location = new System.Drawing.Point(16, 78);
105
-            this.rdoVoucherRange.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
105
+            this.rdoVoucherRange.Margin = new System.Windows.Forms.Padding(4);
106 106
             this.rdoVoucherRange.Name = "rdoVoucherRange";
107 107
             this.rdoVoucherRange.Size = new System.Drawing.Size(207, 21);
108
-            this.rdoVoucherRange.TabIndex = 8;
108
+            this.rdoVoucherRange.TabIndex = 1;
109 109
             this.rdoVoucherRange.Text = "Vouchers in Selected Batch:";
110 110
             this.rdoVoucherRange.UseVisualStyleBackColor = true;
111 111
             this.rdoVoucherRange.CheckedChanged += new System.EventHandler(this.rdoVoucherRange_CheckedChanged);
@@ -116,10 +116,10 @@
116 116
             this.rdoSerialNum.Checked = true;
117 117
             this.rdoSerialNum.ForeColor = System.Drawing.Color.White;
118 118
             this.rdoSerialNum.Location = new System.Drawing.Point(16, 106);
119
-            this.rdoSerialNum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
119
+            this.rdoSerialNum.Margin = new System.Windows.Forms.Padding(4);
120 120
             this.rdoSerialNum.Name = "rdoSerialNum";
121 121
             this.rdoSerialNum.Size = new System.Drawing.Size(123, 21);
122
-            this.rdoSerialNum.TabIndex = 8;
122
+            this.rdoSerialNum.TabIndex = 2;
123 123
             this.rdoSerialNum.TabStop = true;
124 124
             this.rdoSerialNum.Text = "Serial Number:";
125 125
             this.rdoSerialNum.UseVisualStyleBackColor = true;
@@ -133,7 +133,7 @@
133 133
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
134 134
             this.label1.Name = "label1";
135 135
             this.label1.Size = new System.Drawing.Size(159, 17);
136
-            this.label1.TabIndex = 9;
136
+            this.label1.TabIndex = 11;
137 137
             this.label1.Text = "Search for vouchers by:";
138 138
             this.label1.Click += new System.EventHandler(this.label1_Click);
139 139
             // 
@@ -141,29 +141,29 @@
141 141
             // 
142 142
             this.dtpStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
143 143
             this.dtpStartDate.Location = new System.Drawing.Point(471, 48);
144
-            this.dtpStartDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
144
+            this.dtpStartDate.Margin = new System.Windows.Forms.Padding(4);
145 145
             this.dtpStartDate.Name = "dtpStartDate";
146 146
             this.dtpStartDate.Size = new System.Drawing.Size(132, 22);
147
-            this.dtpStartDate.TabIndex = 10;
147
+            this.dtpStartDate.TabIndex = 3;
148 148
             this.dtpStartDate.ValueChanged += new System.EventHandler(this.dtpStartDate_ValueChanged);
149 149
             // 
150 150
             // dtpEndDate
151 151
             // 
152 152
             this.dtpEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
153 153
             this.dtpEndDate.Location = new System.Drawing.Point(680, 48);
154
-            this.dtpEndDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
154
+            this.dtpEndDate.Margin = new System.Windows.Forms.Padding(4);
155 155
             this.dtpEndDate.Name = "dtpEndDate";
156 156
             this.dtpEndDate.Size = new System.Drawing.Size(132, 22);
157
-            this.dtpEndDate.TabIndex = 10;
157
+            this.dtpEndDate.TabIndex = 4;
158 158
             this.dtpEndDate.ValueChanged += new System.EventHandler(this.dtpEndDate_ValueChanged);
159 159
             // 
160 160
             // txtSerial
161 161
             // 
162 162
             this.txtSerial.Location = new System.Drawing.Point(427, 105);
163
-            this.txtSerial.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
163
+            this.txtSerial.Margin = new System.Windows.Forms.Padding(4);
164 164
             this.txtSerial.Name = "txtSerial";
165 165
             this.txtSerial.Size = new System.Drawing.Size(385, 22);
166
-            this.txtSerial.TabIndex = 11;
166
+            this.txtSerial.TabIndex = 8;
167 167
             // 
168 168
             // lblBatch1
169 169
             // 
@@ -173,7 +173,7 @@
173 173
             this.lblBatch1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
174 174
             this.lblBatch1.Name = "lblBatch1";
175 175
             this.lblBatch1.Size = new System.Drawing.Size(40, 17);
176
-            this.lblBatch1.TabIndex = 12;
176
+            this.lblBatch1.TabIndex = 15;
177 177
             this.lblBatch1.Text = "From";
178 178
             this.lblBatch1.Click += new System.EventHandler(this.lblBatch1_Click);
179 179
             // 
@@ -197,7 +197,7 @@
197 197
             this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
198 198
             this.label4.Name = "label4";
199 199
             this.label4.Size = new System.Drawing.Size(25, 17);
200
-            this.label4.TabIndex = 12;
200
+            this.label4.TabIndex = 13;
201 201
             this.label4.Text = "To";
202 202
             this.label4.Click += new System.EventHandler(this.label4_Click);
203 203
             // 
@@ -209,26 +209,26 @@
209 209
             this.lblBatch2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
210 210
             this.lblBatch2.Name = "lblBatch2";
211 211
             this.lblBatch2.Size = new System.Drawing.Size(25, 17);
212
-            this.lblBatch2.TabIndex = 12;
212
+            this.lblBatch2.TabIndex = 16;
213 213
             this.lblBatch2.Text = "To";
214 214
             this.lblBatch2.Click += new System.EventHandler(this.lblBatch2_Click);
215 215
             // 
216 216
             // numStartSeqNo
217 217
             // 
218 218
             this.numStartSeqNo.Location = new System.Drawing.Point(471, 76);
219
-            this.numStartSeqNo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
219
+            this.numStartSeqNo.Margin = new System.Windows.Forms.Padding(4);
220 220
             this.numStartSeqNo.Name = "numStartSeqNo";
221 221
             this.numStartSeqNo.Size = new System.Drawing.Size(133, 22);
222
-            this.numStartSeqNo.TabIndex = 14;
222
+            this.numStartSeqNo.TabIndex = 6;
223 223
             this.numStartSeqNo.ValueChanged += new System.EventHandler(this.numStartSeqNo_ValueChanged);
224 224
             // 
225 225
             // numEndSeqNo
226 226
             // 
227 227
             this.numEndSeqNo.Location = new System.Drawing.Point(680, 76);
228
-            this.numEndSeqNo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
228
+            this.numEndSeqNo.Margin = new System.Windows.Forms.Padding(4);
229 229
             this.numEndSeqNo.Name = "numEndSeqNo";
230 230
             this.numEndSeqNo.Size = new System.Drawing.Size(133, 22);
231
-            this.numEndSeqNo.TabIndex = 14;
231
+            this.numEndSeqNo.TabIndex = 7;
232 232
             this.numEndSeqNo.ValueChanged += new System.EventHandler(this.numEndSeqNo_ValueChanged);
233 233
             // 
234 234
             // btnSearch
@@ -238,20 +238,20 @@
238 238
             this.btnSearch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
239 239
             this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
240 240
             this.btnSearch.Location = new System.Drawing.Point(821, 2);
241
-            this.btnSearch.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
241
+            this.btnSearch.Margin = new System.Windows.Forms.Padding(4);
242 242
             this.btnSearch.Name = "btnSearch";
243 243
             this.btnSearch.Size = new System.Drawing.Size(133, 123);
244
-            this.btnSearch.TabIndex = 13;
244
+            this.btnSearch.TabIndex = 9;
245 245
             this.btnSearch.UseVisualStyleBackColor = false;
246 246
             this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
247 247
             // 
248 248
             // numBatchId
249 249
             // 
250 250
             this.numBatchId.Location = new System.Drawing.Point(323, 76);
251
-            this.numBatchId.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
251
+            this.numBatchId.Margin = new System.Windows.Forms.Padding(4);
252 252
             this.numBatchId.Name = "numBatchId";
253 253
             this.numBatchId.Size = new System.Drawing.Size(92, 22);
254
-            this.numBatchId.TabIndex = 15;
254
+            this.numBatchId.TabIndex = 5;
255 255
             // 
256 256
             // label2
257 257
             // 
@@ -261,7 +261,7 @@
261 261
             this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
262 262
             this.label2.Name = "label2";
263 263
             this.label2.Size = new System.Drawing.Size(61, 17);
264
-            this.label2.TabIndex = 16;
264
+            this.label2.TabIndex = 14;
265 265
             this.label2.Text = "Batch ID";
266 266
             // 
267 267
             // VoucherForm
@@ -289,7 +289,7 @@
289 289
             this.Controls.Add(this.lblBatchDetails);
290 290
             this.Controls.Add(this.dgvVouchers);
291 291
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
292
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
292
+            this.Margin = new System.Windows.Forms.Padding(4);
293 293
             this.MinimumSize = new System.Drawing.Size(822, 643);
294 294
             this.Name = "VoucherForm";
295 295
             this.Text = "View PINs";

+ 12 - 4
BulkPrinting/BulkPrinting/VoucherForm.cs

@@ -56,7 +56,7 @@ namespace BulkPrinting
56 56
             {
57 57
                 if (rdoPrintDate.Checked)
58 58
                 {
59
-                    Command.CommandText = "SELECT v.BatchId, v.Serial, v.SequenceNumber, v.ExpiryDate, v.EncryptedPIN FROM Voucher v LEFT JOIN Logs l on v.Id = l.VoucherId and l.EventType=@eventtype WHERE l.EventDate BETWEEN @startdate AND @enddate";
59
+                    Command.CommandText = "SELECT v.BatchId, v.Serial, v.SequenceNumber, v.ExpiryDate, v.EncryptedPIN, v.PrintCount FROM Voucher v LEFT JOIN Logs l on v.Id = l.VoucherId and l.EventType=@eventtype WHERE l.EventDate BETWEEN @startdate AND @enddate";
60 60
                     Command.Parameters.AddWithValue("@eventtype", VendorEvent.VendorEventType.PrintVoucher);
61 61
                     CultureInfo IVC = CultureInfo.InvariantCulture;
62 62
                     Command.Parameters.AddWithValue("@startdate", dtpStartDate.Value.ToString("yyyy-MM-dd 00:00:00", IVC));
@@ -64,14 +64,14 @@ namespace BulkPrinting
64 64
                 }
65 65
                 else if (rdoVoucherRange.Checked)
66 66
                 {
67
-                    Command.CommandText = "SELECT BatchId, Serial, SequenceNumber, ExpiryDate, EncryptedPIN FROM Voucher WHERE BatchId = @batchid AND SequenceNumber BETWEEN @minseqno AND @maxseqno";
67
+                    Command.CommandText = "SELECT BatchId, Serial, SequenceNumber, ExpiryDate, EncryptedPIN, PrintCount FROM Voucher WHERE BatchId = @batchid AND SequenceNumber BETWEEN @minseqno AND @maxseqno";
68 68
                     Command.Parameters.AddWithValue("@batchid", numBatchId.Value);
69 69
                     Command.Parameters.AddWithValue("@minseqno", numStartSeqNo.Value);
70 70
                     Command.Parameters.AddWithValue("@maxseqno", numEndSeqNo.Value);
71 71
                 }
72 72
                 else if (rdoSerialNum.Checked)
73 73
                 {
74
-                    Command.CommandText = "SELECT BatchId, Serial, SequenceNumber, ExpiryDate, EncryptedPIN FROM Voucher WHERE Serial=@serial";
74
+                    Command.CommandText = "SELECT BatchId, Serial, SequenceNumber, ExpiryDate, EncryptedPIN, PrintCount FROM Voucher WHERE Serial=@serial";
75 75
                     Command.Parameters.AddWithValue("@serial", txtSerial.Text);
76 76
                 }
77 77
 
@@ -86,7 +86,15 @@ namespace BulkPrinting
86 86
                 {
87 87
                     while (SQLReader.Read())
88 88
                     {
89
-                        string VoucherPIN = Utility.TripleDESDecrypt(SQLReader.GetValue(4).ToString(), Globals.SessionVoucherKey).ToString();
89
+                        string VoucherPIN;
90
+                        if (SQLReader.GetInt32(5) > 0)
91
+                        {
92
+                            VoucherPIN = Utility.TripleDESDecrypt(SQLReader.GetValue(4).ToString(), Globals.SessionVoucherKey).ToString();
93
+                        }
94
+                        else
95
+                        {
96
+                            VoucherPIN = "NOT PRINTED";
97
+                        }
90 98
                         dgvVouchers.Rows.Add(new object[] {
91 99
                             SQLReader.GetValue(0),
92 100
                             SQLReader.GetValue(1),