Exemple #1
0
        /// <summary>
        /// [재난 종류] 기상특보 정보로부터 관련 재난 종류 정보를 취득
        /// </summary>
        /// <param name="swrKindCode"></param>
        /// <param name="swrStressCode"></param>
        /// <returns></returns>
        public static DisasterKind FindDisasterKindBySWRInfo(string swrKindCode, string swrStressCode)
        {
            System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(swrKindCode));
            System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(swrStressCode));

            DisasterKind result = null;

            if (swrDisasterMatchingInfo == null)
            {
                return(null);
            }
            foreach (SWRDisasterMatching info in swrDisasterMatchingInfo)
            {
                if (info == null)
                {
                    continue;
                }
                if (info.SwrKindCode == swrKindCode && info.SwrStressCode == swrStressCode)
                {
                    result = FindDisasterKindByCode(info.DisasterKindCode);
                    break;
                }
            }

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// [재난 종류]
        /// </summary>
        /// <param name="warnKindCode"></param>
        /// <returns></returns>
        public static DisasterKind FindDisasterKindByCode(string kindCode)
        {
            DisasterKind result = null;

            if (disasterInfo == null)
            {
                return(null);
            }
            foreach (DisasterInfo info in disasterInfo)
            {
                if (info == null || info.KindList == null)
                {
                    continue;
                }
                foreach (DisasterKind kind in info.KindList)
                {
                    if (kind.Code == kindCode)
                    {
                        DisasterKind copy = new DisasterKind();
                        copy.DeepCopyFrom(kind);
                        return(copy);
                    }
                }
            }

            return(result);
        }
        public void DeepCopyFrom(DisasterInfo src)
        {
            this.category = null;
            this.kindList = null;

            if (src == null)
            {
                return;
            }
            if (src.category != null)
            {
                this.category = new DisasterCategory();
                this.category.DeepCopyFrom(src.category);
            }
            if (src.kindList == null)
            {
                this.kindList = null;
                return;
            }
            this.kindList = new List <DisasterKind>();
            foreach (DisasterKind kind in src.kindList)
            {
                DisasterKind copy = new DisasterKind();
                copy.DeepCopyFrom(kind);

                this.kindList.Add(copy);
            }
        }
Exemple #4
0
        public static string GetDisplayStringDisasterKindName(string disasterKindCode)
        {
            System.Diagnostics.Debug.Assert(disasterKindCode != null);

            DisasterKind kind = BasisData.FindDisasterKindByCode(disasterKindCode);

            if (kind == null || kind.Name == null)
            {
                return("Unknown(" + disasterKindCode + ")");
            }
            return(kind.Name);
        }
        public bool Initialize()
        {
            if (this == null)
            {
                return(false);
            }

            if (this.Category == null)
            {
                this.Category = new DisasterCategory();
            }
            if (this.Kind == null)
            {
                this.Kind = new DisasterKind();
            }

            return(true);
        }
 public void DeepCopyFrom(DisasterKind src)
 {
     this.categoryID = src.categoryID;
     this.code       = src.code;
     this.name       = src.name;
 }
 public Disaster(DisasterCategory category, DisasterKind kind)
 {
     this.category = category;
     this.kind     = kind;
 }
Exemple #8
0
        public string GetHeadlineString()
        {
            if (this == null)
            {
                return(string.Empty);
            }

            try
            {
                CAPHelper     helper      = new CAPHelper();
                StringBuilder headline    = new StringBuilder();
                string        association = string.Empty;

                if (this.LocationKind == OrderLocationKind.Other)
                {
                    association = "[연계] ";
                }

                CAP    msg            = new CAP(this.CapText);
                string headlineNormal = helper.MakeHeadline(msg);
                if (string.IsNullOrEmpty(headlineNormal))
                {
                    headline.Append(headlineNormal);
                }

                if (headline.Length < 1)
                {
                    OrderMode mode = BasisData.FindOrderModeInfoByCode(this.OrderMode);
                    if (mode == null)
                    {
                        headline.Append(this.OrderedTime + " [ Unknown ]");
                    }
                    else
                    {
                        headline.Append(this.OrderedTime + " [" + mode.Name + "]");
                    }

                    string targets = helper.ExtractTargetNamesFromCAP(msg);
                    if (!string.IsNullOrEmpty(targets))
                    {
                        headline.Append("[" + targets.Replace(',', '/') + "] 대상으로");
                    }
                    else
                    {
                        headline.Append("[ Unknown ] 대상으로");
                    }

                    string disasterName = "Unknown";
                    if (msg.Info != null && msg.Info.Count > 0)
                    {
                        disasterName = msg.Info[0].Event;
                    }
                    else
                    {
                        DisasterKind disasterKind = BasisData.FindDisasterKindByCode(this.DisasterKindCode);
                        if (disasterKind != null)
                        {
                            disasterName = disasterKind.Name;
                        }
                    }

                    headline.Append(" [" + disasterName + "]");
                    headline.Append(" 발령");

                    if (this.RefType == OrderReferenceType.Cancel)
                    {
                        headline.Append(" 취소");
                    }
                }

                return(association + headline.ToString());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("[OrderInfo] GetHeadlineString( Exception=[" + ex.ToString() + "] )");
                FileLogManager.GetInstance().WriteLog("[OrderInfo] GetHeadlineString ( Exception=[" + ex.ToString() + "] )");

                return(string.Empty);
            }
        }