Example #1
0
 private void txtShtrix_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if (txtShtrix.Text != "")
         {
             using (ApplicationDBContext context = new ApplicationDBContext())
             {
                 var v = (from a in context.Products
                          where a.Shtrix == txtShtrix.Text
                          select a).FirstOrDefault();
                 if (v == null)
                 {
                     AddProductWindow window = new AddProductWindow(txtShtrix.Text, false);
                     window.ShowDialog();
                 }
                 else
                 {
                     AddProductWindow window = new AddProductWindow(txtShtrix.Text, true);
                     window.ShowDialog();
                 }
                 txtShtrix.Text = "";
             }
         }
     }
 }
 private void allProduct_DG_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (allProduct_DG.SelectedCells.Count > 0 && allProduct_DG.SelectedCells[0].IsValid)
         {
             InfoAllProduct   t      = allProduct_DG.SelectedItem as InfoAllProduct;
             AddProductWindow window = new AddProductWindow(t.Shtrix, true);
             window.ShowDialog();
             Refresh_DG();
         }
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }