BO4E.Extensions/BusinessObjects/Energiemenge/EnergiemengeExtensionCompleteness.cs
/// <summary>
///     Generate a <see cref="CompletenessReport" /> for the given refenrence time frame <paramref name="reference" />
/// </summary>
/// <param name="em">Energiemenge</param>
/// <param name="reference">reference time frame</param>
/// <returns></returns>
Generate a  for the given refenrence time frame
Generate a for the given refenrence time frame
public static CompletenessReport GetCompletenessReport(this BO.Energiemenge em, ITimeRange reference)
        {
            var combis = em.GetWevObisMeCombinations();
            if (combis.Count != 1)
            {
                string errorMessage;
                decimal? coverage;
                if (combis.Count == 0)
                {
                    errorMessage = "Cannot use autoconfigured method because there are no values.";
                    coverage = 0;
                }
                else
                {
                    errorMessage =
                        $"Cannot use autoconfigured method because there are {combis.Count}>1 distinct (wertermittlungsverfahren, obis, einheit) tuple present: {JsonConvert.SerializeObject(combis, new StringEnumConverter())}";
                    coverage = null;
                }
                return new CompletenessReport
                {
                    LokationsId = em.LokationsId,
                    ReferenceTimeFrame = new Zeitraum
                    {
                        Startdatum = new DateTimeOffset(reference.Start, TimeSpan.Zero),
                        Enddatum = new DateTimeOffset(reference.End, TimeSpan.Zero)
                    },
                    Coverage = coverage,
                    ErrorMessage = errorMessage
                };
            }
            var combi = combis.First();
            return em.GetCompletenessReport(reference, combi.Item1, combi.Item2, combi.Item3);
        }
public static CompletenessReport GetCompletenessReport ( this BO . Energiemenge em , ITimeRange reference ) { var combis = em . GetWevObisMeCombinations ( ) ; if ( combis . Count != 1 ) { string errorMessage ; decimal ? coverage ; if ( combis . Count == 0 ) { errorMessage = " " ; coverage = 0 ; } else { errorMessage = $" Cannot use autoconfigured method because there are  { combis . Count } >1 distinct (wertermittlungsverfahren, obis, einheit) tuple present:  { JsonConvert . SerializeObject ( combis , new StringEnumConverter ( ) ) } " ; coverage = null ; } return new CompletenessReport { LokationsId = em . LokationsId , ReferenceTimeFrame = new Zeitraum { Startdatum = new DateTimeOffset ( reference . Start , TimeSpan . Zero ) , Enddatum = new DateTimeOffset ( reference . End , TimeSpan . Zero ) } , Coverage = coverage , ErrorMessage = errorMessage } ; } var combi = combis . First ( ) ; return em . GetCompletenessReport ( reference , combi . Item1 , combi . Item2 , combi . Item3 ) ; }
Generate a  for the given refenrence time frame
Generate a for the given refenrence time frame
None
BO.Energiemenge
this
reference
ITimeRange
reference time frame
reference time frame
em
None