Skip to content

Commit

Permalink
add pharmacode to the asp.net example app, fixed null exception in Ge…
Browse files Browse the repository at this point in the history
…nerateBarcodeImage in asp.net example app
  • Loading branch information
barnhill committed Oct 27, 2014
1 parent 41efc4a commit cb8b206
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 38 deletions.
35 changes: 0 additions & 35 deletions BarcodeDemo/BarcodeDemo.sln

This file was deleted.

Binary file modified BarcodeDemo/BarcodeLib.dll
Binary file not shown.
1 change: 1 addition & 0 deletions BarcodeDemo/Default.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<asp:ListItem>MSI</asp:ListItem>
<asp:ListItem>Telepen</asp:ListItem>
<asp:ListItem>FIM (Facing Identification Mark)</asp:ListItem>
<asp:ListItem>Pharmacode</asp:ListItem>
</asp:DropDownList>
</td>
<td align="center">
Expand Down
2 changes: 2 additions & 0 deletions BarcodeDemo/Default.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ protected void Page_Load(object sender, EventArgs e)

lblLibraryVersion.Text = BarcodeLib.Barcode.Version.ToString();
}

protected void btnEncode_Click(object sender, EventArgs e)
{
string strImageURL = "GenerateBarcodeImage.aspx?d=" + this.txtData.Text.Trim() + "&h=" + this.txtHeight.Text.Trim() + "&w=" + this.txtWidth.Text.Trim() + "&bc=" + this.txtBackColor.Text.Trim() + "&fc=" + this.txtForeColor.Text.Trim() + "&t=" + this.cbEncodeType.SelectedValue + "&il=" + this.chkGenerateLabel.Checked.ToString() + "&if=" + this.ddlImageFormat.SelectedValue + "&align=" + GetAlignmentValue();
Expand All @@ -27,6 +28,7 @@ protected void btnEncode_Click(object sender, EventArgs e)
this.BarcodeImage.Height = Convert.ToInt32(this.txtHeight.Text);
this.BarcodeImage.Visible = true;
}

protected string GetAlignmentValue()
{
if (this.rbAlignCenter.Checked)
Expand Down
9 changes: 7 additions & 2 deletions BarcodeDemo/GenerateBarcodeImage.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected void Page_Load(object sender, EventArgs e)
case "Code 128-C": type = BarcodeLib.TYPE.CODE128C; break;
case "Telepen": type = BarcodeLib.TYPE.TELEPEN; break;
case "FIM (Facing Identification Mark)": type = BarcodeLib.TYPE.FIM; break;
case "Pharmacode": type = BarcodeLib.TYPE.PHARMACODE; break;
default: break;
}//switch

Expand Down Expand Up @@ -110,11 +111,15 @@ protected void Page_Load(object sender, EventArgs e)
}//try
catch (Exception ex)
{
//TODO: find a way to return this to display the encoding error message
}//catch
finally
{
//Clean up / Dispose...
barcodeImage.Dispose();
if (barcodeImage != null)
{
//Clean up / Dispose...
barcodeImage.Dispose();
}
}//finally
}//if
}
Expand Down
1 change: 0 additions & 1 deletion BarcodeLib/Symbologies/Pharmacode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public Pharmacode(string input)
{
Error("EPHARM-1: Data contains invalid characters (non-numeric).");
}//if

else if (Raw_Data.Length > 6)
{
Error("EPHARM-2: Data too long (invalid data input length).");
Expand Down

0 comments on commit cb8b206

Please sign in to comment.