public frmBarcodeSelect(BarcodeConfirmation barcodeTableConfirmation) : this() { int count = barcodeTableConfirmation.BarcodeTable.Rows.Count; this.barcodeTable = barcodeTableConfirmation.BarcodeTable; }
// Barcode form private void HandleBarcodeInteraction(InteractionRequestedEventArgs e) { if (e == null) { throw new ArgumentNullException("InteractionRequestedEventArgs"); } BarcodeConfirmation context = (BarcodeConfirmation)e.Context; BarcodeConfirmation results = InvokeInteraction <BarcodeConfirmation, BarcodeConfirmation>("BarcodeForm", context, true); if (results != null) { context.Confirmed = results.Confirmed; context.SelectedBarcodeId = results.SelectedBarcodeId; } }
private void btnSearch_Click(object sender, EventArgs e) { string barcodeId; string selectedItemId = string.Empty; // Show the search dialog through the item service if (!Dialog.InternalApplication.Services.Item.ItemSearch(ref selectedItemId, 500)) { return; } LSRetailPosis.DataAccess.ItemData itemData = new LSRetailPosis.DataAccess.ItemData( ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID, ApplicationSettings.Terminal.StorePrimaryId); System.Data.DataTable barcodeTable = itemData.GetBarcodesForItem(selectedItemId); barcodeId = string.Empty; if (barcodeTable != null) { switch (barcodeTable.Rows.Count) { case 0: //If no barcode is found then use the item id barcodeId = string.Empty; break; case 1: //If one barcode is found then use it. barcodeId = barcodeTable.Rows[0]["ITEMBARCODE"].ToString(); break; default: //If more than one barcode is found then select a barcode BarcodeConfirmation barCodeConfirmation = new BarcodeConfirmation() { BarcodeTable = barcodeTable }; InteractionRequestedEventArgs request = new InteractionRequestedEventArgs(barCodeConfirmation, () => { if (barCodeConfirmation.Confirmed) { barcodeId = barCodeConfirmation.SelectedBarcodeId; // Use the selected barcode } } ); Dialog.InternalApplication.Services.Interaction.InteractionRequest(request); break; } } if (barcodeId.Length != 0) { numPad1.EnteredValue = barcodeId; } else { numPad1.EnteredValue = selectedItemId; } InventoryLookup(numPad1.EnteredValue); }