예제 #1
0
        void LoadData()
        {
            try
            {
                using (var db = new UnsafeRecordDAL())
                {
                    _unsafeRecords = db.RetrieveAll();
                }

                dgRecords.ItemsSource = _unsafeRecords;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
 void DeleteRecord()
 {
     if (dgRecords.SelectedItem != null)
     {
         using (var db = new UnsafeRecordDAL())
         {
             if (db.Delete(((UnsafeRecord)dgRecords.SelectedItem).Id) > 0)
             {
                 LoadData();
             }
         }
     }
     else
     {
         MessageBox.Show("Please select a Record");
     }
 }