private void GenerateBarcodeTag(JewelMaster entity) { var jewelMasterDataSet = new JewelMasterDataSet(); var barcode = new BarcodeUtility(); var jewelImage = barcode.MakeBarcodeImage(entity.JewelNo); var jewelMasterRow = jewelMasterDataSet.Tables["JewelMaster"].NewRow(); jewelMasterRow["JewelId"] = entity.JewelId; jewelMasterRow["JewelNo"] = entity.JewelNo; jewelMasterRow["StyleNo"] = entity.StyleNo; jewelMasterRow["JewelDescription"] = entity.JewelDescription; jewelMasterRow["MetalColor"] = entity.MetalColor; jewelMasterRow["ImagePath"] = ImageExtension.GetImageName(entity.StyleNo); jewelMasterRow["DiamondPcs"] = Convert.ToString(entity.DiamondPcs); jewelMasterRow["DiamondWt"] = Convert.ToString(entity.DiamondWt); jewelMasterRow["GrsWt"] = Convert.ToString(entity.GrsWt); jewelMasterRow["NetWt"] = Convert.ToString(entity.NetWt); jewelMasterRow["JewelImage"] = ImageConverterHelper.ImageToByteArray(jewelImage); jewelMasterDataSet.Tables["JewelMaster"].Rows.Add(jewelMasterRow); if (!File.Exists(Application.StartupPath + @"\" + ReportConstants.JEWELMASTERREPORTPATH)) { return; } var reportDocument = new ReportDocument(); reportDocument.Load(Application.StartupPath + @"\" + ReportConstants.JEWELMASTERREPORTPATH); reportDocument.SetDataSource(jewelMasterDataSet); crystalReportViewer1.ReportSource = reportDocument; crystalReportViewer1.Refresh(); }
private bool VerifyBarcodeCheckDigit(string barcode) { bool isValidate = true; string checkDigit = BarcodeUtility.GetCheckCode(barcode.Remove(barcode.Length - 1)); if (checkDigit != barcode[barcode.Length - 1].ToString()) { isValidate = false; } return(isValidate); }
private string getBarCode(Bitmap bitmap, out Bitmap resultImage, out ArrayList resultBarCode) { string returnValue = String.Empty; float imageRotationDegree = ModuleConfiguration.Default_ImageRotationDegree; if (imageRotationDegree != 0) { Dictionary <string, object> rotationParams = ModuleConfiguration.Default_ImageRotationParameters; if ((rotationParams != null) && (rotationParams.Count > 0)) { int rotationAtPercentageOfImageWidth = (int)(rotationParams["RotationAtPercentageOfImageWidth"]); int rotationAtPercentageOfImageHeight = (int)(rotationParams["RotationAtPercentageOfImageHeight"]); bool isNoClip = (bool)(rotationParams["IsNoClip"]); bitmap = BarcodeUtility.RotateImage(bitmap, (bitmap.Width * (rotationAtPercentageOfImageWidth / 100)), (bitmap.Height * (rotationAtPercentageOfImageHeight / 100)), imageRotationDegree, isNoClip); } else { bitmap = BarcodeUtility.RotateImage(bitmap, imageRotationDegree); } } if (ModuleConfiguration.IsCheckingSkewAngle) { DeSkewUtility deSkewUtility = new DeSkewUtility(); deSkewUtility.New(bitmap); double skewAngle = -1.0 * deSkewUtility.GetSkewAngle(); bitmap = BarcodeUtility.RotateImage(bitmap, ((float)(skewAngle))); } ArrayList codesRead = new ArrayList(); BarcodeUtility.FullScanPage(ref codesRead, bitmap, ModuleConfiguration.Default_BarCodeScanningTimes); if (codesRead.Count > 0) { returnValue = codesRead[0].ToString(); } resultImage = bitmap; resultBarCode = codesRead; return(returnValue); }
private string getBarCode(out Bitmap rawImage, out ArrayList rawBarCode) { string returnValue = String.Empty; //byte[] imageBytes = new byte[1024]; //this.camera.GetImage(imageBytes, ModuleConfiguration.Default_TimeredBarCodeCameraTimeout); //MemoryStream stream = new MemoryStream(imageBytes); Bitmap bitmap = null;// = new Bitmap(stream); this.camera.GetImage(out bitmap, ModuleConfiguration.Default_TimeredBarCodeCameraTimeout); float imageRotationDegree = ModuleConfiguration.Default_ImageRotationDegree; if (imageRotationDegree != 0) { Dictionary <string, object> rotationParams = ModuleConfiguration.Defautl_ImageRotationParameters; if ((rotationParams != null) && (rotationParams.Count > 0)) { int rotationAtPercentageOfImageWidth = (int)(rotationParams["RotationAtPercentageOfImageWidth"]); int rotationAtPercentageOfImageHeight = (int)(rotationParams["RotationAtPercentageOfImageHeight"]); bool isNoClip = (bool)(rotationParams["IsNoClip"]); bitmap = BarcodeUtility.RotateImage(bitmap, (bitmap.Width * (rotationAtPercentageOfImageWidth / 100)), (bitmap.Height * (rotationAtPercentageOfImageHeight / 100)), imageRotationDegree, isNoClip); } else { bitmap = BarcodeUtility.RotateImage(bitmap, imageRotationDegree); } } ArrayList codesRead = new ArrayList(); BarcodeUtility.FullScanPage(ref codesRead, bitmap, ModuleConfiguration.Default_TimeredBarCodeCameraScanningTimes); if (codesRead.Count > 0) { returnValue = codesRead[0].ToString(); } rawImage = bitmap; rawBarCode = codesRead; return(returnValue); }
private void btnGenerateBarcode_Click(object sender, EventArgs e) { if (!SelectedJewels.Any()) { MessageBox.Show(Resources.frmAllJewelsBarcodePrint_btnGenerateBarcode_Click_No_Jewel_selected_for_report_, "No Jewel selected", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var jewelMasterDataSet = new JewelMasterDataSet(); var barcode = new BarcodeUtility(); foreach (var jewel in SelectedJewels) { //Add data to crystal report. var jewelImage = barcode.MakeBarcodeImage(jewel.JewelNo); var jewelMasterRow = jewelMasterDataSet.Tables["JewelMaster"].NewRow(); jewelMasterRow["JewelId"] = jewel.JewelId; jewelMasterRow["JewelNo"] = jewel.JewelNo; jewelMasterRow["StyleNo"] = jewel.StyleNo; jewelMasterRow["JewelDescription"] = jewel.JewelDescription; jewelMasterRow["MetalColor"] = jewel.MetalColor; jewelMasterRow["ImagePath"] = ImageExtension.GetImageName(jewel.StyleNo); jewelMasterRow["DiamondPcs"] = Convert.ToString(jewel.DiamondPcs); jewelMasterRow["DiamondWt"] = Convert.ToString(jewel.DiamondWt); jewelMasterRow["GrsWt"] = Convert.ToString(jewel.GrsWt); jewelMasterRow["NetWt"] = Convert.ToString(jewel.NetWt); jewelMasterRow["JewelImage"] = ImageConverterHelper.ImageToByteArray(jewelImage); jewelMasterDataSet.Tables["JewelMaster"].Rows.Add(jewelMasterRow); } if (File.Exists(Application.StartupPath + @"\" + ReportConstants.JEWELMASTERREPORTPATH)) { var reportDocument = new ReportDocument(); reportDocument.Load(Application.StartupPath + @"\" + ReportConstants.JEWELMASTERREPORTPATH); crystalReportViewer1.ReportSource = null; crystalReportViewer1.ReportSource = reportDocument; reportDocument.SetDataSource(jewelMasterDataSet); crystalReportViewer1.Refresh(); } }
public void ShowBarcodeTag(IEnumerable <String> jewelNumbers) { var jewelMasterDataSet = new JewelMasterDataSet(); var barcode = new BarcodeUtility(); foreach (var jewel in jewelNumbers) { var jeweltran = _transactionService.GetJewelStockByJewelNo(jewel); if (jeweltran == null) { continue; } var jewelImage = barcode.MakeBarcodeImage(jeweltran.JewelNumber); var jewelMasterRow = jewelMasterDataSet.Tables["JewelMaster"].NewRow(); jewelMasterRow["JewelNo"] = jeweltran.JewelNumber; jewelMasterRow["StyleNo"] = jeweltran.DesignCode; jewelMasterRow["CertificateNo"] = jeweltran.CertificateNumber; jewelMasterRow["JewelDescription"] = jeweltran.JewelType; jewelMasterRow["MetalColor"] = jeweltran.MetalColor; jewelMasterRow["ImagePath"] = ImageExtension.GetImageName(jeweltran.DesignCode); jewelMasterRow["DiamondPcs"] = Convert.ToString(jeweltran.StonePcs); jewelMasterRow["DiamondWt"] = Convert.ToString(jeweltran.StoneWeight); jewelMasterRow["GrsWt"] = Convert.ToString(jeweltran.TotalWeight); jewelMasterRow["NetWt"] = Convert.ToString(jeweltran.MetalWeight); jewelMasterRow["JewelImage"] = ImageConverterHelper.ImageToByteArray(jewelImage); jewelMasterDataSet.Tables["JewelMaster"].Rows.Add(jewelMasterRow); } var orderReport = new frmReport { ReportPath = ResolveReportPath(ReportConstants.JEWELMASTERREPORTPATH), ReportDataSet = jewelMasterDataSet }; orderReport.Show(); }
private void frmBarcodePrinter_Load(object sender, EventArgs e) { var jewels = FormData as TransactionLookup; var jewelMasterDataSet = new JewelMasterDataSet(); var barcode = new BarcodeUtility(); foreach (var jewel in jewels.JewelTransactions) { var jewelImage = barcode.MakeBarcodeImage(jewel.JewelNumber); var jewelMasterRow = jewelMasterDataSet.Tables["JewelMaster"].NewRow(); jewelMasterRow["JewelNo"] = jewel.JewelNumber; jewelMasterRow["CertificateNo"] = jewel.CertificateNumber; jewelMasterRow["StyleNo"] = jewel.DesignCode; jewelMasterRow["JewelDescription"] = jewel.JewelType; jewelMasterRow["MetalColor"] = jewel.MetalColor; jewelMasterRow["ImagePath"] = ImageExtension.GetImageName(jewel.DesignCode); jewelMasterRow["DiamondPcs"] = Convert.ToString(jewel.StonePcs); jewelMasterRow["DiamondWt"] = Convert.ToString(jewel.StoneWeight); jewelMasterRow["GrsWt"] = Convert.ToString(jewel.TotalWeight); jewelMasterRow["NetWt"] = Convert.ToString(jewel.MetalWeight); jewelMasterRow["JewelImage"] = ImageConverterHelper.ImageToByteArray(jewelImage); jewelMasterDataSet.Tables["JewelMaster"].Rows.Add(jewelMasterRow); } if (File.Exists(ReportUtility.ResolveReportPath(ReportConstants.JEWELMASTERREPORTPATH))) { var reportDocument = new ReportDocument(); reportDocument.Load(ReportUtility.ResolveReportPath(ReportConstants.JEWELMASTERREPORTPATH)); crystalReportViewer.ReportSource = null; crystalReportViewer.ReportSource = reportDocument; reportDocument.SetDataSource(jewelMasterDataSet); crystalReportViewer.Refresh(); } }
static void Main(string[] args) { // Prompt for an IBAN account number Console.WriteLine("Kirjoita laskuttajan tilinumero IBAN-muodossa:"); string userInput = Console.ReadLine().Replace(" ", ""); while (!NumberUtility.CheckNumberLength(userInput.Remove(0, 2), 16, 16) || !PaymentReference.ValidateIBANNumber(userInput)) { Console.WriteLine("Tilinumero virheellinen. Tarkista tilinumero."); Console.WriteLine("Kirjoita laskuttajan tilinumero IBAN-muodossa:"); userInput = Console.ReadLine().Replace(" ", ""); } string ibanNumber = userInput; // Prompt for total invoice sum Console.Write("Kirjoita laskun loppusumma: "); userInput = Console.ReadLine(); while ((!NumberUtility.CheckNumberLength(userInput, 1, 999, "double") || (double.Parse(userInput).ToString("F0").Length > 6))) { Console.WriteLine("Laskun summa virheellinen. Kayta pilkkua erottimena. Summa saa olla korkeintaan 999999."); Console.Write("Kirjoita laskun loppusumma:"); userInput = Console.ReadLine(); } double invoiceSum = double.Parse(userInput); // Ask if the reference number is a domestic one or international. This information will be used later to determine which validation method to use Console.Write("Onko laskulla kansainvalinen RF-viite (kotimaisen viitteen sijaan)? (k/e): "); var userKeyInput = Console.ReadKey(); while (userKeyInput.Key != ConsoleKey.K && userKeyInput.Key != ConsoleKey.E) { Console.WriteLine("\nVirheellinen vastaus. Kirjoita vastaukseksi k tai e."); Console.Write("Onko laskulla kansainvalinen RF-viite (kotimaisen viitteen sijaan)? (k/e): "); userKeyInput = Console.ReadKey(); } bool isInternationalReferenceNumber = (userKeyInput.Key == ConsoleKey.K); // Prompt for a reference number Console.WriteLine("\nKirjoita laskuttajan viite:"); userInput = Console.ReadLine().Replace(" ", ""); while (!NumberUtility.CheckNumberLength(userInput.Remove(0, 2)) || !PaymentReference.ValidateReferenceNumber(userInput, isInternationalReferenceNumber)) { Console.WriteLine("Viite virheellinen. Tarkista viite."); Console.WriteLine("Kirjoita laskuttajan viite:"); userInput = Console.ReadLine().Replace(" ", ""); } string referenceNumber = userInput.TrimStart(Convert.ToChar("0")); // Prompt for a due date DateTime dueDate; Console.WriteLine("Kirjoita laskun erapaiva (muodossa 06.08.2017):"); userInput = Console.ReadLine(); while (!DateTime.TryParseExact(userInput, "dd.MM.yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dueDate)) { Console.WriteLine("Erapaiva virheellinen. Tarkista erapaiva."); Console.WriteLine("Kirjoita laskun erapaiva (muodossa 06.08.2017):"); userInput = Console.ReadLine(); } Console.WriteLine("Virtuaaliviivakoodisi:\n{0}\n", BarcodeUtility.CreateBarcode(ibanNumber, invoiceSum, referenceNumber, dueDate)); Console.WriteLine("Paina mita tahansa nappainta jatkaaksesi..."); Console.ReadKey(); }