예제 #1
0
 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);
             }
         }
     }
 }
예제 #2
0
        public Asset(AssetType type)
        {
            Type = type;
            PropertyValues = new List<AssetPropertyValue>();

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