Ejemplo n.º 1
0
 public CustomaryUnit(string id,
                      string annotation,
                      string name,
                      DimensionalClass dimensionalClass,
                      ICollection <QuantityType> quantityTypes,
                      ConversionToBaseUnit conversionToBaseUnit)
     : base(id, annotation, name, dimensionalClass, quantityTypes)
 {
     ConversionToBaseUnit = conversionToBaseUnit;
 }
Ejemplo n.º 2
0
        public UnitOfMeasure(
            string id,
            string annotation,
            string name,
            DimensionalClass dimensionalClass,
            ICollection <QuantityType> quantityTypes)
        {
            Id         = id;
            Annotation = annotation;
            Name       = name;

            try
            {
                dimensionalClass.Units.Add(this);
                DimensionalClassId = dimensionalClass.Notation;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            DimensionalClass = dimensionalClass;

            UnitOfMeasureQuantityTypes = new List <UnitOfMeasureQuantityType>();
            foreach (var qt in quantityTypes)
            {
                var jObject = new UnitOfMeasureQuantityType
                {
                    UnitOfMeasureId = Id,
                    UnitOfMeasure   = this,
                    QuantityTypeId  = qt.Notation,
                    QuantityType    = qt
                };
                UnitOfMeasureQuantityTypes.Add(jObject);
                qt.UnitOfMeasureQuantityTypes.Add(jObject);
            }
        }