コード例 #1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (var ctx = new finalContext())
         {
             int n = Convert.ToInt32(getRow(dg1,0));
             TempClearing tc = new TempClearing { FPaymentInfoID = n };
             ctx.TempClearings.Add(tc);
             ctx.SaveChanges();
             rg();
         }
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
 }
コード例 #2
0
 private void Button_Click_3(object sender, RoutedEventArgs e)
 {
     try
     {
         using (var ctx = new finalContext())
         {
             //ctx.Database.ExecuteSqlCommand("delete  from dbo.TempClearings");
             var chq = from ch in ctx.FPaymentInfo
                       where ch.PaymentStatus == "Deposited"
                       && !(from o in ctx.TempClearings select o.FPaymentInfoID).Contains(ch.FPaymentInfoID)
                       select ch;
             foreach (var item in chq)
             {
                 TempClearing tc = new TempClearing { FPaymentInfoID = item.FPaymentInfoID };
                 ctx.TempClearings.Add(tc);
             }
             ctx.SaveChanges();
             rg();
         }
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     
 }