public void AddOrUpdateAgency(Guid agencyId, string agencyName) { if (string.IsNullOrWhiteSpace(agencyName)) { return; } if (agencyId == Guid.Empty) { agencyId = Guid.NewGuid(); } if (_agencies.ContainsKey(agencyId)) { _agencies[agencyId].AgencyName = agencyName; } else { _agencies[agencyId] = new AgencyInfo(agencyId, agencyName); } MarkChangesMade(); }
public void AddOrUpdateAgency(Guid agencyId, string agencyName) { if (string.IsNullOrWhiteSpace(agencyName)) return; if (agencyId == Guid.Empty) agencyId = Guid.NewGuid(); if (_agencies.ContainsKey(agencyId)) { _agencies[agencyId].AgencyName = agencyName; } else { _agencies[agencyId] = new AgencyInfo(agencyId, agencyName); } MarkChangesMade(); }
internal bool LoadInfoFromNode(System.Xml.XmlNode xNode) { bool bChangesMade = false; switch (xNode.Name.ToLower()) { case "agencies": { foreach (XmlNode xAgency in xNode.ChildNodes) { Guid agencyId = GetGuidAttribute(xAgency.Attributes["AgencyId"]); if (agencyId == Guid.Empty) { agencyId = Guid.NewGuid(); bChangesMade = true; } string agencyName = GetAttributeText(xAgency.Attributes["AgencyName"]); _agencies[agencyId] = new AgencyInfo(agencyId, agencyName); } break; } case "units": { foreach (XmlNode xUnit in xNode.ChildNodes) { Guid unitKeyId = GetGuidAttribute(xUnit.Attributes["UnitKeyId"]); if (unitKeyId == Guid.Empty) { unitKeyId = Guid.NewGuid(); bChangesMade = true; } Guid agencyId = GetGuidAttribute(xUnit.Attributes["AgencyId"]); string unitName = GetAttributeText(xUnit.Attributes["UnitName"]); _units[unitKeyId] = new UnitInfo(unitKeyId, agencyId, unitName); } break; } case "radios": { foreach (XmlNode xRadio in xNode.ChildNodes) { Guid agencyId = GetGuidAttribute(xRadio.Attributes["AgencyId"]); Guid unitKeyId = GetGuidAttribute(xRadio.Attributes["UnitKeyId"]); string signalingFormat = GetAttributeText(xRadio.Attributes["SignalingFormat"]); string signalingUnitId = GetAttributeText(xRadio.Attributes["SignalingUnitId"]); string radioName = GetAttributeText(xRadio.Attributes["RadioName"]); string roleName = GetAttributeText(xRadio.Attributes["RoleName"]); string personnelName = GetAttributeText(xRadio.Attributes["PersonnelName"]); RadioTypeCode radioType = GetEnumAttribute <RadioTypeCode>(xRadio.Attributes["RadioType"], RadioTypeCode.Unknown); string firstHeardSource = GetAttributeText(xRadio.Attributes["FirstHeardSource"]); bool excludeFromRollcall = GetBoolAttribute(xRadio.Attributes["ExcludeFromRollcall"]); RadioInfo radioInfo = new RadioInfo(unitKeyId, agencyId, signalingFormat, signalingUnitId, radioName, roleName, personnelName, radioType, firstHeardSource, excludeFromRollcall); _radios[radioInfo.SignalingLookupKey] = radioInfo; } break; } } return(bChangesMade); }
internal bool LoadInfoFromNode(System.Xml.XmlNode xNode) { bool bChangesMade = false; switch (xNode.Name.ToLower()) { case "agencies": { foreach (XmlNode xAgency in xNode.ChildNodes) { Guid agencyId = GetGuidAttribute(xAgency.Attributes["AgencyId"]); if (agencyId == Guid.Empty) { agencyId = Guid.NewGuid(); bChangesMade = true; } string agencyName = GetAttributeText(xAgency.Attributes["AgencyName"]); _agencies[agencyId] = new AgencyInfo(agencyId, agencyName); } break; } case "units": { foreach (XmlNode xUnit in xNode.ChildNodes) { Guid unitKeyId = GetGuidAttribute(xUnit.Attributes["UnitKeyId"]); if (unitKeyId == Guid.Empty) { unitKeyId = Guid.NewGuid(); bChangesMade = true; } Guid agencyId = GetGuidAttribute(xUnit.Attributes["AgencyId"]); string unitName = GetAttributeText(xUnit.Attributes["UnitName"]); _units[unitKeyId] = new UnitInfo(unitKeyId, agencyId, unitName); } break; } case "radios": { foreach (XmlNode xRadio in xNode.ChildNodes) { Guid agencyId = GetGuidAttribute(xRadio.Attributes["AgencyId"]); Guid unitKeyId = GetGuidAttribute(xRadio.Attributes["UnitKeyId"]); string signalingFormat = GetAttributeText(xRadio.Attributes["SignalingFormat"]); string signalingUnitId = GetAttributeText(xRadio.Attributes["SignalingUnitId"]); string radioName = GetAttributeText(xRadio.Attributes["RadioName"]); string roleName = GetAttributeText(xRadio.Attributes["RoleName"]); string personnelName = GetAttributeText(xRadio.Attributes["PersonnelName"]); RadioTypeCode radioType = GetEnumAttribute<RadioTypeCode>(xRadio.Attributes["RadioType"], RadioTypeCode.Unknown); string firstHeardSource = GetAttributeText(xRadio.Attributes["FirstHeardSource"]); bool excludeFromRollcall = GetBoolAttribute(xRadio.Attributes["ExcludeFromRollcall"]); RadioInfo radioInfo = new RadioInfo(unitKeyId, agencyId, signalingFormat, signalingUnitId, radioName, roleName, personnelName, radioType, firstHeardSource, excludeFromRollcall); _radios[radioInfo.SignalingLookupKey] = radioInfo; } break; } } return bChangesMade; }