Ejemplo n.º 1
0
        public void DeepCopyFrom(OrderMode src)
        {
            System.Diagnostics.Debug.Assert(src != null);

            this.modeCode   = src.Code;
            this.modeString = src.Name;
        }
Ejemplo n.º 2
0
        public OrderProvisionInfo()
        {
            // [2016-03-31] 기본 발령 정보를 시험으로 생성 - by Gonzi
            //this.mode = BasisData.FindOrderModeInfoByCode(CAPLib.StatusType.Actual);
            this.mode        = BasisData.FindOrderModeInfoByCode(CAPLib.StatusType.Test);
            this.messageType = MsgType.Alert;
            this.scope       = ScopeType.Public;

            this.disaster          = new Disaster();
            this.disaster.Category = new DisasterCategory();
            this.disaster.Kind     = new DisasterKind();

            this.refType     = new OrderReferenceType();
            this.refRecordID = string.Empty;
            this.msgTextInfo = new SendingMsgTextInfo();

            this.targetRegions = new List <RegionDefinition>();
            this.targetSystems = new List <SASProfile>();
            this.circle        = new List <AdengGE.CircleInfo>();

            this.orderLocationKind = OrderLocationKind.Local;

            this.targetSystemsKinds = new List <SASKind>();

            this.tag = null;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// CAP 메시지를 기반으로 헤드라인 문자열 작성.
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public string MakeHeadline(CAP msg)
        {
            System.Diagnostics.Debug.Assert(msg != null);

            try
            {
                StringBuilder builder = new StringBuilder();
                foreach (InfoType msgInfo in msg.Info)
                {
                    if (msgInfo.Language.ToUpper() == BasisData.DEFAULT_LANGUAGECODE.ToUpper())
                    {
                        builder.Append(msgInfo.Headline);
                        break;
                    }
                }

                if (builder.Length < 1)
                {
                    OrderMode modeInfo = BasisData.FindOrderModeInfoByCode(msg.MessageStatus.Value);
                    if (modeInfo == null || string.IsNullOrEmpty(modeInfo.Name))
                    {
                        FileLogManager.GetInstance().WriteLog("[CAPInfo] MakeHeadline ( 헤드라인 정보 작성 실패. 모드 정보를 찾을 수 없습니다. )");
                        throw new Exception("[CAPInfo] 헤드라인 정보 작성 실패. 모드 정보를 찾을 수 없습니다.");
                    }

                    if (msg.Info == null || msg.Info.Count < 1 || string.IsNullOrEmpty(msg.Info[0].Event))
                    {
                        FileLogManager.GetInstance().WriteLog("[CAPInfo] MakeHeadline ( 헤드라인 정보 작성 실패. 이벤트 코드 정보를 찾을 수 없습니다. )");
                        throw new Exception("[CAPInfo] 헤드라인 정보 작성 실패. 이벤트 코드 정보를 찾을 수 없습니다.");
                    }
                    string disasterKindName = msg.Info[0].Event;

                    string targets = ExtractTargetNamesFromCAP(msg);
                    if (string.IsNullOrEmpty(targets))
                    {
                        FileLogManager.GetInstance().WriteLog("[CAPInfo] MakeHeadline ( 헤드라인 정보 작성 실패. 발령 대상 정보를 찾을 수 없습니다. )");
                        throw new Exception("[CAPInfo] 헤드라인 정보 작성 실패. 발령 대상 정보를 찾을 수 없습니다.");
                    }

                    builder.Append(msg.SentDateTime.ToString());
                    builder.Append(" [" + modeInfo.Name + "]");
                    builder.Append(" [" + targets.Replace(',', '/') + "] 대상으로");
                    builder.Append(" [" + disasterKindName + "]");
                    builder.Append(" 발령");
                }

                return(builder.ToString());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("[CAPInfo] MakeHeadline( Exception=[ " + ex.ToString() + "] )");
                FileLogManager.GetInstance().WriteLog("[CAPInfo] MakeHeadline ( Exception=[" + ex.ToString() + "] )");

                throw new Exception("[CAPInfo] 헤드라인 정보 작성 실패. 처리 중 예외가 발생하였습니다.");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// [발령 모드]
        /// </summary>
        /// <param name="orderCode"></param>
        /// <returns></returns>
        public static OrderMode FindOrderModeInfoByCode(CAPLib.StatusType orderMode)
        {
            if (orderModeInfo.ContainsKey(orderMode))
            {
                OrderMode copy = new OrderMode();
                copy.DeepCopyFrom(orderModeInfo[orderMode]);
                return(copy);
            }

            return(null);
        }
Ejemplo n.º 5
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);
            }
        }