protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.dataMng         = WeatherDataMng.getInstance();
            this.AlarmRB.Checked = true;

            for (int i = 0; i < this.dataMng.TypeSensorList.Count; i++)
            {
                this.AlarmCB.Items.Add((string)this.dataMng.TypeSensorList[i].Name);
            }

            for (int i = 0; i < this.dataMng.DeviceList.Count; i++)
            {
                WTypeDevice typeDevice = this.dataMng.GetTypeDevice(this.dataMng.DeviceList[i].TypeDevice);

                if (typeDevice.Name != "HSD" && typeDevice.Name != "DSD")
                {
                    this.WDeviceTV.Nodes.Add(this.dataMng.DeviceList[i].PKID.ToString(), string.Format("{0}({1})", this.dataMng.DeviceList[i].Name, typeDevice.Name));
                }
            }

            for (int i = 0; i < this.WDevice.Count; i++)
            {
                if (this.WDeviceTV.Nodes.ContainsKey(this.WDevice[i].ToString()))
                {
                    this.WDeviceTV.Nodes[this.WDevice[i].ToString()].Checked = true;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 임계치 알람 데이터 수신 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataMng_onAddAlarmDataEvt(object sender, AddAlarmEventArgs e)
        {
            WDevice     wDeviceTmp = this.dataMng.GetWDevice(e.WA.FKDevice);
            WTypeDevice wTypeTmp   = this.dataMng.GetTypeDevice(wDeviceTmp.TypeDevice);
            string      level      = (e.WA.AlarmType.ToString() == "1") ? "우량계" :
                                     (e.WA.AlarmType.ToString() == "2") ? "수위계" :
                                     (e.WA.AlarmType.ToString() == "3") ? "유속계" :
                                     (e.WA.AlarmType.ToString() == "4") ? "풍향풍속계" : "기타";

            level += (e.WA.AlarmLevel.ToString() == "0") ? ", 해제" :
                     (e.WA.AlarmLevel.ToString() == "1") ? ", 주의(1단계)" :
                     (e.WA.AlarmLevel.ToString() == "2") ? ", 경계(2단계)" :
                     (e.WA.AlarmLevel.ToString() == "3") ? ", 대피(3단계)" : ", 기타";

            if (this.WeatherDataTextBox.InvokeRequired)
            {
                this.Invoke(new InvokeSetWeatherDataLog(this.SetWeatherData), new object[] { string.Format("{0}의 {1} 측기의 {2} 임계치 알람 이벤트가 발생되었습니다.",
                                                                                                           wTypeTmp.Name, wDeviceTmp.ID, level) });
            }
            else
            {
                this.SetWeatherData(string.Format("{0}의 {1} 측기의 {2} 임계치 알람 이벤트가 발생되었습니다.",
                                                  wTypeTmp.Name, wDeviceTmp.ID, level));
            }
        }
        /// <summary>
        /// 수정 메소드
        /// </summary>
        private void WDeviceUpdate()
        {
            WTypeDevice wtd       = this.dataMng.GetTypeDevice(this.WDeviceDivisionCB.Text.Substring(0, 3));
            byte        tmpSensor = this.GetSensorValue();
            WDevice     wd        = new WDevice(uint.Parse(this.wDevicePkid), this.WDeviceIDTB.Text, this.WDeviceNameTB.Text,
                                                this.WDeviceTelNumTB.Text.Replace("-", ""), wtd.PKID, tmpSensor, this.EternetUseCB.Checked, this.WDeviceRemarkTB.Text);

            this.dataMng.UpdateWDevice(wd);
            this.SaveBtn.Enabled = false;
        }
        /// <summary>
        /// 생성자
        /// </summary>
        /// <param name="_code">
        /// 1 - 등록, 2 - 수정
        /// </param>
        /// <param name="_pkid">
        /// 수정일 경우 선택한 사용자
        /// </param>
        public SMSUserMng(byte _code, uint _pkid)
        {
            InitializeComponent();

            this.dataMng = WeatherDataMng.getInstance();
            this.code    = _code;
            this.pkid    = _pkid;

            for (int i = 0; i < this.dataMng.DeviceList.Count; i++)
            {
                WTypeDevice typeDevice = this.dataMng.GetTypeDevice(this.dataMng.DeviceList[i].TypeDevice);

                if (typeDevice.Name != "HSD" && typeDevice.Name != "DSD")
                {
                    this.WDeviceTV.Nodes.Add(this.dataMng.DeviceList[i].PKID.ToString(), string.Format("{0}({1})", this.dataMng.DeviceList[i].Name, typeDevice.Name));
                }
            }

            if (_code == 1) //등록
            {
                this.Text = string.Format("SMS 사용자 등록");
                this.SmsUserMngPB.BackgroundImage = Resources.sms사용자등록_41;
                this.SmsUserMngLB.Text            = string.Format("SMS 사용자를 등록합니다.");
            }
            else if (_code == 2) //수정
            {
                this.Text = string.Format("SMS 사용자 수정");
                this.SmsUserMngPB.BackgroundImage = Resources.sms사용자수정_22;
                this.SmsUserMngLB.Text            = string.Format("SMS 사용자를 수정합니다.");
                WSmsUser wsu = this.dataMng.getSmsUser(_pkid);
                this.SmsUserNameTB.Text   = wsu.Name;
                this.SmsUserTelNumTB.Text = wsu.TelNum;
                this.SmsUserRemarkTB.Text = wsu.Remark;

                List <MapSmsUser> tmpMsuList = new List <MapSmsUser>();

                for (int i = 0; i < this.dataMng.MapSmsList.Count; i++)
                {
                    if (this.dataMng.MapSmsList[i].FkSmsUser == _pkid)
                    {
                        tmpMsuList.Add(this.dataMng.MapSmsList[i]);
                    }
                }

                for (int i = 0; i < tmpMsuList.Count; i++)
                {
                    if (this.WDeviceTV.Nodes.ContainsKey(tmpMsuList[i].FkDevice.ToString()))
                    {
                        this.WDeviceTV.Nodes[tmpMsuList[i].FkDevice.ToString()].Checked = true;
                    }
                }

                this.SaveBtn.Enabled = false;
            }
        }
Beispiel #5
0
        /// <summary>
        /// 강수 데이터 수신 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataMng_onAddRainDataEvt(object sender, AddRainDataEventArgs e)
        {
            WDevice     wDeviceTmp = this.dataMng.GetWDevice(e.WR.FKDevice);
            WTypeDevice wTypeTmp   = this.dataMng.GetTypeDevice(wDeviceTmp.TypeDevice);

            if (this.WeatherDataTextBox.InvokeRequired)
            {
                this.Invoke(new InvokeSetWeatherDataLog(this.SetWeatherData), new object[] { string.Format("{0}의 {1} 측기의 강수 데이터가 수신되었습니다.", wTypeTmp.Name, wDeviceTmp.ID) });
            }
            else
            {
                this.SetWeatherData(string.Format("{0}의 {1} 측기의 강수 데이터가 수신되었습니다.", wTypeTmp.Name, wDeviceTmp.ID));
            }
        }
Beispiel #6
0
        /// <summary>
        /// 측기 요청/제어를 한 후 이벤트(사용자가 발생시키는 이벤트)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void dataMng_onAddWDeviceRequestEvt(object sender, AddWDeviceRequestEventArgs e)
        {
            WDevice         wDevice        = this.dataMng.GetWDevice(e.WDR.FkDevice);
            WTypeDevice     wTypeTmp       = this.dataMng.GetTypeDevice(wDevice.TypeDevice);
            WTypeDeviceItem typeDeviceItem = this.dataMng.GetTypeDeviceItem(e.WDR.FkDeviceItem);
            string          real           = (e.WDR.IsControl == 0) ? "요청" : "제어";

            if (this.WeatherDataTextBox.InvokeRequired)
            {
                this.Invoke(new InvokeSetWeatherDataLog(this.SetWeatherData), new object[] { string.Format("{0}의 {1} 측기의 {2} 항목을 {3} 하였습니다.",
                                                                                                           wTypeTmp.Name, wDevice.ID, typeDeviceItem.Name, real) });
            }
            else
            {
                this.SetWeatherData(string.Format("{0}의 {1} 측기의 {2} 항목을 {3} 하였습니다.",
                                                  wTypeTmp.Name, wDevice.ID, typeDeviceItem.Name, real));
            }
        }
        /// <summary>
        /// 저장 메소드
        /// </summary>
        private bool save()
        {
            WTypeDevice wtd       = this.dataMng.GetTypeDevice(this.WDeviceDivisionCB.Text.Substring(0, 3));
            byte        tmpSensor = this.GetSensorValue();
            WDevice     wd        = new WDevice(0, this.WDeviceIDTB.Text, this.WDeviceNameTB.Text, this.WDeviceTelNumTB.Text.Replace("-", ""),
                                                wtd.PKID, tmpSensor, this.EternetUseCB.Checked, this.WDeviceRemarkTB.Text);

            if (this.dataMng.GetWDeviceComparer(wd))
            {
                MessageBox.Show("이미 등록된 ID 입니다.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            else
            {
                this.dataMng.AddWDevice(wd);
                this.SaveBtn.Enabled = false;
                return(true);
            }
        }
        //제어 버튼 클릭
        private void RequestBtn_Click(object sender, EventArgs e)
        {
            //유효성 검사
            if (!this.TreeViewValidation())
            {
                MessageBox.Show("제어할 측기를 선택하거나 항목을 올바르게 넣어주세요.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            for (int i = 0; i < this.WDeviceTV.Nodes.Count; i++)
            {
                if (this.WDeviceTV.Nodes[i].Checked)
                {
                    WaitBarMng.Start();
                    Thread.Sleep(1500);

                    WDevice     wDevice  = this.dataMng.GetWDevice(uint.Parse(this.WDeviceTV.Nodes[i].Name));
                    WTypeDevice wTypeTmp = this.dataMng.GetTypeDevice(wDevice.TypeDevice);

                    if (wTypeTmp.Name == "RAT")   //RAT 우량기를 선택했을 때..
                    {
                        if (this.AlarmRB.Checked) //임계치 선택
                        {
                            //DB 저장
                            if (this.AlarmCB.Text == "우량계")
                            {
                                WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.강수임계치1단계;
                                WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm1TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.강수임계치2단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm2TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.강수임계치3단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm3TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);
                            }
                            else if (this.AlarmCB.Text == "수위계")
                            {
                                WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.수위임계치1단계;
                                WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm1TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.수위임계치2단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm2TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.수위임계치3단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm3TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);
                            }
                            else if (this.AlarmCB.Text == "유속계")
                            {
                                WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.속임계치1단계;
                                WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm1TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.속임계치2단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm2TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.속임계치3단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm3TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);
                            }

                            CProto01 cProto01 = CProtoMng.GetProtoObj("01") as CProto01;
                            cProto01.Header   = "[";
                            cProto01.Length   = "037";
                            cProto01.ID       = wDevice.ID;
                            cProto01.MainCode = "1";
                            cProto01.SubCode  = "L";
                            cProto01.RecvType = "1";

                            if (this.AlarmCB.Text == "우량계")
                            {
                                cProto01.Data = "1";
                                int tmpDouble1 = (int)(double.Parse(this.Alarm1TB.Text) * 10);
                                int tmpDouble2 = (int)(double.Parse(this.Alarm2TB.Text) * 10);
                                int tmpDouble3 = (int)(double.Parse(this.Alarm3TB.Text) * 10);

                                cProto01.Data += string.Format("{0}{1}{2}", tmpDouble1.ToString().PadLeft(5, '0'),
                                                               tmpDouble2.ToString().PadLeft(5, '0'), tmpDouble3.ToString().PadLeft(5, '0'));
                            }
                            else if (this.AlarmCB.Text == "수위계")
                            {
                                cProto01.Data = "2";
                                int tmpDouble1 = (int)(double.Parse(this.Alarm1TB.Text) * 10);
                                int tmpDouble2 = (int)(double.Parse(this.Alarm2TB.Text) * 10);
                                int tmpDouble3 = (int)(double.Parse(this.Alarm3TB.Text) * 10);

                                cProto01.Data += string.Format("{0}0{1}0{2}0", tmpDouble1.ToString().PadLeft(4, '0'),
                                                               tmpDouble2.ToString().PadLeft(4, '0'), tmpDouble3.ToString().PadLeft(4, '0'));
                            }
                            else if (this.AlarmCB.Text == "유속계")
                            {
                                cProto01.Data = "3";
                                int tmpDouble1 = (int)(double.Parse(this.Alarm1TB.Text) * 10);
                                int tmpDouble2 = (int)(double.Parse(this.Alarm2TB.Text) * 10);
                                int tmpDouble3 = (int)(double.Parse(this.Alarm3TB.Text) * 10);

                                cProto01.Data += string.Format("{0}{1}{2}", tmpDouble1.ToString().PadLeft(5, '0'),
                                                               tmpDouble2.ToString().PadLeft(5, '0'), tmpDouble3.ToString().PadLeft(5, '0'));
                            }

                            cProto01.CRC  = "00000";
                            cProto01.Tail = "]";

                            byte[] buff = cProto01.MakeProto();

                            if (wDevice.EthernetUse)
                            {
                                cProto01.RecvType = "3";
                                byte[] eBuff = cProto01.MakeProto();
                                this.dataMng.SendEthernetMsg(wDevice.ID, eBuff);
                            }
                            else
                            {
                                this.dataMng.SendSmsMsg(wDevice.CellNumber, buff);
                            }
                        }
                        else if (this.FTimeRB.Checked) //무시시간 선택
                        {
                            //DB 저장
                            WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.동일레벨무시시간;
                            WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.FTime1TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            wiTypeAll         = WeatherDataMng.WIType.하향레벨무시시간;
                            AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.FTime2TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            CProto02 cProto02 = CProtoMng.GetProtoObj("02") as CProto02;
                            cProto02.Header   = "[";
                            cProto02.Length   = "040";
                            cProto02.ID       = wDevice.ID;
                            cProto02.MainCode = "1";
                            cProto02.SubCode  = "s";
                            cProto02.RecvType = "1";
                            cProto02.Data     = string.Format("010010010010{0}{1}0", this.FTime1TB.Text.PadLeft(3, '0'), this.FTime2TB.Text.PadLeft(3, '0'));
                            cProto02.CRC      = "00000";
                            cProto02.Tail     = "]";

                            if (wDevice.EthernetUse)
                            {
                                cProto02.RecvType = "3";
                                byte[] buff = cProto02.MakeProto();
                                this.dataMng.SendEthernetMsg(wDevice.ID, buff);
                            }
                            else
                            {
                                byte[] buff = cProto02.MakeProto();
                                this.dataMng.SendSmsMsg(wDevice.CellNumber, buff);
                            }
                        }
                        else if (this.IpPortRB.Checked) //CDMA IP, PORT 선택
                        {
                            //DB 저장
                            WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.IP;
                            WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.IpPort1TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            wiTypeAll         = WeatherDataMng.WIType.PORT;
                            AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.IpPort2TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            CProto03 cProto03 = CProtoMng.GetProtoObj("03") as CProto03;
                            cProto03.Header   = "[";
                            cProto03.Length   = "040";
                            cProto03.ID       = wDevice.ID;
                            cProto03.MainCode = "1";
                            cProto03.SubCode  = "g";
                            cProto03.RecvType = "1";
                            string[] tmpIpStr = this.IpPort1TB.Text.Split('.');
                            cProto03.Data = string.Format("{0}.{1}.{2}.{3}{4}",
                                                          tmpIpStr[0].PadLeft(3, '0'),
                                                          tmpIpStr[1].PadLeft(3, '0'),
                                                          tmpIpStr[2].PadLeft(3, '0'),
                                                          tmpIpStr[3].PadLeft(3, '0'),
                                                          this.IpPort2TB.Text.PadLeft(4, '0'));
                            cProto03.CRC  = "00000";
                            cProto03.Tail = "]";

                            if (wDevice.EthernetUse)
                            {
                                cProto03.RecvType = "3";
                                byte[] buff = cProto03.MakeProto();
                                this.dataMng.SendEthernetMsg(wDevice.ID, buff);
                            }
                            else
                            {
                                byte[] buff = cProto03.MakeProto();
                                this.dataMng.SendSmsMsg(wDevice.CellNumber, buff);
                            }
                        }
                        else if (this.EIpPortRB.Checked) //이더넷 IP, PORT 선택
                        {
                            //DB 저장
                            WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.이더넷IP;
                            WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.EIpPort1TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            wiTypeAll         = WeatherDataMng.WIType.이더넷PORT;
                            AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.EIpPort2TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            CProto09 cProto09 = CProtoMng.GetProtoObj("09") as CProto09;
                            cProto09.Header   = "[";
                            cProto09.Length   = "040";
                            cProto09.ID       = wDevice.ID;
                            cProto09.MainCode = "1";
                            cProto09.SubCode  = "h";
                            cProto09.RecvType = "1";
                            string[] tmpIpStr = this.EIpPort1TB.Text.Split('.');
                            cProto09.Data = string.Format("{0}.{1}.{2}.{3}{4}",
                                                          tmpIpStr[0].PadLeft(3, '0'),
                                                          tmpIpStr[1].PadLeft(3, '0'),
                                                          tmpIpStr[2].PadLeft(3, '0'),
                                                          tmpIpStr[3].PadLeft(3, '0'),
                                                          this.EIpPort2TB.Text.PadLeft(4, '0'));
                            cProto09.CRC  = "00000";
                            cProto09.Tail = "]";

                            if (wDevice.EthernetUse)
                            {
                                cProto09.RecvType = "3";
                                byte[] buff = cProto09.MakeProto();
                                this.dataMng.SendEthernetMsg(wDevice.ID, buff);
                            }
                            else
                            {
                                byte[] buff = cProto09.MakeProto();
                                this.dataMng.SendSmsMsg(wDevice.CellNumber, buff);
                            }
                        }
                        else if (this.UpgradeRB.Checked) //업그레이드 선택
                        {
                            //DB 저장
                            WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.업그레이드IP;
                            WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Upgrade1TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            wiTypeAll         = WeatherDataMng.WIType.업그레이드PORT;
                            AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Upgrade2TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            CProto04 cProto04 = CProtoMng.GetProtoObj("04") as CProto04;
                            cProto04.Header   = "[";
                            cProto04.Length   = "038";
                            cProto04.ID       = wDevice.ID;
                            cProto04.MainCode = "2";
                            cProto04.SubCode  = "c";
                            cProto04.RecvType = "1";
                            string[] tmpUpgradeStr = this.Upgrade1TB.Text.Split('.');
                            cProto04.Data = string.Format("1{0}{1}{2}{3}{4}",
                                                          tmpUpgradeStr[0].PadLeft(3, '0'),
                                                          tmpUpgradeStr[1].PadLeft(3, '0'),
                                                          tmpUpgradeStr[2].PadLeft(3, '0'),
                                                          tmpUpgradeStr[3].PadLeft(3, '0'),
                                                          this.Upgrade2TB.Text.PadLeft(4, '0'));
                            cProto04.CRC  = "00000";
                            cProto04.Tail = "]";

                            if (wDevice.EthernetUse)
                            {
                                cProto04.RecvType = "3";
                                byte[] buff = cProto04.MakeProto();
                                this.dataMng.SendEthernetMsg(wDevice.ID, buff);
                            }
                            else
                            {
                                byte[] buff = cProto04.MakeProto();
                                this.dataMng.SendSmsMsg(wDevice.CellNumber, buff);
                            }
                        }
                        else if (this.ResetRB.Checked) //리셋 선택
                        {
                            //DB 저장
                            WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.RESET;
                            WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, string.Empty);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            CProto05 cProto05 = CProtoMng.GetProtoObj("05") as CProto05;
                            cProto05.Header   = "[";
                            cProto05.Length   = "022";
                            cProto05.ID       = wDevice.ID;
                            cProto05.MainCode = "2";
                            cProto05.SubCode  = "c";
                            cProto05.RecvType = "1";
                            cProto05.Data     = string.Format("0");
                            cProto05.CRC      = "00000";
                            cProto05.Tail     = "]";

                            if (wDevice.EthernetUse)
                            {
                                cProto05.RecvType = "3";
                                byte[] buff = cProto05.MakeProto();
                                this.dataMng.SendEthernetMsg(wDevice.ID, buff);
                            }
                            else
                            {
                                byte[] buff = cProto05.MakeProto();
                                this.dataMng.SendSmsMsg(wDevice.CellNumber, buff);
                            }
                        }
                    }
                    else if (wTypeTmp.Name == "WOU") //WOU 우량기를 선택했을 때..
                    {
                        if (this.AlarmRB.Checked)    //임계치 선택
                        {
                            //DB 저장
                            if (this.AlarmCB.Text == "우량계")
                            {
                                WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.강수임계치1단계;
                                WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm1TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.강수임계치2단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm2TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.강수임계치3단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm3TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);
                            }
                            else if (this.AlarmCB.Text == "수위계")
                            {
                                WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.수위임계치1단계;
                                WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm1TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.수위임계치2단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm2TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.수위임계치3단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm3TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);
                            }
                            else if (this.AlarmCB.Text == "유속계")
                            {
                                WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.속임계치1단계;
                                WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm1TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.속임계치2단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm2TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);

                                wiTypeAll         = WeatherDataMng.WIType.속임계치3단계;
                                AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                                tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.Alarm3TB.Text);
                                this.dataMng.AddDeviceRequest(tmp);
                                Thread.Sleep(20);
                            }

                            byte   tmpByte   = byte.MinValue;
                            string tmpValue1 = string.Empty;
                            string tmpValue2 = string.Empty;
                            string tmpValue3 = string.Empty;

                            if (this.AlarmCB.Text == "우량계")
                            {
                                tmpByte = 1;
                                int tmpDouble1 = (int)(double.Parse(this.Alarm1TB.Text) * 10);
                                int tmpDouble2 = (int)(double.Parse(this.Alarm2TB.Text) * 10);
                                int tmpDouble3 = (int)(double.Parse(this.Alarm3TB.Text) * 10);

                                tmpValue1 = string.Format("{0}{1}{2}", tmpDouble1.ToString().PadLeft(5, '0'),
                                                          tmpDouble2.ToString().PadLeft(5, '0'), tmpDouble3.ToString().PadLeft(5, '0'));
                            }
                            else if (this.AlarmCB.Text == "수위계")
                            {
                                tmpByte = 2;
                                int tmpDouble1 = (int)(double.Parse(this.Alarm1TB.Text) * 10);
                                int tmpDouble2 = (int)(double.Parse(this.Alarm2TB.Text) * 10);
                                int tmpDouble3 = (int)(double.Parse(this.Alarm3TB.Text) * 10);

                                tmpValue2 = string.Format("{0}0{1}0{2}0", tmpDouble1.ToString().PadLeft(4, '0'),
                                                          tmpDouble2.ToString().PadLeft(4, '0'), tmpDouble3.ToString().PadLeft(4, '0'));
                            }
                            else if (this.AlarmCB.Text == "유속계")
                            {
                                tmpByte = 3;
                                int tmpDouble1 = (int)(double.Parse(this.Alarm1TB.Text) * 10);
                                int tmpDouble2 = (int)(double.Parse(this.Alarm2TB.Text) * 10);
                                int tmpDouble3 = (int)(double.Parse(this.Alarm3TB.Text) * 10);

                                tmpValue3 = string.Format("{0}{1}{2}", tmpDouble1.ToString().PadLeft(5, '0'),
                                                          tmpDouble2.ToString().PadLeft(5, '0'), tmpDouble3.ToString().PadLeft(5, '0'));
                            }

                            this.dataMng.WOUWDeviceAlarmCtr(wDevice.PKID, tmpByte, tmpValue1, tmpValue2, tmpValue3);
                        }
                        else if (this.FTimeRB.Checked) //무시시간 선택
                        {
                            //DB 저장
                            WeatherDataMng.WIType wiTypeAll         = WeatherDataMng.WIType.동일레벨무시시간;
                            WTypeDeviceItem       AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            WDeviceRequest        tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.FTime1TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            wiTypeAll         = WeatherDataMng.WIType.하향레벨무시시간;
                            AllTypeDeviceItem = this.dataMng.GetTypeDeviceItem(wiTypeAll);
                            tmp = new WDeviceRequest(0, wDevice.PKID, AllTypeDeviceItem.PKID, DateTime.Now, 1, this.FTime2TB.Text);
                            this.dataMng.AddDeviceRequest(tmp);
                            Thread.Sleep(20);

                            this.dataMng.WOUWDeviceFTimeCtr(wDevice.PKID, this.FTime1TB.Text.PadLeft(3, '0'), this.FTime2TB.Text.PadLeft(3, '0'));
                        }
                    }
                }
            }

            WaitBarMng.Close();
        }