public void AddPropertyToAssetType(string assetTypeName, AssetProperty property)
 {
     var assetType = AssetTypeRepository.Find(assetTypeName);
     assetType.AddProperty(property);
     AssetTypeRepository.Update(assetType);
     UnitOfWork.Commit();
 }
Example #2
0
 private static void AddPropertyToViewModel(AssetListViewModel viewModel, AssetProperty property, string fullName, IEnumerable<SelectListItem> possibleValues)
 {
     viewModel.AddProperty(new AssetPropertyViewModel()
         {
             Name = property.Name,
             FullName = fullName,
             Property = property,
             PossibleValues = possibleValues
         });
 }
        public AssetPropertyValue(Asset asset, AssetProperty property)
        {
            Asset = asset;
            Property = property;

            if (property.Type != null)
            {
                if (property.IsCollection)
                {
                    AssetValues = new List<Asset>();
                }
                else
                {
                    AssetValue = new Asset(property.Type);
                }
            }
        }
 public ActionResult AddProperty(string name, string propertyName, bool propertyIsUniqueIdentifier, string optionsPropertyType, string selectedSystemValueType, string selectedUnitOfMeasurement, string selectedAssetType)
 {
     var property = new AssetProperty {Name = propertyName, IsUniqueIdentifier = propertyIsUniqueIdentifier};
     if (optionsPropertyType == "optionSystemValueType")
     {
         property.ValueType = (SystemTypes) Enum.Parse(typeof (SystemTypes), selectedSystemValueType);
     }
     else if (optionsPropertyType == "optionUnitOfMeasurement")
     {
         property.UnitOfMeasurement = UnitOfMeasurementService.FindUnitOfMeasurementByName(selectedUnitOfMeasurement);
     }
     else if (optionsPropertyType == "optionAssetType")
     {
         property.Type = AssetTypeService.FindAssetTypeByName(selectedAssetType);
     }
     AssetTypeService.AddPropertyToAssetType(name, property);
     return RedirectToAction("Index");
 }
Example #5
0
 public void AddProperty(AssetProperty property)
 {
     Properties.Add(property);
 }