Beispiel #1
0
        public static int GetParameterValue(this IProductionSchemaViewModel ps, string parameterName)
        {
            var pe = ps.GetParameterEntry(parameterName);

            if (pe == null)
            {
                return(-1);
            }

            return(pe.Value);
        }
Beispiel #2
0
        public static void CopyValuesFrom(this IProductionSchemaViewModel target, IProductionSchemaViewModel source)
        {
            target.Index            = source.Index;
            target.Name             = source.Name;
            target.Comment          = source.Comment;
            target.IsActive         = source.IsActive;
            target.ModifiedDateTime = source.ModifiedDateTime;
            target.DownloadDateTime = source.DownloadDateTime;

            target.ParameterEntries
            .CopyValuesFrom <IParameterEntryViewModel, IParameterEntryViewModel>(source.ParameterEntries,
                                                                                 (t, s) => t.CopyValuesFrom(s));
        }
        private void UpdateSchema(IProductionSchemaViewModel schema)
        {
            if (schema == null)
            {
                //TODO
                return;
            }

            Schema.Id = schema.Id;
            Schema.CopyValuesFrom(schema);

            foreach (var pe in Schema.ParameterEntries)
            {
                var pm = MachineConfigProvider.MachineConfig.GetParameterMetadata(pe.Name);
                pe.Description        = pm.Description;
                pe.GroupName          = pm.GroupName;
                pe.GroupDescription   = pm.GroupDescription;
                pe.CatalogName        = pm.CatalogName;
                pe.CatalogDescription = pm.CatalogDescription;
            }

            //
            var parameterEntryViewModels = Schema.ParameterEntries.Where(x => x.CatalogName == "Common").ToList();

            CommonParameterEntriesCollectionView = parameterEntryViewModels.GetDefaultCollectionView();
            CommonParameterEntriesCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("GroupDescription"));

            //
            var entryViewModels = Schema.ParameterEntries.Where(x => x.CatalogName == "MV").ToList();

            MVParameterEntriesCollectionView = entryViewModels.GetDefaultCollectionView();
            MVParameterEntriesCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("GroupDescription"));

            //
            var viewModels = Schema.ParameterEntries.Where(x => x.CatalogName == "ME").ToList();

            PLCParameterEntriesCollectionView = viewModels.GetDefaultCollectionView();
            PLCParameterEntriesCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("GroupDescription"));
        }
Beispiel #4
0
 public static void SetParameterValue(this IProductionSchemaViewModel ps,
                                      string parameterName, int value)
 {
     ps.GetParameterEntry(parameterName).Value = value;
 }
Beispiel #5
0
 public static IParameterEntryViewModel GetParameterEntry(this IProductionSchemaViewModel ps,
                                                          string parameterName)
 {
     return(ps.ParameterEntries.SingleOrDefault(x => x.Name == parameterName));
 }
Beispiel #6
0
        public static ProductionSchema ToEntity(this IProductionSchemaViewModel vm)
        {
            var dto = vm.Map <IProductionSchemaViewModel, ProductionSchema>();

            return(dto);
        }