Esempio n. 1
0
        public override void SetProperty(Property property)
        {
            switch (property.Id)
            {
            case ModelCode.PRODUCTASSETMODEL_CSTANDARDKIND:
                corporateStandardKind = (CorporateStandardKind)property.AsEnum();
                break;

            case ModelCode.PRODUCTASSETMODEL_MANUFACTURER:
                manufacturer = property.AsReference();
                break;

            case ModelCode.PRODUCTASSETMODEL_MODELNUMBER:
                modelNumber = property.AsString();
                break;

            case ModelCode.PRODUCTASSETMODEL_MODELVERSION:
                modelVersion = property.AsString();
                break;

            case ModelCode.PRODUCTASSETMODEL_USAGEKIND:
                usageKind = (AssetModelUsageKind)property.AsEnum();
                break;

            case ModelCode.PRODUCTASSETMODEL_WEIGHTTOTAL:
                weightTotal = property.AsFloat();
                break;

            default:
                base.SetProperty(property);
                break;
            }
        }
Esempio n. 2
0
        public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType)
        {
            if ((value == null))
            {
                return(null);
            }
            AssetModelUsageKind valueCasted = ((AssetModelUsageKind)(value));

            if ((valueCasted == AssetModelUsageKind.Streetlight))
            {
                return("streetlight");
            }
            if ((valueCasted == AssetModelUsageKind.Other))
            {
                return("other");
            }
            if ((valueCasted == AssetModelUsageKind.Substation))
            {
                return("substation");
            }
            if ((valueCasted == AssetModelUsageKind.CustomerSubstation))
            {
                return("customerSubstation");
            }
            if ((valueCasted == AssetModelUsageKind.DistributionUnderground))
            {
                return("distributionUnderground");
            }
            if ((valueCasted == AssetModelUsageKind.DistributionOverhead))
            {
                return("distributionOverhead");
            }
            if ((valueCasted == AssetModelUsageKind.Transmission))
            {
                return("transmission");
            }
            if ((valueCasted == AssetModelUsageKind.Unknown))
            {
                return("unknown");
            }
            throw new ArgumentOutOfRangeException("value");
        }