コード例 #1
0
        /// <summary>
        /// Returns previous meter readings
        /// </summary>
        /// <param name="from">From date</param>
        /// <param name="to">To date</param>
        /// <returns>List of meter readings</returns>
        public async Task <(bool, List <MeterReading>)> GetMeterReadings(DateTime from, DateTime to)
        {
            if ((to - from).TotalMilliseconds > 0)
            {
                return(await Task.Run(() =>
                {
                    var request = new MeterReadingsRequest
                    {
                        AccountNum = _config.CustomerId,
                        Fom = from,
                        ToDate = to,
                        UserContext = _config.Context,
                        AttachmentNum = "",
                        DeliveryCategory = ""
                    };

                    var response = _client.getMeterReadings(request);

                    return (true, response.MeterReadings.ToList());
                }));
            }
            else
            {
                //TODO: What happens here?
                return(false, default(List <MeterReading>));
            }
        }
コード例 #2
0
 public async Task <MeterReadingsResponse> GetMeterReadingsAsync(MeterReadingsRequest meterReadingsRequest)
 {
     return(await _mediator.ExecuteAsync <MeterReadingsRequest, MeterReadingsResponse>(meterReadingsRequest));
 }