/// <summary>
        /// 특보 해당구역 코드 리스트에 해당하는 행정구역 지역코드 문자열(콤마로 구분된 연속된 문자열)을 반환.
        /// </summary>
        /// <returns></returns>
        public string[] GetTargetRegionCodes()
        {
            string[] targetAreaCodes = GetTargetAreaList();
            if (targetAreaCodes == null)
            {
                return(null);
            }

            List <string> targetRegionCodes = new List <string>();

            foreach (string areaCode in targetAreaCodes)
            {
                SWRAnnounceArea areaInfo = BasisData.FindSWRAreaByAreaCode(areaCode);
                if (areaInfo == null || areaInfo.TargetRegions == null)
                {
                    continue;
                }
                foreach (string regionCode in areaInfo.TargetRegions)
                {
                    if (targetRegionCodes.Contains(regionCode))
                    {
                        continue;
                    }
                    targetRegionCodes.Add(regionCode);
                }
            }

            return(targetRegionCodes.ToArray());
        }
        public void DeepCopyFrom(SWRAnnounceArea src)
        {
            System.Diagnostics.Debug.Assert(src != null);

            this.areaCode = src.areaCode;
            this.areaName = src.areaName;

            if (src.targetRegions == null)
            {
                this.targetRegions = null;
                return;
            }

            if (this.targetRegions == null)
            {
                this.targetRegions = new List <string>();
            }
            this.targetRegions.Clear();

            foreach (string regionCode in src.targetRegions)
            {
                string copy = regionCode;
                this.targetRegions.Add(copy);
            }
        }
Beispiel #3
0
        public static SWRAnnounceArea FindSWRAreaByAreaCode(string areaCode)
        {
            System.Diagnostics.Debug.Assert(areaCode != null);

            if (areaCode == null || swrAreaInfo == null)
            {
                return(null);
            }

            if (swrAreaInfo.ContainsKey(areaCode))
            {
                SWRAnnounceArea copy = new SWRAnnounceArea();
                copy.DeepCopyFrom(swrAreaInfo[areaCode]);
                return(copy);
            }

            return(null);
        }
        /// <summary>
        /// 특보 해당구역 코드 리스트를 구역명 문자열(콤마로 구분된 연속된 문자열)로 변환.
        /// </summary>
        /// <returns></returns>
        public string GetTargetAreaNames()
        {
            string[] targetAreaCodes = GetTargetAreaList();
            if (targetAreaCodes == null)
            {
                return(string.Empty);
            }

            List <string> regionNames = new List <string>();

            foreach (string areaCode in targetAreaCodes)
            {
                SWRAnnounceArea areaInfo = BasisData.FindSWRAreaByAreaCode(areaCode);
                if (areaInfo == null || areaInfo.TargetRegions == null)
                {
                    continue;
                }
                regionNames.Add(areaInfo.AreaName);
            }

            return(string.Join(",", regionNames));
        }