Пример #1
0
        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));
        }
Пример #2
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));
        }
Пример #3
0
        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);
        }
Пример #4
0
 public async Task <MeterInfo> GetMeterDetails(int meterID)
 {
     meter = new MeterSoapClient(basicHttpBinding, basicendpoint);
     return(await meter.GetMeterAsync(meterID));
 }
Пример #5
0
 public async Task <string> GetSiteMeterCodeForMeter(int meterID)
 {
     meter = new MeterSoapClient(basicHttpBinding, basicendpoint);
     return(await meter.GetSiteCodeForMeterAsync(meterID));
 }