예제 #1
0
 private void delProduct_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         BuysTable buy = res.First();
         //Debug.WriteLine(productID);
         db.Buys.DeleteOnSubmit(buy);
         db.SubmitChanges();
         InitializeSettings();
     }
 }
예제 #2
0
 private void addProduct_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         if (res.Count() == 0)
         {
             BuysTable buy = new BuysTable();
             buy.productID = productID;
             db.Buys.InsertOnSubmit(buy);
             db.SubmitChanges();
         }
     }
 }
예제 #3
0
 private void saveBuy()
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         if (res.Count() == 0)
         {
             BuysTable buy = new BuysTable();
             buy.productID = productID;
             db.Buys.InsertOnSubmit(buy);
             db.SubmitChanges();
             popupMsgText.Text = "Добавлено";
             showPopup();
         }
         else
         {
             popupMsgText.Text = "Уже есть в списке покупок";
             showPopup();
         }
     }
 }
예제 #4
0
 private void addProduct_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         if (res.Count() == 0)
         {
             BuysTable buy = new BuysTable();
             buy.productID = productID;
             db.Buys.InsertOnSubmit(buy);
             db.SubmitChanges();
         }
     }
 }
예제 #5
0
 private void saveBuy()
 {
     using (var db = new DiscountDataContext())
     {
         var res = from c in db.Buys
                   where c.productID == productID
                   select c;
         if (res.Count() == 0)
         {
             BuysTable buy = new BuysTable();
             buy.productID = productID;
             db.Buys.InsertOnSubmit(buy);
             db.SubmitChanges();
             popupMsgText.Text = "Добавлено";
             showPopup();
         }
         else
         {
             popupMsgText.Text = "Уже есть в списке покупок";
             showPopup();
         }
     }
 }