void frmGetBarcode_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         Barcode = InputTextBox("GETCODE").Text;
         if (sEngine.GetMainStockInfo(Barcode)[0] == null && InputTextBox("GETCODE").Text != "")
         {
             frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
             fsfi.CheckForPartialBarcodeFromScanner(Barcode, true);
             if (!fsfi.FoundScannerResults)
             {
                 if (MessageBox.Show("This item doesn't exist! Would you like to create it?", "Not found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                 {
                     Barcode = "";
                     frmAddEditItem faei = new frmAddEditItem(ref sEngine);
                     faei.AddingBarcode = InputTextBox("GETCODE").Text;
                     faei.ShowDialog();
                     faei.Dispose();
                     InputTextBox("GETCODE").Focus();
                 }
                 else
                 {
                     InputTextBox("GETCODE").Text = "";
                     InputTextBox("GETCODE").Focus();
                     Barcode = "";
                 }
             }
             else
             {
                 fsfi.Hide();
                 fsfi.ShowDialog();
                 if (fsfi.GetItemBarcode() != "NONE_SELECTED")
                 {
                     InputTextBox("GETCODE").Text = fsfi.GetItemBarcode();
                     InputTextBox("GETCODE").Focus();
                     Barcode = fsfi.GetItemBarcode();
                     this.Close();
                 }
                 else
                 {
                     InputTextBox("GETCODE").Focus();
                 }
             }
         }
         else
         {
             this.Close();
         }
     }
     else if (e.KeyCode == Keys.F5)
     {
         // Show categories
         frmCategorySelect fcs = new frmCategorySelect(ref sEngine);
         fcs.ShowDialog();
         string sSelectedCategory = fcs.SelectedItemCategory;
         if (sSelectedCategory != "$NULL")
         {
             LastCategory = sSelectedCategory;
             frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
             fsfi.CheckForPartialBarcodeFromScanner("CAT:" + sSelectedCategory);
             fsfi.ShowDialog();
             if (fsfi.GetItemBarcode() != "NONE_SELECTED")
             {
                 InputTextBox("GETCODE").Text = fsfi.GetItemBarcode();
                 Barcode = fsfi.GetItemBarcode();
                 fsfi.Dispose();
                 this.Close();
             }
             else
             {
                 fsfi.Dispose();
             }
         }
     }
     else if (e.KeyCode == Keys.F6)
     {
         // Show last category
         LastCategory = sEngine.LastCategoryCode;
         if (LastCategory != "")
         {
             frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
             fsfi.CheckForPartialBarcodeFromScanner("CAT:" + LastCategory);
             fsfi.ShowDialog();
             if (fsfi.GetItemBarcode() != "NONE_SELECTED")
             {
                 InputTextBox("GETCODE").Text = fsfi.GetItemBarcode();
                 Barcode = fsfi.GetItemBarcode();
                 fsfi.Dispose();
                 this.Close();
             }
             else
             {
                 fsfi.Dispose();
             }
         }
     }
     else if (e.KeyCode == Keys.F7)
     {
         // Description search
         frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
         fsfi.ShowDialog();
         if (fsfi.GetItemBarcode() != "NONE_SELECTED")
         {
             InputTextBox("GETCODE").Text = fsfi.GetItemBarcode();
             Barcode = fsfi.GetItemBarcode();
             this.Close();
         }
     }
     else if (e.KeyCode == Keys.Escape)
     {
         InputTextBox("GETCODE").Text = "";
         Barcode = "";
         this.Close();
     }
 }
Exemple #2
0
        void frmDetailedItemEnquiry_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                if (!bJustEscd)
                {
                    this.Close();
                }
                else
                {
                    bJustEscd = false;
                }
            }
            else
            {
                switch (InputTextBox("INPUT").Text.ToUpper())
                {
                case "A":
                    frmGetBarcode fgb = new frmGetBarcode(ref sEngine);
                    fgb.LastCategory = sItemCategory;
                    fgb.ShowDialog();
                    if (fgb.Barcode != "" && fgb.Barcode != null)
                    {
                        sBarcode = fgb.Barcode;
                        ShowStatsAboutProduct();
                        fgb.Dispose();
                    }
                    break;

                case "E":
                    frmAddEditItem faei = new frmAddEditItem(ref sEngine);
                    faei.EditingBarcode = sBarcode;
                    faei.ShowDialog();
                    faei.Dispose();
                    this.ShowStatsAboutProduct();
                    bJustEscd = true;
                    break;

                case "Q":
                    this.Close();
                    break;

                case "O":
                    frmOrdersWithItemIn fowii = new frmOrdersWithItemIn(ref sEngine, sBarcode);
                    fowii.ShowDialog();
                    this.ShowStatsAboutProduct();
                    bJustEscd = true;
                    break;

                case "I":
                    if (ForAnOrder)
                    {
                        ItemAdded = true;
                        this.Close();
                    }
                    break;

                case "R":
                    if (sMainStock[5] == "1")
                    {
                        sEngine.AddSuggestedOrderItem(sBarcode, sShopCode);
                        MessageBox.Show("Item has been suggested!");
                    }
                    else
                    {
                        MessageBox.Show("Sorry, only type 1 items can be ordered!");
                    }
                    break;

                case "S":
                    frmSuppliersForItem fsfi = new frmSuppliersForItem(ref sEngine, sBarcode);
                    fsfi.ShowDialog();
                    bJustEscd = true;
                    break;

                case "V":
                    frmListOfSales flos = new frmListOfSales(ref sEngine, sBarcode);
                    flos.ShowDialog();
                    bJustEscd = true;
                    break;
                }
                InputTextBox("INPUT").Text = "";
            }
        }