private void AddPropertyViewModels(AssetListViewModel viewModel, AssetType assetType, string parentName)
 {
     foreach (var property in assetType.Properties)
     {
         var fullName = parentName == null ? property.Name : new StringBuilder(parentName).Append(".").Append(property.Name).ToString();
         if (property.ValueType != null || property.UnitOfMeasurement != null)
             AddPropertyToViewModel(viewModel, property, fullName, null);
         if (property.Type != null)
         {
             if (!property.Type.HasUniqueIdentifier)
             {
                 AddPropertyViewModels(viewModel, property.Type, fullName);
             }
             else
             {
                 var possibleValues = AssetService.GetAllAssetsByAssetType(property.Type).Select(x => new SelectListItem()
                     {
                         Value = x.UniqueIdentifier,
                         Text = x.UniqueIdentifier
                     });
                 AddPropertyToViewModel(viewModel, property, fullName, possibleValues);
             }
         }
     }
 }
Beispiel #2
0
        public Asset(AssetType type)
        {
            Type = type;
            PropertyValues = new List<AssetPropertyValue>();

            foreach (var assetProperty in type.Properties)
            {
                PropertyValues.Add(new AssetPropertyValue(this, assetProperty));
            }
        }
Beispiel #3
0
 public IEnumerable<Asset> GetAllAssetsByAssetType(AssetType type)
 {
     return AssetRepository.GetAll(type);
 }
Beispiel #4
0
 public Asset FindAsset(AssetType assetType, string uniqueIdentifier)
 {
     return AssetRepository.Find(assetType, uniqueIdentifier);
 }