Esempio n. 1
0
 private void txt_Search_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F2)
     {
         showQuantityChanger();
     }
     if (e.KeyCode == Keys.Enter)
     {
         if (!saleIsActive)
         {
             newSale();
         }
         int productID;
         if (!int.TryParse(txt_Search.Text, out productID))
         {
             if (isSaleReadyToEnd())
             {
                 endSale();
                 return;
             }
             else
             {
                 DialogProductSearch productSearch = new DialogProductSearch(txt_Search.Text);
                 productSearch.ShowDialog();
                 if (productSearch.DialogResult == DialogResult.OK)
                 {
                     productID = productSearch.productId;
                 }
                 else
                 {
                     txt_Search.Clear();
                     return;
                 }
             }
         }
         addProductToList(productID);
         txt_Search.Clear();
     }
 }
Esempio n. 2
0
 private void txt_Search_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         int productID;
         if (!int.TryParse(txt_Search.Text, out productID))
         {
             DialogProductSearch productSearch = new DialogProductSearch(txt_Search.Text);
             productSearch.ShowDialog();
             if (productSearch.DialogResult == DialogResult.OK)
             {
                 productID = productSearch.productId;
             }
             else
             {
                 txt_Search.Clear();
                 return;
             }
         }
         //  addProductToList(productID);
         txt_Search.Clear();
     }
 }