Beispiel #1
0
        /// <summary>
        /// Search for given barcode and return the corresponding Product object
        /// </summary>
        /// <param name="input">barcode scanned</param>
        /// <returns>Product object</returns>
        public Product search(string input, Barcode barcode = null)
        {
            Barcode b;

            if (barcode != null)
            {
                b = barcode;
            }
            else
            {
                b = parser.parse(input);
            }

            switch (b.BType())
            {
            case BarcodeEnum.KIT:
                return(KitProduct((BKit)b));

            default:
                break;
            }
            return(null);
        }
        /// <summary>
        /// Add kit to the queue via barcode number
        /// </summary>
        /// <param name="barcode"></param>
        private void addByBarcode(string barcode)
        {
            Kit k = (Kit)search.search("", barcodeParser.parse(barcode));

            // Check to see if a currentKitNumber is set
            if (currentKitNumber.Equals(""))
            {
                // update current kit number
                currentKitNumber = k.ProductNumber;

                if (!checkInQueue(k))
                {
                    kitQueueList.Add(k);

                    // Args => [DataGridView, CheckBox State, Product Number, Serial Number]
                    AddKitQueueRow(kitQueueTable, false, k.ProductNumber, k.SerialNumber);
                }
                else
                {
                    MessageBox.Show(k.ToString() + " is already in the queue", "Hey!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            else
            {
                // Make sure the kits we are adding are the same as others in the queue
                if (!checkKitNumber(k.ProductNumber))
                {
                    MessageBox.Show(k.ToString() + " is not the same as other kits in the queue and will not be added",
                                    "Queue Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    if (!checkInQueue(k))
                    {
                        kitQueueList.Add(k);

                        // Args => [DataGridView, CheckBox State, Product Number, Serial Number]
                        AddKitQueueRow(kitQueueTable, false, k.ProductNumber, k.SerialNumber);
                    }
                    else
                    {
                        MessageBox.Show(k.ToString() + " is already in the queue", "Hey!",
                                        MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
            }
        }