public static string RadioTypeCodeToDisplayStr(RadioTypeCode? code) { if (code == null || !code.HasValue) return string.Empty; switch (code.Value) { case RadioTypeCode.Mobile: return "Mobile"; case RadioTypeCode.Portable: return "Portable"; case RadioTypeCode.BaseStation: return "Base Station"; default: return string.Empty; } }
public RadioInfo(Guid unitKeyId, Guid agencyKeyId, string signalingFormat, string signalingUnitId, string radioName, string roleName, string personnelName, RadioTypeCode radioType, string firstHeardSourceName, bool excludeFromRollcall) { this.UnitKeyId = unitKeyId; this.AgencyKeyId = agencyKeyId; this.SignalingFormat = signalingFormat; this.SignalingUnitId = signalingUnitId; this.RadioName = radioName; this.RoleName = roleName; this.PersonnelName = personnelName; this.RadioType = radioType; this.FirstHeardSourceName = firstHeardSourceName; this.ExcludeFromRollCall = excludeFromRollcall; }
public void AddOrUpdateRadio(Guid unitKeyId, Guid agencyKeyId, string signalingFormat, string signalingUnitId, string radioName, string roleName, string personnelName, RadioTypeCode radioType, bool excludeFromRollCall) { if (string.IsNullOrWhiteSpace(signalingUnitId) || string.IsNullOrWhiteSpace(signalingFormat)) { return; } string strKey = RadioInfo.GenerateLookupKey(signalingFormat, signalingUnitId); if (_radios.ContainsKey(strKey)) { _radios[strKey].UnitKeyId = unitKeyId; _radios[strKey].AgencyKeyId = agencyKeyId; _radios[strKey].SignalingFormat = signalingFormat; _radios[strKey].SignalingUnitId = signalingUnitId; _radios[strKey].RadioName = radioName; _radios[strKey].RoleName = roleName; _radios[strKey].PersonnelName = personnelName; _radios[strKey].RadioType = radioType; _radios[strKey].ExcludeFromRollCall = excludeFromRollCall; } else { _radios[strKey] = new RadioInfo(unitKeyId, agencyKeyId, signalingFormat, signalingUnitId, radioName, roleName, personnelName, radioType, "MANUAL ENTRY", excludeFromRollCall); } 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); }
public void AddOrUpdateRadio(Guid unitKeyId, Guid agencyKeyId, string signalingFormat, string signalingUnitId, string radioName, string roleName, string personnelName, RadioTypeCode radioType, bool excludeFromRollCall) { if (string.IsNullOrWhiteSpace(signalingUnitId) || string.IsNullOrWhiteSpace(signalingFormat)) return; string strKey = RadioInfo.GenerateLookupKey(signalingFormat, signalingUnitId); if (_radios.ContainsKey(strKey)) { _radios[strKey].UnitKeyId = unitKeyId; _radios[strKey].AgencyKeyId = agencyKeyId; _radios[strKey].SignalingFormat = signalingFormat; _radios[strKey].SignalingUnitId = signalingUnitId; _radios[strKey].RadioName = radioName; _radios[strKey].RoleName = roleName; _radios[strKey].PersonnelName = personnelName; _radios[strKey].RadioType = radioType; _radios[strKey].ExcludeFromRollCall = excludeFromRollCall; } else { _radios[strKey] = new RadioInfo(unitKeyId, agencyKeyId, signalingFormat, signalingUnitId, radioName, roleName, personnelName, radioType, "MANUAL ENTRY", excludeFromRollCall); } MarkChangesMade(); }