Exemplo n.º 1
0
        /// <summary>
        /// 조위 데이터 처리
        /// </summary>
        /// <param name="baseCmd"></param>
        /// <param name="autoFlag"></param>
        /// <param name="waitTime"></param>
        /// <param name="mainForm"></param>
        public void SetAutoAlarmFormHeight(NCasTwcProtocolCmd2 cmd2, bool autoFlag, int waitTime, MainForm mainForm)
        {
            this.cmd2              = cmd2;
            this.autoFlag          = autoFlag;
            this.waitTime          = waitTime * 60;
            this.mainForm          = mainForm;
            this.isWeather         = false;
            this.titleLabel1.Text  = "관측소";
            this.titleLabel2.Text  = "관측시각";
            this.titleLabel3.Text  = "수위(cm)";
            this.commonLabel1.Text = cmd2.PostName;
            this.commonLabel2.Text = cmd2.RecordTimeByDateTime.ToString();
            this.commonLabel3.Text = this.cmd2.TideLevel.ToString();
            this.commonLabel4.Text = this.GetHeightTermName(cmd2);

            if (cmd2.TideLevel >= HeightOptionMng.LstHeightOptionData[0].MaxValue && cmd2.TideLevel < HeightOptionMng.LstHeightOptionData[0].MaxValue2)
            {
                this.commonLabel5.Text = string.Format("{0} ({1})", HeightOptionMng.LstHeightOptionData[0].Msg.Title,
                                                       HeightOptionMng.LstHeightOptionData[0].Msg.MsgNum);
            }
            else if (cmd2.TideLevel >= HeightOptionMng.LstHeightOptionData[0].MaxValue2 && cmd2.TideLevel < HeightOptionMng.LstHeightOptionData[0].MaxValue3)
            {
                this.commonLabel5.Text = string.Format("{0} ({1})", HeightOptionMng.LstHeightOptionData[0].Msg2.Title,
                                                       HeightOptionMng.LstHeightOptionData[0].Msg2.MsgNum);
            }
            else if (cmd2.TideLevel >= HeightOptionMng.LstHeightOptionData[0].MaxValue3 && cmd2.TideLevel < HeightOptionMng.LstHeightOptionData[0].MaxValue4)
            {
                this.commonLabel5.Text = string.Format("{0} ({1})", HeightOptionMng.LstHeightOptionData[0].Msg3.Title,
                                                       HeightOptionMng.LstHeightOptionData[0].Msg3.MsgNum);
            }
            else if (cmd2.TideLevel >= HeightOptionMng.LstHeightOptionData[0].MaxValue4)
            {
                this.commonLabel5.Text = string.Format("{0} ({1})", HeightOptionMng.LstHeightOptionData[0].Msg4.Title,
                                                       HeightOptionMng.LstHeightOptionData[0].Msg4.MsgNum);
            }

            //if (HeightOptionMng.LstHeightOptionData[0].Msg.MsgNum == string.Empty ||
            //    HeightOptionMng.LstHeightOptionData[0].Msg2.MsgNum == string.Empty ||
            //    HeightOptionMng.LstHeightOptionData[0].Msg3.MsgNum == string.Empty ||
            //    HeightOptionMng.LstHeightOptionData[0].Msg4.MsgNum == string.Empty)
            //{
            //    MessageBox.Show("조위 단계 별 저장메시지가 설정되어 있지 않아 발령을 종료합니다.", "조위 방송", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    NCasLoggingMng.ILogging.WriteLog("조위 데이터 처리 - 의사결정 전 저장메시지 미설정으로 방송 직전 종료함", "자동방송 저장메시지 방송 종료함");
            //    this.Close();
            //}

            if (autoFlag)
            {
                this.oklBtn_Click(this, new EventArgs());
            }
            else
            {
                this.timer          = new Timer();
                this.timer.Interval = 1000;
                this.timer.Tick    += new EventHandler(timer_Tick);
                this.timer.Start();
            }
        }
Exemplo n.º 2
0
        private string GetHeightTermName(NCasTwcProtocolCmd2 heightProto)
        {
            string rst = string.Empty;

            foreach (HeightPointContent each in HeightPointContentMng.LstHeightPointContent)
            {
                if (each.Title == heightProto.PostName)
                {
                    for (int i = 0; i < each.LstHeightPointData.Count; i++)
                    {
                        rst += each.LstHeightPointData[i].Title;

                        if (i != each.LstHeightPointData.Count - 1)
                        {
                            rst += "/";
                        }
                    }
                }
            }

            return(rst);
        }