private static void LoadRemoteSourceImpedanceAttributes(SourceImpedance sourceImpedance, XElement impedancesElement) { object rSrc = (string)impedancesElement.Element("RRem"); object xSrc = (string)impedancesElement.Element("XRem"); if (rSrc != null && xSrc != null) { sourceImpedance.RSrc = Convert.ToDouble(rSrc); sourceImpedance.XSrc = Convert.ToDouble(xSrc); } }
private void SyncSourceImpedance(string address, int meterLocationLineID) { // ensure remote and local line impedance matches SourceImpedance local = DataContext.Table <SourceImpedance>().QueryRecordWhere("MeterLocationLineID = {0}", meterLocationLineID); SourceImpedance remote = (SourceImpedance)WebAPIHub.GetRecordsWhere(address, "SourceImpedance", $"MeterLocationLineID = {meterLocationLineID}").FirstOrDefault(); // if there is a local record but not a remote record if (local != null && remote == null) { JObject record = new JObject(); record.Add("MeterLocationLineID", meterLocationLineID); record.Add("RSrc", local.RSrc); record.Add("XSrc", local.XSrc); WebAPIHub.CreateRecord(address, "LineImpedance", record); } }