Beispiel #1
0
 protected override void CommitUpdates()
 {
     if (EditVM == null || EditVM.TheEntity == null)
     {
         if (db.ChangeTracker.HasChanges())
         {
             UpdateDB();
         }
         return;
     }
     if (EditVM.TheEntity.IsValid())
     {
         if (EditVM.IsNew)
         {
             EditVM.IsNew = false;
             BoringBars.Add(EditVM);
             db.boring_bar.Add(EditVM.TheEntity);
             UpdateDB();
         }
         else if (db.ChangeTracker.HasChanges())
         {
             UpdateDB();
         }
         else
         {
             ShowUserMessage("Brak zmian do zapisania");
         }
     }
     else
     {
         ShowUserMessage("Problem z wprowadzonymi danymi");
     }
 }
Beispiel #2
0
 protected override void DeleteCurrent()
 {
     db.boring_bar.Remove(SelectedBoringBar.TheEntity);
     BoringBars.Remove(SelectedBoringBar);
     RaisePropertyChanged("BoringBars");
     CommitUpdates();
     selectedEntity = null;
 }
Beispiel #3
0
        protected override void DeleteCurrent()
        {
            int NumDocs = NumberOfAssignedDocuments();

            if (NumDocs > 0)
            {
                ShowUserMessage(string.Format("Nie można usunąć. Powiązane z {0} świadectwami", NumDocs));
            }
            else
            {
                db.boring_bar.Remove(SelectedBoringBar.TheEntity);
                BoringBars.Remove(SelectedBoringBar);
                RaisePropertyChanged("BoringBars");
                CommitUpdates();
                selectedEntity = null;
            }
        }