private void LoadOrClear()
 {
     if (size != null && !(Commentaries.Any() && Materials.Any() && Pribors.Any()))
     {
         using (var db = new SmetaApplication.DbContexts.SmetaDbAppContext())
         {
             Materials.Clear();
             db.MaterialGroups.Where(x => x.WorkId == Id).ToList().ForEach(x =>
             {
                 Materials.Add(new MaterialGroupDemView(x, diff + 1));
             });
             Pribors.Clear();
             db.PriborGroups.Where(x => x.WorkId == Id).ToList().ForEach(x =>
             {
                 Pribors.Add(new PriborGroupView(x));
             });
             Commentaries.Clear();
             db.Commentaries.Where(x => x.WorkSectionId == WorkSectionId).ToList().ForEach(x =>
             {
                 Commentaries.Add(new CommentaryView(x));
             });
         }
     }
     else
     {
         Commentaries.Clear();
         Materials.Clear();
         Pribors.Clear();
     }
 }
Beispiel #2
0
 public void AddCommentary(Commentary commentary)
 {
     Commentaries.Add(commentary);
 }
Beispiel #3
0
 public void DeleteCommentary(Commentary commentary)
 {
     Commentaries.Remove(commentary);
 }
Beispiel #4
0
 public void IncomingCommentary(Message message)
 {
     Commentaries.Add(message);
 }