public async Task <bool> MeterHasContract(int meterID) { meter = new MeterSoapClient(basicHttpBinding, basicendpoint); MeterInfo meterInfo = await meter.GetMeterAsync(meterID); return(await Task.FromResult(meterInfo.CostTariffID != 0)); }
public async Task <double> GetCorrectionFactor(int meterID) { meter = new MeterSoapClient(basicHttpBinding, basicendpoint); MeterInfo meterInfo = await meter.GetMeterAsync(meterID); return(await Task.FromResult(meterInfo.CorrectionFactor > 0?meterInfo.CorrectionFactor : 1)); }
public async Task GetMetersForSiteId(int?siteID) { Meters = new List <Models.Meter>(); meter = new MeterSoapClient(basicHttpBinding, basicendpoint); //meter.CookieContainer = cookieContainer; DataSet meterDataSet = new DataSet(); if (siteID.HasValue) { ArrayOfXElement elements = await meter.GetMetersForSiteIDAsync(siteID.Value); meterDataSet = new DataSet(); meterDataSet.ReadXml(new System.IO.StringReader(elements.ToString())); } else { ArrayOfXElement elements = await meter.GetMetersAsync(); meterDataSet = new DataSet(); meterDataSet.ReadXml(new System.IO.StringReader(elements.ToString())); } foreach (DataRow row in meterDataSet.Tables[0].Rows) { bool Enabled = false; bool.TryParse(row["Enabled"].ToString(), out Enabled); bool AMR = false; bool.TryParse(row["AMR"].ToString(), out AMR); Meters.Add(new Models.Meter { AMR = AMR, ContractNumber = row["ContractNumber"].ToString(), DataImportCode = row["DataImportCode"].ToString(), Enabled = Enabled, MeterCode = row["MeterCode"].ToString(), MeterID = int.Parse(row["MeterID"].ToString()), MeterNumber = row["MeterNumber"].ToString(), MeterPrefix = row["MeterPrefix"].ToString(), MeterReadFrequency = row["MeterReadFrequency"].ToString(), MeterType = row["MeterType"].ToString(), MeterTypeID = int.Parse(row["MeterTypeID"].ToString()), Name = row["Name"].ToString(), ParentID = int.Parse(row["ParentID"].ToString()), ParentTypeID = int.Parse(row["ParentTypeID"].ToString()), SerialNumber = row["SerialNumber"].ToString(), SiteMeterCode = row["SiteMeterCode"].ToString(), TypeID = int.Parse(row["TypeID"].ToString()), }); } await Task.FromResult(1); }
public async Task <MeterInfo> GetMeterDetails(int meterID) { meter = new MeterSoapClient(basicHttpBinding, basicendpoint); return(await meter.GetMeterAsync(meterID)); }
public async Task <string> GetSiteMeterCodeForMeter(int meterID) { meter = new MeterSoapClient(basicHttpBinding, basicendpoint); return(await meter.GetSiteCodeForMeterAsync(meterID)); }