Example #1
0
 /// <summary>
 /// Load all object types defined in tblObjectTypes table (This is project independent
 /// </summary>
 public void Load()
 {
     using (EDBEntities eDB = new EDBEntities())
     {
         foreach (tblAspect Rec in (from a in eDB.tblAspects where (a.Project_ID == Globals.Project_ID) orderby a.AspectName select a))
         {
             AspectModel aspectItem = new AspectModel
             {
                 ID          = Rec.ID,
                 AspectName  = Rec.AspectName,
                 Description = Rec.Description,
                 HardIO      = Rec.HardIO.GetValueOrDefault(),
                 ExtIO       = Rec.ExtIO.GetValueOrDefault(),
                 PLCTag      = Rec.PLCTag.GetValueOrDefault(),
                 SCADATag    = Rec.SCADATag.GetValueOrDefault(),
                 AlarmTag    = Rec.AlarmTag.GetValueOrDefault(),
                 TrendTag    = Rec.TrendTag.GetValueOrDefault(),
                 Note        = Rec.Note
             };
             Aspects.Add(aspectItem);
         }
     }
 }
Example #2
0
        public void Add()
        {
            // Instanciate a new object
            AspectModel aspectItem = new AspectModel
            {
                ID          = Guid.NewGuid(),
                Project_ID  = Globals.Project_ID,
                AspectName  = "New Aspect",
                Description = "New Aspect Description",
                HardIO      = false,
                ExtIO       = false,
                PLCTag      = false,
                SCADATag    = false,
                AlarmTag    = false,
                TrendTag    = false,
                Note        = "",
                IsChanged   = false,
                IsNew       = true,
            };

            // If no item has been selected, put the object in the root of the tree
            Aspects.Add(aspectItem);
            IsChanged = true;
        }