Ejemplo n.º 1
0
        public static PeriodicIntervalTime CreateFromPivlR2(PeriodicIntervalTimeR2 pivlR2)
        {
            DateDiff       dateDiff       = (pivlR2.Period == null ? null : new DateDiff(pivlR2.Period));
            Representation representation = pivlR2.Period != null || pivlR2.Phase != null ? Representation.PERIOD_PHASE : Representation.FREQUENCY;

            return(new PeriodicIntervalTime(dateDiff, pivlR2.Phase, pivlR2.FrequencyRepetitions, pivlR2.FrequencyQuantity, representation));
        }
Ejemplo n.º 2
0
 private bool Equals(DateDiff that)
 {
     return(new EqualsBuilder().AppendSuper(base.Equals(that))
            .Append(this.value_ren, that.value_ren)
            .Append(this.quantity, that.quantity)
            .IsEquals());
 }
Ejemplo n.º 3
0
 protected PeriodicIntervalTime(DateDiff period_0, Interval <Ca.Infoway.Messagebuilder.PlatformDate> phase_1,
                                Int32?repetitions_2, PhysicalQuantity quantity_3,
                                Representation representation_4)
 {
     this.period         = period_0;
     this.phase          = phase_1;
     this.repetitions    = repetitions_2;
     this.quantity       = quantity_3;
     this.representation = representation_4;
 }
Ejemplo n.º 4
0
        public static PeriodicIntervalTimeR2 CreateFromPivlR1(PeriodicIntervalTime pivlR1)
        {
            DateDiff                period   = pivlR1.Period;
            PhysicalQuantity        periodPq = (period != null ? period.ValueAsPhysicalQuantity : null);
            Interval <PlatformDate> phase    = pivlR1.Phase;
            PhysicalQuantity        quantity = pivlR1.Quantity;
            Int32?repetitions = pivlR1.Repetitions;

            return(new PeriodicIntervalTimeR2(phase, periodPq, null, null, repetitions, quantity));
        }
Ejemplo n.º 5
0
 private PeriodicIntervalTimeSk(DateDiff period_0, Interval <Ca.Infoway.Messagebuilder.PlatformDate> phase_1,
                                Int32?repetitions_2, Interval <PhysicalQuantity> quantity_3,
                                Representation representation_4) : base(period_0, phase_1, repetitions_2, null, representation_4)
 {
     this.quantitySk = quantity_3;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructs a PeriodicIntervalTime using the supplied parameters.
 /// </summary>
 ///
 /// <param name="period_0">DateDiff period</param>
 /// <param name="phase_1">phase Interval</param>
 /// <returns>the constructed PeriodicIntervalTime</returns>
 public static PeriodicIntervalTime CreatePeriodPhase(DateDiff period_0,
                                                      Interval <Ca.Infoway.Messagebuilder.PlatformDate> phase_1)
 {
     Ca.Infoway.Messagebuilder.Validate.NotNull(phase_1);
     return(new PeriodicIntervalTime(period_0, phase_1, null, null, Representation.PERIOD_PHASE));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Constructs a PeriodicIntervalTime using the supplied parameters.
 /// </summary>
 ///
 /// <param name="period_0">DateDiff period</param>
 /// <returns>the constructed PeriodicIntervalTime</returns>
 public static PeriodicIntervalTime CreatePeriod(DateDiff period_0)
 {
     Ca.Infoway.Messagebuilder.Validate.NotNull(period_0);
     return(new PeriodicIntervalTime(period_0, null, null, null, Representation.PERIOD));
 }
Ejemplo n.º 8
0
        private static Ca.Infoway.Messagebuilder.PlatformDate AddDate(Ca.Infoway.Messagebuilder.PlatformDate date, DateDiff diff)
        {
            if (diff.UnitValue == null || diff.Unit == null)
            {
                return(AddDate(date, (Diff <Ca.Infoway.Messagebuilder.PlatformDate>)diff));
            }
            else
            {
                DateTime dt = date;

                if (Ca.Infoway.Messagebuilder.Datatype.Lang.DateDiff.SECOND.Equals(diff.Unit.CodeValue))
                {
                    dt = dt.AddSeconds((double)(diff.UnitValue.Value));
                }
                else if (Ca.Infoway.Messagebuilder.Datatype.Lang.DateDiff.MINUTE.Equals(diff.Unit.CodeValue))
                {
                    dt = dt.AddMinutes((double)(diff.UnitValue.Value));
                }
                else if (Ca.Infoway.Messagebuilder.Datatype.Lang.DateDiff.HOUR.Equals(diff.Unit.CodeValue))
                {
                    dt = dt.AddHours((double)(diff.UnitValue.Value));
                }
                else if (Ca.Infoway.Messagebuilder.Datatype.Lang.DateDiff.DAY.Equals(diff.Unit.CodeValue))
                {
                    dt = dt.AddDays((double)(diff.UnitValue.Value));
                }
                else if (Ca.Infoway.Messagebuilder.Datatype.Lang.DateDiff.WEEK.Equals(diff.Unit.CodeValue))
                {
                    dt = dt.AddDays((double)(diff.UnitValue.Value * 7));
                }
                else if (Ca.Infoway.Messagebuilder.Datatype.Lang.DateDiff.MONTH.Equals(diff.Unit.CodeValue))
                {
                    dt = dt.AddMonths(diff.UnitValue.Value);
                }
                else if (Ca.Infoway.Messagebuilder.Datatype.Lang.DateDiff.YEAR.Equals(diff.Unit.CodeValue))
                {
                    dt = dt.AddYears(diff.UnitValue.Value);
                }

                return(new Ca.Infoway.Messagebuilder.PlatformDate(dt));
            }
        }