Example #1
0
 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();
             }
         }
     }
 }
Example #2
0
 void lbName_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         sSelectedSupplierCode = lbCode.Items[lbCode.SelectedIndex].ToString();
         this.Close();
     }
     else if (e.KeyCode == Keys.Insert)
     {
         frmAddSupplier faes = new frmAddSupplier(ref sEngine);
         faes.ShowDialog();
         string[] sTillCodes = sEngine.GetListOfSuppliers();
         Array.Sort(sTillCodes);
         lbCode.Items.Clear();
         lbName.Items.Clear();
         for (int i = 0; i < sTillCodes.Length; i++)
         {
             string[] sTillData = sEngine.GetSupplierDetails(sTillCodes[i]);
             lbCode.Items.Add(sTillData[0]);
             lbName.Items.Add(sTillData[1]);
         }
         lbCode.SelectedIndex = 0;
     }
     else if (e.KeyCode == Keys.Delete && e.Shift)
     {
         sEngine.MarkSupplierAsDeleted(lbCode.Items[lbCode.SelectedIndex].ToString());
         int n = lbCode.SelectedIndex;
         lbCode.Items.RemoveAt(n);
         lbName.Items.RemoveAt(n);
     }
     else if (e.KeyCode == Keys.Escape)
     {
         this.Close();
     }
 }
Example #3
0
 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();
         }
     }
 }