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;
                }
            }
        }
Esempio n. 2
0
        internal static void CreateFolder(string strSessionID)
        {
            string strDir = BarcodeAccess.GetUploadFolder() + System.IO.Path.DirectorySeparatorChar + strSessionID;

            if (!Directory.Exists(strDir))
            {
                Directory.CreateDirectory(strDir);
            }
        }
        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);
        }
Esempio n. 4
0
        internal static void DeleteFolder(string strSessionID)
        {
            try
            {
                string strFullPath = BarcodeAccess.GetUploadFolder() + System.IO.Path.DirectorySeparatorChar + strSessionID;

                if (Directory.Exists(strFullPath))
                {
                    try
                    {
                        DeleteTempFiles(strFullPath);
                    }
                    catch { }
                    Directory.Delete(strFullPath);
                }
            }
            catch { }
        }