IEnumerable <Range <DateTimeOffset> > IExternalCandleSource.GetSupportedRanges(CandleSeries series)
 {
     if (UseExternalCandleSource && series.CandleType == typeof(TimeFrameCandle) && series.Arg is TimeSpan && (TimeSpan)series.Arg == MarketEmulator.Settings.UseCandlesTimeFrame)
     {
         yield return(new Range <DateTimeOffset>(StartDate, StopDate.EndOfDay()));
     }
 }
        public StopRequestViewModelValidator()
        {
            RuleFor(r => r.StopDate).Must((r, StopDate) => r.StopMonth.HasValue && r.StopYear.HasValue)
            .WithMessage("Enter the stop date for this apprenticeship")
            .Unless(r => r.StopYear.HasValue || r.StopMonth.HasValue);

            RuleFor(r => r.StopDate).Must(y => y.Year.HasValue)
            .WithMessage("Enter the stop date for this apprenticeship")
            .When(r => r.StopMonth.HasValue);

            RuleFor(r => r.StopDate).Must(y => y.Month.HasValue).WithMessage("Enter the stop date for this apprenticeship")
            .When(r => r.StopYear.HasValue);

            RuleFor(x => x.StopDate)
            .Must(y => y.IsValid).WithMessage($"The stop date must be a real date")
            .When(z => z.StopMonth.HasValue && z.StopYear.HasValue);

            RuleFor(r => r.StopDate)
            .Must((r, StopDate) => StopDate.IsEqualToOrAfterMonthYearOfDateTime(r.StartDate))
            .WithMessage(r => $"The stop date cannot be before the apprenticeship started")
            .When(r => r.StopDate.IsValid);

            RuleFor(r => r.StopDate)
            .Must((r, StopDate) => StopDate.IsNotInFutureMonthYear())
            .WithMessage(r => $"The stop date cannot be in the future")
            .When(r => r.StopDate.IsValid);
        }
Пример #3
0
 public void Validate()
 {
     Name.ValidateRequired("Name");
     OnsetDate.ValidateOptional("OnsetDate");
     Status.ValidateOptional("Status");
     StopDate.ValidateOptional("StopDate");
 }
 public void Validate()
 {
     Name.ValidateRequired("Name");
     GenericName.ValidateOptional("GenericName");
     Dose.ValidateOptional("Dose");
     Strength.ValidateOptional("Strength");
     Frequency.ValidateOptional("Frequency");
     Route.ValidateOptional("Route");
     Indication.ValidateOptional("Indication");
     StartDate.ValidateOptional("StartDate");
     StopDate.ValidateOptional("StopDate");
     Prescribed.ValidateOptional("Prescribed");
     Prescription.ValidateOptional("Prescription");
 }
Пример #5
0
        public override string ToString()
        {
            string returnString = "";

            if (DevEui != null)
            {
                returnString = returnString + "DevEui=" + DevEui;
            }
            else
            {
                returnString = returnString + "DevEui=" + "0018B22000003CC4";
            }

            if (CustomerIDs != null)
            {
                returnString = returnString + "&CustomerIDs=" + CustomerIDs;
            }

            if (UnitIDs != null)
            {
                returnString = returnString + "&UnitIDs=" + UnitIDs;
            }

            if (Columns != null)
            {
                returnString = returnString + "&Columns=" + Columns;
            }
            else
            {
                returnString = returnString + "&Columns=" + "%22PT=0,1%22";
            }

            if (StartDate != null)
            {
                returnString = returnString + "&StartDate=" + StartDate.ToString(@"yyyy-MM-dd\%HHmm:00");
            }

            if (StopDate != null)
            {
                returnString = returnString + "&StopDate=" + StopDate.ToString(@"yyyy-MM-dd\%HHmm:00");
            }

            if (LastValue != null)
            {
                returnString = returnString + "&LastValue";
            }

            return(returnString);
        }