示例#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();
         }
     }
 }