void SupCodeKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { frmListOfSuppliers flos = new frmListOfSuppliers(ref sEngine); flos.ShowDialog(); if (flos.sSelectedSupplierCode != "NULL") { InputTextBox("SUPCODE").Text = flos.sSelectedSupplierCode; InputTextBox("SUPREF").Focus(); } } else if (e.KeyCode == Keys.Enter) { if (sEngine.GetSupplierDetails(InputTextBox("SUPCODE").Text)[0] == null && InputTextBox("SUPCODE").Text != "") { if (MessageBox.Show("Supplier doesn't exist, would you like to add it?", "Add Supplier?", MessageBoxButtons.YesNo) == DialogResult.Yes) { frmAddSupplier fas = new frmAddSupplier(ref sEngine); fas.ShowDialog(); } InputTextBox("SUPCODE").Focus(); } else // THe supplier is recognised, a new order may be created, or a previous one opened { // Check to see if the user is trying to use the shift&enter short if (e.Shift) { bFinished = true; this.Close(); } } } }
void frmAddSupplierCode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string[] sData = sEngine.GetSupplierDetails(InputTextBox("CODE").Text); if (sData[0] != null) { for (int i = 0; i < sData.Length - 2; i++) { ibArray[i].tbInput.Text = sData[i]; } } InputTextBox("SUPNAME").SelectionStart = InputTextBox("SUPNAME").Text.Length; } else if (e.KeyCode == Keys.F5) { frmListOfSuppliers fls = new frmListOfSuppliers(ref sEngine); fls.ShowDialog(); if (fls.sSelectedSupplierCode != "NULL") { InputTextBox("CODE").Text = fls.sSelectedSupplierCode; SendKeys.Send("{ENTER}"); bLoaded = true; } } }
void SupplierCodeDoubleClick(object sender, EventArgs e) { frmListOfSuppliers flos = new frmListOfSuppliers(ref sEngine); flos.ShowDialog(); if (flos.sSelectedSupplierCode != "NULL") { InputTextBox("SUPCODE").Text = flos.sSelectedSupplierCode; InputTextBox("SUPREF").Focus(); } }
void SupCodeKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { frmListOfSuppliers flos = new frmListOfSuppliers(ref sEngine); flos.ShowDialog(); if (flos.sSelectedSupplierCode != "NULL") { InputTextBox("SUPCODE").Text = flos.sSelectedSupplierCode; InputTextBox("CAT").Focus(); } } }
void frmOutstandingItemsSetup_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { frmListOfSuppliers flos = new frmListOfSuppliers(ref sEngine); flos.ShowDialog(); if (flos.sSelectedSupplierCode != "NULL") { InputTextBox("SUPCODE").Text = flos.sSelectedSupplierCode; InputTextBox("SORP").Focus(); } } else if (e.KeyCode == Keys.Escape) { this.Close(); } }
void SupplierKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { frmListOfSuppliers flos = new frmListOfSuppliers(ref sEngine); flos.ShowDialog(); if (flos.sSelectedSupplierCode != "NULL") { InputTextBox("SUPPLIER").MaxCharCount = 6; InputTextBox("SUPPLIER").Text = flos.sSelectedSupplierCode; InputTextBox("TYPE").Focus(); } } else if (e.KeyCode == Keys.F6) { frmListOfCommissioners floc = new frmListOfCommissioners(ref sEngine); floc.ShowDialog(); if (floc.Commissioner != "$NONE") { InputTextBox("SUPPLIER").MaxCharCount = 8; InputTextBox("SUPPLIER").Text = floc.Commissioner; InputTextBox("TYPE").Focus(); } } else if (e.KeyCode == Keys.Enter && InputTextBox("SUPPLIER").Text != "" && sEngine.GetSupplierDetails(InputTextBox("SUPPLIER").Text.ToUpper())[0] == null) { if (MessageBox.Show("Supplier not found! Would you like to add a supplier?", "Supplier Code", MessageBoxButtons.YesNo) == DialogResult.Yes) { frmAddSupplier fas = new frmAddSupplier(ref sEngine); fas.ShowDialog(); } else { InputTextBox("SUPPLIER").Focus(); } } }
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; } }