public static string Barcode(string strImgID, Int64 iformat, string strSessionID, ref string strResult) { try { if (strImgID == null || strImgID.Trim() == "") { throw new Exception("No barcode exist."); } Bitmap _bitmap = BarcodeMode.DoBarcode(strImgID, iformat, strSessionID, ref strResult); string strFileName = BarcodeAccess.GetNextFileIndex(strImgID, strSessionID); string strFullPath = BarcodeAccess.GetUploadFolder() + System.IO.Path.DirectorySeparatorChar + strSessionID + System.IO.Path.DirectorySeparatorChar + strFileName; _bitmap.Save(strFullPath, GetImageFormat(strImgID)); if (_bitmap != null) { _bitmap.Dispose(); } return("Images/Upload/" + strSessionID + "/" + strFileName); } catch (Exception exp) { if (exp.Message.Contains("No barcode found.") == true) { return(CreateError(strImgID, "No barcode found.", strSessionID) + ";" + exp.Message); } else { throw; } } }
private static string CreateErrorInner(string strImgID, string strErrorMessage, string strSessionID) { Bitmap _bitmap = BarcodeMode.CreateErrorImg(strImgID, "No barcode found.", strSessionID); string strFileName = BarcodeAccess.GetNextFileIndex(strImgID, strSessionID); string strFullPath = BarcodeAccess.GetUploadFolder() + System.IO.Path.DirectorySeparatorChar + strSessionID + System.IO.Path.DirectorySeparatorChar + strFileName; _bitmap.Save(strFullPath, GetImageFormat(strImgID)); if (_bitmap != null) { _bitmap.Dispose(); } return("Images/Upload/" + strSessionID + "/" + strFileName); }