コード例 #1
0
 void frmStockLevelReportConfig_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         frmCategorySelect fcat = new frmCategorySelect(ref sEngine);
         fcat.ShowDialog();
         if (fcat.SelectedItemCategory != "$NULL")
         {
             bUsingCatGroups          = false;
             InputTextBox("CAT").Text = fcat.SelectedItemCategory;
             InputTextBox("SORP").Focus();
         }
     }
     else if (e.KeyCode == Keys.F6)
     {
         frmListOfCategoryGroups flcat = new frmListOfCategoryGroups(ref sEngine);
         flcat.ShowDialog();
         if (flcat.SelectedCategoryGroup != "$NONE")
         {
             bUsingCatGroups          = true;
             InputTextBox("CAT").Text = flcat.SelectedCategoryGroup;
             InputTextBox("SORP").Focus();
         }
     }
     else if (e.KeyCode == Keys.Escape)
     {
         this.Close();
     }
 }
コード例 #2
0
        void CatKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F5)
            {
                frmCategorySelect fCat = new frmCategorySelect(ref sEngine);
                fCat.ShowDialog();
                if (fCat.SelectedItemCategory != "$NULL")
                {
                    InputTextBox("CAT").Text = fCat.SelectedItemCategory;
                }
            }
            else if (e.KeyCode == Keys.Enter)
            {
                if (InputTextBox("CAT").Text == "" && InputTextBox("SUPCODE").Text == "")
                {
                    if (MessageBox.Show("This will load every single item in the database. Continue?", "Ahem", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        bFinished = true;
                        this.Close();
                    }
                }

                else
                {
                    bFinished = true;
                    this.Close();
                }
            }
        }
コード例 #3
0
        void F5Click(object sender, EventArgs e)
        {
            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();
                }
            }
        }
コード例 #4
0
 void CatKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         frmCategorySelect fcs = new frmCategorySelect(ref sEngine);
         fcs.ShowDialog();
         if (fcs.SelectedItemCategory != "$NULL")
         {
             InputTextBox("CAT").Text = fcs.SelectedItemCategory;
         }
         InputTextBox("CAT").SelectionStart = InputTextBox("CAT").Text.Length;
     }
     else if (e.KeyCode == Keys.Enter)
     {
         try
         {
             dAveSalesMin  = Convert.ToDecimal(InputTextBox("AVESALES").Text);
             dNumberOfDays = Convert.ToDecimal(InputTextBox("DAYS").Text);
             sCategory     = InputTextBox("CAT").Text;
             bOK           = true;
         }
         catch
         {
             bOK = false;
         }
         this.Close();
     }
     else if (e.KeyCode == Keys.Escape)
     {
         InputTextBox("AVESALES").Focus();
     }
 }
コード例 #5
0
 void tbItemParamKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         int nNo = Convert.ToInt32(((TextBox)sender).AccessibleDescription);
         if (cItemType[nNo].SelectedIndex == 0)
         {
             frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
             fsfi.ShowDialog();
             if (fsfi.GetItemBarcode() != "NONE_SELECTED")
             {
                 ((TextBox)sender).Text = fsfi.GetItemBarcode();
             }
         }
         else if (cItemType[nNo].SelectedIndex == 1)
         {
             frmCategorySelect fCats = new frmCategorySelect(ref sEngine);
             fCats.ShowDialog();
             if (fCats.SelectedItemCategory != "$NULL")
             {
                 ((TextBox)sender).Text = fCats.SelectedItemCategory;
             }
         }
     }
 }
コード例 #6
0
 void CategoryKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         frmCategorySelect fcs = new frmCategorySelect(ref sEngine);
         fcs.ShowDialog();
         if (fcs.SelectedItemCategory != "$NULL")
         {
             InputTextBox("CATEGORY").Text = fcs.SelectedItemCategory;
             InputTextBox("VAT").Focus();
         }
     }
 }
コード例 #7
0
 void CatKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         frmCategorySelect fCat = new frmCategorySelect(ref sEngine);
         fCat.ShowDialog();
         if (fCat.SelectedItemCategory != "$NULL")
         {
             InputTextBox("CAT").Text = fCat.SelectedItemCategory;
             InputTextBox("EDITDESC").Focus();
         }
     }
 }
コード例 #8
0
 void frmReportSelectENDCAT_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         frmCategorySelect fcSelect = new frmCategorySelect(ref sEngine);
         fcSelect.ShowDialog();
         if (fcSelect.SelectedItemCategory != "$NULL")
         {
             InputTextBox("ENDCAT").Text = fcSelect.SelectedItemCategory;
         }
         fcSelect.Dispose();
     }
     else if (e.KeyCode == Keys.Escape)
     {
         InputTextBox("STARTCAT").Focus();
     }
 }
コード例 #9
0
 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();
     }
 }
コード例 #10
0
 void dGrid_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F3 && !bF3Registered)
     {
         bF5Registered     = false;
         bEscapeRegistered = false;
         bF3Registered     = true;
         frmSingleInputBox fsfiGetOriginal = new frmSingleInputBox("Where the " + dGrid.Columns[dGrid.SelectedCells[0].ColumnIndex].Name + " is currently...", ref sEngine);
         fsfiGetOriginal.tbResponse.Text = dGrid.CurrentCell.Value.ToString();
         fsfiGetOriginal.ShowDialog();
         if (fsfiGetOriginal.Response != "$NONE")
         {
             frmSingleInputBox fsfiGetNew = new frmSingleInputBox("Change the " + dGrid.Columns[dGrid.SelectedCells[0].ColumnIndex].Name + " from " + fsfiGetOriginal.Response + " to...", ref sEngine);
             fsfiGetNew.ShowDialog();
             if (fsfiGetNew.Response != "$NONE")
             {
                 bool bNoneConverted = false;
                 while (!bNoneConverted) // Has to be done otherwise the grid sorts elements as it's changing them and ends up missing some
                 {
                     bNoneConverted = true;
                     for (int i = 0; i < dGrid.Rows.Count; i++)
                     {
                         if (dGrid.SelectedCells[0].ColumnIndex != 4 && dGrid.SelectedCells[0].ColumnIndex != 8 && dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].FormattedValue.ToString() == fsfiGetOriginal.Response)
                         {
                             dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].Value = fsfiGetNew.Response;
                             bNoneConverted = false;
                             //i = 0;
                         }
                         else if ((dGrid.SelectedCells[0].ColumnIndex == 4 || dGrid.SelectedCells[0].ColumnIndex == 8) && dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].FormattedValue.ToString() != "" && Convert.ToDecimal(dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].FormattedValue.ToString()).Equals(Convert.ToDecimal(fsfiGetOriginal.Response)))
                         {
                             dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].Value = ScalableForm.FormatMoneyForDisplay(fsfiGetNew.Response);
                             bNoneConverted = false;
                             //i = 0;
                         }
                     }
                 }
             }
         }
     }
     else if (e.KeyCode == Keys.Escape && ((dGrid.CurrentCell != null && !dGrid.CurrentCell.IsInEditMode && !bEscapeRegistered) || (bEscapeRegistered && (nRowEscRegistered != dGrid.CurrentCell.RowIndex) || (nColumnEscRegistered != dGrid.CurrentCell.ColumnIndex))))// && lastKey != Keys.Escape)
     {
         bEscapeRegistered    = true;
         nColumnEscRegistered = dGrid.CurrentCell.ColumnIndex;
         nRowEscRegistered    = dGrid.CurrentCell.RowIndex;
         bF5Registered        = false;
         bF3Registered        = false;
         AskToSave();
     }
     else if (dGrid.CurrentCell.ColumnIndex == 2 && e.KeyCode == Keys.F5 && !bShowingType && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         bShowingType      = true;
         frmListOfItemTypes flot = new frmListOfItemTypes();
         flot.SelectedItemType = Convert.ToInt32(dGrid.CurrentCell.Value.ToString());
         flot.ShowDialog();
         if (flot.SelectedItemType != -1)
         {
             dGrid.CurrentCell.Value = flot.SelectedItemType.ToString();
         }
         bShowingType = false;
         e.Handled    = true;
     }
     else if (dGrid.CurrentCell.ColumnIndex == 3 && e.KeyCode == Keys.F5 && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         frmCategorySelect fcs = new frmCategorySelect(ref sEngine);
         fcs.ShowDialog();
         if (fcs.SelectedItemCategory != "$NULL")
         {
             dGrid.CurrentCell.Value = fcs.SelectedItemCategory;
         }
     }
     else if (dGrid.CurrentCell.ColumnIndex == 5 && e.KeyCode == Keys.F5 && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         frmListOfVATRates flov = new frmListOfVATRates(ref sEngine);
         flov.ShowDialog();
         if (flov.sSelectedVATCode != "NULL")
         {
             dGrid.CurrentCell.Value = flov.sSelectedVATCode;
         }
     }
     else if (dGrid.CurrentCell.ColumnIndex == 7 && e.KeyCode == Keys.F5 && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         frmListOfSuppliers flos = new frmListOfSuppliers(ref sEngine);
         flos.ShowDialog();
         if (flos.sSelectedSupplierCode != "NULL")
         {
             dGrid.CurrentCell.Value = flos.sSelectedSupplierCode;
         }
     }
     else if (dGrid.CurrentCell.ColumnIndex == 10 && e.KeyCode == Keys.F5 && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
         fsfi.ShowDialog();
         if (fsfi.GetItemBarcode() != "NONE_SELECTED")
         {
             dGrid.CurrentCell.Value = fsfi.GetItemBarcode();
         }
     }
     else if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Right || e.KeyCode == Keys.Up || e.KeyCode == Keys.Left)
     {
         bF3Registered     = false;
         bF5Registered     = false;
         bEscapeRegistered = false;
     }
     else if (e.KeyCode == Keys.Enter)
     {
         e.Handled = true;
     }
 }
コード例 #11
0
        void tbResponse_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (tbResponse.Text == "")
                {
                    Response = "$NONE";
                }
                else
                {
                    Response = tbResponse.Text;

                    if (!GettingCategory && lblQuestion.Text.Contains("parent"))
                    {
                        if (this.ShopCode != null && sEngine.GetItemStockStaRecord(tbResponse.Text, this.ShopCode).Length < 3) // ie Item doesn't exist
                        {
                            frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
                            fsfi.CheckForPartialBarcodeFromScanner(tbResponse.Text, false);
                            fsfi.ShowDialog();
                            if (fsfi.GetItemBarcode() != "NONE_SELECTED")
                            {
                                tbResponse.Text = fsfi.GetItemBarcode();
                                Response        = tbResponse.Text;
                            }
                            else
                            {
                                Response = "$NONE";
                            }
                        }
                    }
                }
                this.Close();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                tbResponse.Text = "";
                Response        = "$NONE";
                this.Close();
            }
            else if (e.KeyCode == Keys.F5)
            {
                // Parent one means that when looking for a parent item, categories will appear
                // Request from Jim
                if (!GettingCategory && !lblQuestion.Text.Contains("parent"))
                {
                    frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
                    if (ProductLookupHelp != "")
                    {
                        fsfi.CheckForPartialBarcodeFromScanner(ProductLookupHelp, false);
                    }
                    fsfi.ShowDialog();
                    if (fsfi.GetItemBarcode() != "NONE_SELECTED")
                    {
                        tbResponse.Text = fsfi.GetItemBarcode();
                        Response        = tbResponse.Text;
                        this.Close();
                    }
                }
                else
                {
                    frmCategorySelect fCat = new frmCategorySelect(ref sEngine);
                    fCat.ShowDialog();
                    if (fCat.SelectedItemCategory != "$NULL")
                    {
                        frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
                        fsfi.SetSearchTerm("CAT:" + fCat.SelectedItemCategory);
                        fsfi.ShowDialog();
                        if (!fsfi.GetItemBarcode().Equals("NONE_SELECTED"))
                        {
                            tbResponse.Text = fsfi.GetItemBarcode();
                        }
                        else
                        {
                            tbResponse.Text = "";
                        }
                    }
                }
            }
        }