Exemplo n.º 1
0
        private static Ca.Infoway.Messagebuilder.PlatformDate AsDate(PhysicalQuantity physicalQuantity)
        {
            Domainvalue.UnitsOfMeasureCaseSensitive unit = (physicalQuantity == null) ? null
                    : physicalQuantity.Unit;
            BigDecimal value_ren = (physicalQuantity == null) ? null : physicalQuantity.Quantity;

            if (unit != null && unit is DateConverter)
            {
                return(new Ca.Infoway.Messagebuilder.PlatformDate(((DateConverter)unit)
                                                                  .ToMilliseconds((value_ren == null) ? 0 : System.Convert.ToInt32(value_ren))));
            }
            else if (unit != null)
            {
                DefaultTimeUnit timeUnit = DefaultTimeUnit.Lookup(unit.CodeValue); // lookup will ignore case
                return((timeUnit == null) ? null : new Ca.Infoway.Messagebuilder.PlatformDate(timeUnit
                                                                                              .ToMilliseconds(value_ren)));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructs a date diff from the given parameters.
 /// </summary>
 ///
 /// <param name="value">a value</param>
 /// <param name="unit">a unit</param>
 public DateDiff(int value_ren, Domainvalue.UnitsOfMeasureCaseSensitive unit)
     : this(new PhysicalQuantity(new BigDecimal(value_ren.ToString()), unit))
 {
 }