Browse Source

Re-enable print settings dialog.
Add vendor name print setting to allow vendor name to be printed on vouchers instead of vendor ID.
Add print quality setting to enable emphasized printing to be toggled on or off.
Add validation on vendor ID and user ID on login form.
Add batch download hotkey to batch form to allow batches to be redownloaded.

Andrew Klopper 7 years ago
parent
commit
e675ab5c48

+ 63 - 0
BulkPrinting/BulkPrinting/BatchForm.cs

@@ -561,5 +561,68 @@ namespace BulkPrinting
561 561
                 e.Graphics.DrawImage(b.BackgroundImage, b.ClientRectangle);
562 562
             }
563 563
         }
564
+
565
+        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
566
+        {
567
+            if (keyData == (Keys.Control | Keys.Shift | Keys.R))
568
+            {
569
+                BatchNumberDialog dialog = new BatchNumberDialog();
570
+                if (dialog.ShowDialog() == DialogResult.OK)
571
+                {
572
+                    int batchId = dialog.BatchNumber;
573
+                    if (MessageBox.Show("Are you sure you want to download batch " + batchId.ToString() + "?", "Confirm Download", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
574
+                    {
575
+                        bool gotErrors = false;
576
+                        try
577
+                        {
578
+                            Batch batch = new Batch();
579
+                            if (Utility.RESTRequest(ref batch, String.Format("/api/batches/{0}", batchId)))
580
+                            {
581
+                                Utility.SaveBatch(Globals.DB, batch);
582
+
583
+                                Globals.DB.ExecuteNonQuery(
584
+                                    "DELETE FROM Voucher WHERE BatchId=@BatchId",
585
+                                    new SQLiteParameter("@BatchId", batchId));
586
+
587
+                                Globals.DB.ExecuteNonQuery(
588
+                                    "UPDATE Batch SET Downloaded=0 WHERE Id=@BatchId",
589
+                                    new SQLiteParameter("@BatchId", batchId));
590
+                            }
591
+                            else if (batch == null)
592
+                            {
593
+                                // Batch will only be null if we got a 404.
594
+                                Globals.DB.ExecuteNonQuery(
595
+                                    "DELETE FROM Voucher WHERE BatchId=@BatchId",
596
+                                    new SQLiteParameter("@BatchId", batchId));
597
+
598
+                                Globals.DB.ExecuteNonQuery(
599
+                                    "DELETE FROM Batch WHERE Id=@BatchId",
600
+                                    new SQLiteParameter("@BatchId", batchId));
601
+                            }
602
+                            else
603
+                            {
604
+                                gotErrors = true;
605
+                            }
606
+                        }
607
+                        catch
608
+                        {
609
+                            gotErrors = true;
610
+                        }
611
+
612
+                        if (gotErrors)
613
+                        {
614
+                            MessageBox.Show("Error downloading batch " + batchId.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
615
+                        }
616
+
617
+                        PopulateGrid();
618
+                        NewBatchAvailable();
619
+                    }
620
+                }
621
+
622
+                return true;
623
+            }
624
+
625
+            return base.ProcessCmdKey(ref msg, keyData);
626
+        }
564 627
     }
565 628
 }

+ 105 - 0
BulkPrinting/BulkPrinting/BatchNumberDialog.Designer.cs

@@ -0,0 +1,105 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class BatchNumberDialog
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            this.batchNumberTextBox = new System.Windows.Forms.TextBox();
32
+            this.label1 = new System.Windows.Forms.Label();
33
+            this.okButton = new System.Windows.Forms.Button();
34
+            this.cancelButton = new System.Windows.Forms.Button();
35
+            this.SuspendLayout();
36
+            // 
37
+            // batchNumberTextBox
38
+            // 
39
+            this.batchNumberTextBox.Location = new System.Drawing.Point(203, 14);
40
+            this.batchNumberTextBox.Name = "batchNumberTextBox";
41
+            this.batchNumberTextBox.Size = new System.Drawing.Size(149, 22);
42
+            this.batchNumberTextBox.TabIndex = 0;
43
+            // 
44
+            // label1
45
+            // 
46
+            this.label1.AutoSize = true;
47
+            this.label1.ForeColor = System.Drawing.Color.White;
48
+            this.label1.Location = new System.Drawing.Point(13, 17);
49
+            this.label1.Name = "label1";
50
+            this.label1.Size = new System.Drawing.Size(184, 17);
51
+            this.label1.TabIndex = 1;
52
+            this.label1.Text = "Batch Number to Download:";
53
+            // 
54
+            // okButton
55
+            // 
56
+            this.okButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
57
+            this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
58
+            this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
59
+            this.okButton.Location = new System.Drawing.Point(146, 42);
60
+            this.okButton.Name = "okButton";
61
+            this.okButton.Size = new System.Drawing.Size(100, 28);
62
+            this.okButton.TabIndex = 2;
63
+            this.okButton.Text = "OK";
64
+            this.okButton.UseVisualStyleBackColor = false;
65
+            // 
66
+            // cancelButton
67
+            // 
68
+            this.cancelButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
69
+            this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
70
+            this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
71
+            this.cancelButton.Location = new System.Drawing.Point(252, 42);
72
+            this.cancelButton.Name = "cancelButton";
73
+            this.cancelButton.Size = new System.Drawing.Size(100, 28);
74
+            this.cancelButton.TabIndex = 3;
75
+            this.cancelButton.Text = "Cancel";
76
+            this.cancelButton.UseVisualStyleBackColor = false;
77
+            // 
78
+            // BatchNumberDialog
79
+            // 
80
+            this.AcceptButton = this.okButton;
81
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
82
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
83
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
84
+            this.CancelButton = this.cancelButton;
85
+            this.ClientSize = new System.Drawing.Size(364, 81);
86
+            this.Controls.Add(this.cancelButton);
87
+            this.Controls.Add(this.okButton);
88
+            this.Controls.Add(this.label1);
89
+            this.Controls.Add(this.batchNumberTextBox);
90
+            this.Name = "BatchNumberDialog";
91
+            this.Text = "Download Batch";
92
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BatchNumberDialog_FormClosing);
93
+            this.ResumeLayout(false);
94
+            this.PerformLayout();
95
+
96
+        }
97
+
98
+        #endregion
99
+
100
+        private System.Windows.Forms.TextBox batchNumberTextBox;
101
+        private System.Windows.Forms.Label label1;
102
+        private System.Windows.Forms.Button okButton;
103
+        private System.Windows.Forms.Button cancelButton;
104
+    }
105
+}

+ 31 - 0
BulkPrinting/BulkPrinting/BatchNumberDialog.cs

@@ -0,0 +1,31 @@
1
+using System.Windows.Forms;
2
+
3
+namespace BulkPrinting
4
+{
5
+    public partial class BatchNumberDialog : Form
6
+    {
7
+        public BatchNumberDialog()
8
+        {
9
+            InitializeComponent();
10
+        }
11
+
12
+        public int BatchNumber
13
+        {
14
+            get { return int.Parse(batchNumberTextBox.Text); }
15
+            set { batchNumberTextBox.Text = value.ToString(); }
16
+        }
17
+
18
+        private void BatchNumberDialog_FormClosing(object sender, FormClosingEventArgs e)
19
+        {
20
+            if (DialogResult == DialogResult.OK)
21
+            {
22
+                int batchNumber;
23
+                if (! int.TryParse(batchNumberTextBox.Text, out batchNumber))
24
+                {
25
+                    MessageBox.Show("Invalid batch number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
26
+                    e.Cancel = true;
27
+                }
28
+            }
29
+        }
30
+    }
31
+}

+ 120 - 0
BulkPrinting/BulkPrinting/BatchNumberDialog.resx

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 9 - 0
BulkPrinting/BulkPrinting/BulkPrinting.csproj

@@ -155,6 +155,12 @@
155 155
   </ItemGroup>
156 156
   <ItemGroup>
157 157
     <Compile Include="BatchDownloader.cs" />
158
+    <Compile Include="BatchNumberDialog.cs">
159
+      <SubType>Form</SubType>
160
+    </Compile>
161
+    <Compile Include="BatchNumberDialog.Designer.cs">
162
+      <DependentUpon>BatchNumberDialog.cs</DependentUpon>
163
+    </Compile>
158 164
     <Compile Include="Configuration.cs" />
159 165
     <Compile Include="DBHelper.cs" />
160 166
     <Compile Include="DownloadedLogSummariser.cs" />
@@ -248,6 +254,9 @@
248 254
     <Compile Include="VoucherForm.Designer.cs">
249 255
       <DependentUpon>VoucherForm.cs</DependentUpon>
250 256
     </Compile>
257
+    <EmbeddedResource Include="BatchNumberDialog.resx">
258
+      <DependentUpon>BatchNumberDialog.cs</DependentUpon>
259
+    </EmbeddedResource>
251 260
     <EmbeddedResource Include="ExportForm.resx">
252 261
       <DependentUpon>ExportForm.cs</DependentUpon>
253 262
     </EmbeddedResource>

+ 1 - 1
BulkPrinting/BulkPrinting/Globals.cs

@@ -28,7 +28,7 @@ namespace BulkPrinting
28 28
         // page length command resulting in an unwanted form feed.
29 29
         public static string DefaultPrinterInitString =
30 30
             "1B40" +        // Initialise printer
31
-            //"1B45" +        // Emphasise on
31
+            //"1B45" +        // Emphasize on
32 32
             "1B5530" +      // Unidirectional off
33 33
             "1B4D" +        // 12cpi, 10.5pt
34 34
             "1B43000C";     // Page length 12 inches

+ 19 - 1
BulkPrinting/BulkPrinting/Migrations.cs

@@ -20,7 +20,7 @@ namespace BulkPrinting
20 20
                 throw new Exception(String.Format("Invalid migration value: {0}", result));
21 21
             }
22 22
 
23
-            if (startingMigration > 5)
23
+            if (startingMigration > 6)
24 24
             {
25 25
                 throw new Exception("Database is for a newer version of this application. Please upgrade and try again.");
26 26
             }
@@ -44,6 +44,10 @@ namespace BulkPrinting
44 44
             {
45 45
                 Migration5(db);
46 46
             }
47
+            if (startingMigration < 6)
48
+            {
49
+                Migration6(db);
50
+            }
47 51
             //Add further migration executions here - Migration = '1', '2', '3' etc
48 52
 
49 53
             return;
@@ -264,5 +268,19 @@ namespace BulkPrinting
264 268
                 "UPDATE Parameters SET Value='5' WHERE Key='Migration'"
265 269
            );
266 270
         }
271
+
272
+        public static bool Migration6(DBHelper db)
273
+        {
274
+            return ApplyMigrationQueries(
275
+                db, null,
276
+
277
+                "UPDATE Parameters SET Value='" + Globals.DefaultPrinterInitString + "' WHERE Key='PrinterInitString'",
278
+                "INSERT INTO Parameters (Key, Value) VALUES ('VendorName', '')",
279
+                "INSERT INTO Parameters (Key, Value) VALUES ('EnableBoldPrinting', '" + false.ToString() + "')",
280
+
281
+                // IMPORTANT
282
+                "UPDATE Parameters SET Value='6' WHERE Key='Migration'"
283
+            );
284
+        }
267 285
     }
268 286
 }

+ 1 - 2
BulkPrinting/BulkPrinting/PrintAlignmentDialog.Designer.cs

@@ -88,7 +88,7 @@
88 88
             this.btnAlignment.FlatAppearance.BorderColor = System.Drawing.Color.Black;
89 89
             this.btnAlignment.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
90 90
             this.btnAlignment.ForeColor = System.Drawing.Color.White;
91
-            this.btnAlignment.Location = new System.Drawing.Point(202, 382);
91
+            this.btnAlignment.Location = new System.Drawing.Point(407, 382);
92 92
             this.btnAlignment.Margin = new System.Windows.Forms.Padding(4);
93 93
             this.btnAlignment.Name = "btnAlignment";
94 94
             this.btnAlignment.Size = new System.Drawing.Size(151, 28);
@@ -244,7 +244,6 @@
244 244
             this.settingsButton.TabIndex = 2;
245 245
             this.settingsButton.Text = "Advanced Settings";
246 246
             this.settingsButton.UseVisualStyleBackColor = false;
247
-            this.settingsButton.Visible = false;
248 247
             this.settingsButton.Click += new System.EventHandler(this.settingsButton_Click);
249 248
             // 
250 249
             // btnExpand

+ 4 - 0
BulkPrinting/BulkPrinting/PrintAlignmentDialog.cs

@@ -172,9 +172,13 @@ namespace BulkPrinting
172 172
         {
173 173
             var dialog = new PrinterSettingsForm();
174 174
             dialog.InitString = Utility.GetSavedParameter(Globals.DB, "PrinterInitString");
175
+            dialog.VendorName = Utility.GetSavedParameter(Globals.DB, "VendorName");
176
+            dialog.EnableBoldPrinting = Utility.GetSavedParameterAsBoolean(Globals.DB, "EnableBoldPrinting");
175 177
             if (dialog.ShowDialog() == DialogResult.OK)
176 178
             {
177 179
                 Utility.UpdateSavedParameter(Globals.DB, "PrinterInitString", dialog.InitString);
180
+                Utility.UpdateSavedParameter(Globals.DB, "VendorName", dialog.VendorName);
181
+                Utility.UpdateSavedParameter(Globals.DB, "EnableBoldPrinting", dialog.EnableBoldPrinting);
178 182
             }
179 183
         }
180 184
     }

+ 94 - 11
BulkPrinting/BulkPrinting/PrinterSettingsForm.Designer.cs

@@ -33,24 +33,33 @@
33 33
             this.resetButton = new System.Windows.Forms.Button();
34 34
             this.okButton = new System.Windows.Forms.Button();
35 35
             this.cancelButton = new System.Windows.Forms.Button();
36
+            this.label2 = new System.Windows.Forms.Label();
37
+            this.vendorNameTextBox = new System.Windows.Forms.TextBox();
38
+            this.label3 = new System.Windows.Forms.Label();
39
+            this.panel1 = new System.Windows.Forms.Panel();
40
+            this.printQualityFastRadioButton = new System.Windows.Forms.RadioButton();
41
+            this.printQualityHighRadioButton = new System.Windows.Forms.RadioButton();
42
+            this.panel1.SuspendLayout();
36 43
             this.SuspendLayout();
37 44
             // 
38 45
             // label1
39 46
             // 
40 47
             this.label1.AutoSize = true;
41 48
             this.label1.ForeColor = System.Drawing.Color.White;
42
-            this.label1.Location = new System.Drawing.Point(13, 13);
49
+            this.label1.Location = new System.Drawing.Point(13, 104);
43 50
             this.label1.Name = "label1";
44 51
             this.label1.Size = new System.Drawing.Size(155, 17);
45
-            this.label1.TabIndex = 0;
52
+            this.label1.TabIndex = 8;
46 53
             this.label1.Text = "Printer Init String (Hex):";
54
+            this.label1.Visible = false;
47 55
             // 
48 56
             // initStringTextBox
49 57
             // 
50
-            this.initStringTextBox.Location = new System.Drawing.Point(174, 13);
58
+            this.initStringTextBox.Location = new System.Drawing.Point(174, 104);
51 59
             this.initStringTextBox.Name = "initStringTextBox";
52 60
             this.initStringTextBox.Size = new System.Drawing.Size(475, 22);
53
-            this.initStringTextBox.TabIndex = 0;
61
+            this.initStringTextBox.TabIndex = 2;
62
+            this.initStringTextBox.Visible = false;
54 63
             // 
55 64
             // resetButton
56 65
             // 
@@ -58,10 +67,10 @@
58 67
             this.resetButton.FlatAppearance.BorderColor = System.Drawing.Color.Black;
59 68
             this.resetButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
60 69
             this.resetButton.ForeColor = System.Drawing.Color.White;
61
-            this.resetButton.Location = new System.Drawing.Point(13, 48);
70
+            this.resetButton.Location = new System.Drawing.Point(16, 73);
62 71
             this.resetButton.Name = "resetButton";
63 72
             this.resetButton.Size = new System.Drawing.Size(137, 28);
64
-            this.resetButton.TabIndex = 3;
73
+            this.resetButton.TabIndex = 5;
65 74
             this.resetButton.Text = "Reset to Default";
66 75
             this.resetButton.UseVisualStyleBackColor = false;
67 76
             this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
@@ -73,10 +82,10 @@
73 82
             this.okButton.FlatAppearance.BorderColor = System.Drawing.Color.Black;
74 83
             this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
75 84
             this.okButton.ForeColor = System.Drawing.Color.White;
76
-            this.okButton.Location = new System.Drawing.Point(443, 48);
85
+            this.okButton.Location = new System.Drawing.Point(446, 73);
77 86
             this.okButton.Name = "okButton";
78 87
             this.okButton.Size = new System.Drawing.Size(100, 28);
79
-            this.okButton.TabIndex = 1;
88
+            this.okButton.TabIndex = 3;
80 89
             this.okButton.Text = "OK";
81 90
             this.okButton.UseVisualStyleBackColor = false;
82 91
             // 
@@ -87,20 +96,86 @@
87 96
             this.cancelButton.FlatAppearance.BorderColor = System.Drawing.Color.Black;
88 97
             this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
89 98
             this.cancelButton.ForeColor = System.Drawing.Color.White;
90
-            this.cancelButton.Location = new System.Drawing.Point(549, 48);
99
+            this.cancelButton.Location = new System.Drawing.Point(552, 73);
91 100
             this.cancelButton.Name = "cancelButton";
92 101
             this.cancelButton.Size = new System.Drawing.Size(100, 28);
93
-            this.cancelButton.TabIndex = 2;
102
+            this.cancelButton.TabIndex = 4;
94 103
             this.cancelButton.Text = "Cancel";
95 104
             this.cancelButton.UseVisualStyleBackColor = false;
96 105
             // 
106
+            // label2
107
+            // 
108
+            this.label2.AutoSize = true;
109
+            this.label2.ForeColor = System.Drawing.Color.White;
110
+            this.label2.Location = new System.Drawing.Point(13, 13);
111
+            this.label2.Name = "label2";
112
+            this.label2.Size = new System.Drawing.Size(99, 17);
113
+            this.label2.TabIndex = 6;
114
+            this.label2.Text = "Vendor Name:";
115
+            // 
116
+            // vendorNameTextBox
117
+            // 
118
+            this.vendorNameTextBox.Location = new System.Drawing.Point(174, 13);
119
+            this.vendorNameTextBox.MaxLength = 24;
120
+            this.vendorNameTextBox.Name = "vendorNameTextBox";
121
+            this.vendorNameTextBox.Size = new System.Drawing.Size(475, 22);
122
+            this.vendorNameTextBox.TabIndex = 0;
123
+            // 
124
+            // label3
125
+            // 
126
+            this.label3.AutoSize = true;
127
+            this.label3.ForeColor = System.Drawing.Color.White;
128
+            this.label3.Location = new System.Drawing.Point(13, 43);
129
+            this.label3.Name = "label3";
130
+            this.label3.Size = new System.Drawing.Size(89, 17);
131
+            this.label3.TabIndex = 7;
132
+            this.label3.Text = "Print Quality:";
133
+            // 
134
+            // panel1
135
+            // 
136
+            this.panel1.AutoSize = true;
137
+            this.panel1.Controls.Add(this.printQualityFastRadioButton);
138
+            this.panel1.Controls.Add(this.printQualityHighRadioButton);
139
+            this.panel1.Location = new System.Drawing.Point(174, 41);
140
+            this.panel1.Name = "panel1";
141
+            this.panel1.Size = new System.Drawing.Size(174, 24);
142
+            this.panel1.TabIndex = 1;
143
+            // 
144
+            // printQualityFastRadioButton
145
+            // 
146
+            this.printQualityFastRadioButton.AutoSize = true;
147
+            this.printQualityFastRadioButton.ForeColor = System.Drawing.Color.White;
148
+            this.printQualityFastRadioButton.Location = new System.Drawing.Point(3, 0);
149
+            this.printQualityFastRadioButton.Name = "printQualityFastRadioButton";
150
+            this.printQualityFastRadioButton.Size = new System.Drawing.Size(56, 21);
151
+            this.printQualityFastRadioButton.TabIndex = 0;
152
+            this.printQualityFastRadioButton.TabStop = true;
153
+            this.printQualityFastRadioButton.Text = "Fast";
154
+            this.printQualityFastRadioButton.UseVisualStyleBackColor = true;
155
+            // 
156
+            // printQualityHighRadioButton
157
+            // 
158
+            this.printQualityHighRadioButton.AutoSize = true;
159
+            this.printQualityHighRadioButton.ForeColor = System.Drawing.Color.White;
160
+            this.printQualityHighRadioButton.Location = new System.Drawing.Point(65, 0);
161
+            this.printQualityHighRadioButton.Name = "printQualityHighRadioButton";
162
+            this.printQualityHighRadioButton.Size = new System.Drawing.Size(106, 21);
163
+            this.printQualityHighRadioButton.TabIndex = 1;
164
+            this.printQualityHighRadioButton.TabStop = true;
165
+            this.printQualityHighRadioButton.Text = "High Quality";
166
+            this.printQualityHighRadioButton.UseVisualStyleBackColor = true;
167
+            // 
97 168
             // PrinterSettingsForm
98 169
             // 
99 170
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
100 171
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
101 172
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
102
-            this.ClientSize = new System.Drawing.Size(661, 83);
173
+            this.ClientSize = new System.Drawing.Size(661, 109);
103 174
             this.ControlBox = false;
175
+            this.Controls.Add(this.panel1);
176
+            this.Controls.Add(this.label3);
177
+            this.Controls.Add(this.vendorNameTextBox);
178
+            this.Controls.Add(this.label2);
104 179
             this.Controls.Add(this.cancelButton);
105 180
             this.Controls.Add(this.okButton);
106 181
             this.Controls.Add(this.resetButton);
@@ -111,6 +186,8 @@
111 186
             this.Name = "PrinterSettingsForm";
112 187
             this.Text = "Advanced Printer Settings";
113 188
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PrinterSettingsForm_FormClosing);
189
+            this.panel1.ResumeLayout(false);
190
+            this.panel1.PerformLayout();
114 191
             this.ResumeLayout(false);
115 192
             this.PerformLayout();
116 193
 
@@ -123,5 +200,11 @@
123 200
         private System.Windows.Forms.Button resetButton;
124 201
         private System.Windows.Forms.Button okButton;
125 202
         private System.Windows.Forms.Button cancelButton;
203
+        private System.Windows.Forms.Label label2;
204
+        private System.Windows.Forms.TextBox vendorNameTextBox;
205
+        private System.Windows.Forms.Label label3;
206
+        private System.Windows.Forms.Panel panel1;
207
+        private System.Windows.Forms.RadioButton printQualityFastRadioButton;
208
+        private System.Windows.Forms.RadioButton printQualityHighRadioButton;
126 209
     }
127 210
 }

+ 25 - 0
BulkPrinting/BulkPrinting/PrinterSettingsForm.cs

@@ -10,6 +10,25 @@ namespace BulkPrinting
10 10
             InitializeComponent();
11 11
         }
12 12
 
13
+        public bool EnableBoldPrinting
14
+        {
15
+            get
16
+            {
17
+                return printQualityHighRadioButton.Checked;
18
+            }
19
+            set
20
+            {
21
+                if (value)
22
+                {
23
+                    printQualityHighRadioButton.Checked = true;
24
+                }
25
+                else
26
+                {
27
+                    printQualityFastRadioButton.Checked = true;
28
+                }
29
+            }
30
+        }
31
+
13 32
         public string InitString
14 33
         {
15 34
             get { return initStringTextBox.Text.Trim(); }
@@ -36,5 +55,11 @@ namespace BulkPrinting
36 55
         {
37 56
             initStringTextBox.Text = Globals.DefaultPrinterInitString;
38 57
         }
58
+
59
+        public string VendorName
60
+        {
61
+            get { return vendorNameTextBox.Text.Trim(); }
62
+            set { vendorNameTextBox.Text = value; }
63
+        }
39 64
     }
40 65
 }

+ 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.10")]
36
+[assembly: AssemblyFileVersion("1.11")]

+ 17 - 2
BulkPrinting/BulkPrinting/UserLoginForm.cs

@@ -20,11 +20,26 @@ namespace BulkPrinting
20 20
         {
21 21
             bool LoginSuccessful = false;
22 22
             LoginData UserLoginData = new LoginData();
23
-            UserLoginData.VendorId = int.Parse(this.txtVendorID.Text);
24 23
             UserLoginData.SerialNumber = Globals.HDDSerialNumber;
25
-            UserLoginData.UserId = int.Parse(this.txtUserID.Text);
26 24
             UserLoginData.Username = this.txtUsername.Text;
27 25
             UserLoginData.SecurePassword = new System.Security.SecureString();
26
+
27
+            int vendorId;
28
+            if (! int.TryParse(txtVendorID.Text, out vendorId))
29
+            {
30
+                MessageBox.Show("Vendor ID must be a number.", "Invalid ID", MessageBoxButtons.OK, MessageBoxIcon.Error);
31
+                return;
32
+            }
33
+            UserLoginData.VendorId = vendorId;
34
+
35
+            int userId;
36
+            if (!int.TryParse(txtUserID.Text, out userId))
37
+            {
38
+                MessageBox.Show("User ID must be a number.", "Invalid ID", MessageBoxButtons.OK, MessageBoxIcon.Error);
39
+                return;
40
+            }
41
+            UserLoginData.UserId = userId;
42
+
28 43
             foreach (var c in txtPassword.Text)
29 44
             {
30 45
                 UserLoginData.SecurePassword.AppendChar(c);

+ 14 - 1
BulkPrinting/BulkPrinting/Utility.cs

@@ -39,6 +39,10 @@ namespace BulkPrinting
39 39
         {
40 40
             //var hex = GetSavedParameter(db, "PrinterInitString");
41 41
             var hex = Globals.DefaultPrinterInitString;
42
+            if (GetSavedParameterAsBoolean(db, "EnableBoldPrinting"))
43
+            {
44
+                hex += "1B45"; // Emphasize on
45
+            }
42 46
             return Encoding.ASCII.GetString(HexStringToBytes(hex));
43 47
         }
44 48
 
@@ -436,7 +440,16 @@ namespace BulkPrinting
436 440
             int TotalCount = 0;
437 441
             string SerialNumberTrimmed;
438 442
             bool IsReprint;
439
-            string VendorId = Globals.SessionData.Credentials.Payload.Vendor.id.ToString();
443
+
444
+            string VendorId = GetSavedParameter(db, "VendorName").Trim();
445
+            if (String.IsNullOrEmpty(VendorId))
446
+            {
447
+                VendorId = Globals.SessionData.Credentials.Payload.Vendor.id.ToString();
448
+            }
449
+            else if (VendorId.Length > 24)
450
+            {
451
+                VendorId = VendorId.Substring(0, 24);
452
+            }
440 453
 
441 454
             var PrinterInitString = GetPrinterInitString(db);
442 455
             int initJobID = Globals.MaxPrinter.Open("Vouchers");