コード例 #1
0
 // model is basically not correct, so don't validate kz83 value
 static Lst <KzFieldError> ValidateKz83(KzFieldSet fieldSet, int fieldNumber) =>
 fieldSet.GetValue(fieldNumber).Map(x => x.GetDecimalValue())
 .Map(fieldValue => CalculateKz83(fieldSet)
      .Apply(
          estimatedValue => Math.Abs(fieldValue - estimatedValue.Value) > 0.01m
                     ? List(KzFieldError.MustBeCloseToValue(estimatedValue.Value, 0.01m))
                     : Lst <KzFieldError> .Empty))
 .IfNone(Lst <KzFieldError> .Empty);
コード例 #2
0
 public Kz83Calculator(KzFieldSet fieldSet)
 {
     this.fieldSet = fieldSet ?? throw new ArgumentNullException(nameof(fieldSet));
 }
コード例 #3
0
 static Money CalculateKz83(KzFieldSet fieldSet) =>
 new Kz83Calculator(fieldSet)
 .Calculate().IfFail(_ => throw new InvalidOperationException("Can't happen"));
コード例 #4
0
 UstvaKzFields(KzFieldSet fieldSet)
 {
     this.FieldSet = fieldSet;
 }