示例#1
0
        private void Reader_OnBarCodeRead(object sender, BarCodeReader.BarCodeReadEventArgs e)
        {
            InventoryService iService = new InventoryService(_context);
            Regex            reg      = null;

            reg          = new System.Text.RegularExpressions.Regex("^[1-9][0-9]*$");
            foundBarCode = string.Empty;
            Invoke(new MethodInvoker(() => { txtScannerOutput.Text = e.ValueRead.ToString(); }));
            Invoke(new MethodInvoker(() => { foundBarCode = e.ValueRead.ToString(); }));
            if (txtScannerOutput.Text != string.Empty)
            {
                if (selectedPart != null && _scanType == ScanType.associate)
                {
                    partsService.AssociateSKU(selectedPart, foundBarCode);
                    var _part = partsService.Find(selectedPart.PartID);
                    if (_part.Sku == foundBarCode)
                    {
                        MessageBox.Show("Success Associating SKU to Part");
                        Invoke(new MethodInvoker(() => { this.txtPartSearch.Text = " "; }));
                    }
                    return;
                }
                else if (_scanType == ScanType.find)
                {
                    Part partlookup = partsService.FindBySKU(foundBarCode);
                    if (!String.IsNullOrEmpty(partlookup.Sku))
                    {
                        reader.CloseScanner();
                        Invoke(new MethodInvoker(() => { OpenPartDetailForm(partlookup.PartID, _context);; }));
                    }
                }
            }
        }
        private void Reader_OnBarCodeRead(object sender, BarCodeReader.BarCodeReadEventArgs e)
        {
            IPartsService partService  = new PartsService(_context);
            string        foundBarCode = e.ValueRead.ToString();

            if (foundBarCode != string.Empty)
            {
                int key = int.Parse(foundBarCode);
                var inv = partService.Find(key);

                if (inv != null)
                {
                    Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = inv; }));
                    Invoke(new MethodInvoker(() => { this.label1.Text = foundBarCode + " : Found"; }));
                }
                else
                {
                    Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = null; }));
                    Invoke(new MethodInvoker(() => { this.label1.Text = foundBarCode + " : No Match Found"; }));
                }
            }
        }
示例#3
0
        private void Reader_OnBarCodeRead(object sender, BarCodeReader.BarCodeReadEventArgs e)
        {
            IPartsService partService  = new PartsService(_context);
            string        foundBarCode = e.ValueRead.ToString();

            if (foundBarCode != string.Empty)
            {
                if (_part != null)
                {
                    _part.Sku = foundBarCode;
                    //Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = inv; }));
                    Invoke(new MethodInvoker(() => { this.txtSKU.Text = foundBarCode; }));
                }
                else
                {
                    //  Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = null; }));
                    Invoke(new MethodInvoker(() => { this.txtSKU.Text = String.Empty; }));
                }

                barCodeReader.OnBarCodeRead -= Reader_OnBarCodeRead;
            }
        }