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();
     }
 }
Ejemplo n.º 2
0
 public void AddCommentary(Commentary commentary)
 {
     Commentaries.Add(commentary);
 }
Ejemplo n.º 3
0
 public void IncomingCommentary(Message message)
 {
     Commentaries.Add(message);
 }