Exemple #1
0
        private async Task <bool> PrintBarcodesAsync(List <string> cins)
        {
            List <BarcodeDataModel> barcodeData;

            try
            {
                barcodeData = await _viewModel.GetBarcodeData(cins);

                return(_barcodeHelper.PrintMultipleSampleBarcode(barcodeData));
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// loads barcode data from database and tries to print the barcodes
        /// NOTE: *********************************************  DUBLICATE CODE EXISTS ON RESULT ENTRY VIEW ************************
        /// </summary>
        /// <returns>True if able to load barcode data from database, even if the printing step fails.</returns>
        private async Task <bool> PrintBarcodeAsync()
        {
            List <BarcodeDataModel> barcodeData;

            try
            {
                barcodeData = await _viewModel.GetBarcodeDataAsync();

                return(_barcodeHelper.PrintMultipleSampleBarcode(barcodeData));
            }
            catch (System.Drawing.Printing.InvalidPrinterException ex)
            {
                XtraMessageBox.Show($"Cannot print the barcode. The sample will be marked as collected if status is registered. Please find the error(s) below\n{ex.Message}");
                return(true);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
                return(false);
            }
        }