private void UpdateTextData() { List <MsgText> msgInfo = GetMsgTextByCurrentConditions(); if (msgInfo == null) { return; } foreach (MsgText txt in msgInfo) { MsgTextDisplayMediaType mediaType = BasisData.FindMediaTypeInfoByID(txt.MediaTypeID); if (mediaType == null) { continue; } string mediaTypeCode = mediaType.Code.ToUpper(); if (mediaTypeCode == "TTS") { this.txtboxTTS.Text = txt.Text; } else if (mediaTypeCode == "CBS") { this.txtboxCBS.Text = txt.Text; } else if (mediaTypeCode == "BOARD") { this.txtboxBoard.Text = txt.Text; } else if (mediaTypeCode == "DMB") { this.txtboxDMB.Text = txt.Text; } else { } } }
/// <summary> /// [변경 저장] 버튼 클릭 이벤트 핸들러. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { List <MsgText> currentMsg = GetMsgTextByCurrentConditions(); if (currentMsg == null) { return; } if (currentMsg.Count < 1) { MessageBox.Show("문안 정보 저장 중 오류가 발생하여 요청을 수행할 수 없습니다. ErrorCode=[01]", "문안 저장", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } List <MsgText> saveTarget = new List <MsgText>(); foreach (MsgText txt in currentMsg) { bool found = false; MsgTextDisplayMediaType mediaType = BasisData.FindMediaTypeInfoByID(txt.MediaTypeID); if (mediaType == null) { continue; } string mediaTypeCode = mediaType.Code.ToUpper(); if (mediaTypeCode == "TTS") { if (txt.Text == this.txtboxTTS.Text) { continue; } found = true; txt.Text = this.txtboxTTS.Text; } else if (mediaTypeCode == "CBS") { if (txt.Text == this.txtboxCBS.Text) { continue; } found = true; txt.Text = this.txtboxCBS.Text; } else if (mediaTypeCode == "BOARD") { if (txt.Text == this.txtboxBoard.Text) { continue; } found = true; txt.Text = this.txtboxBoard.Text; } else if (mediaTypeCode == "DMB") { if (txt.Text == this.txtboxDMB.Text) { continue; } found = true; txt.Text = this.txtboxDMB.Text; } else { } if (found) { MsgText copy = new MsgText(); copy.DeepCopyFrom(txt); saveTarget.Add(copy); } } int result = DBManager.GetInstance().UpdateTransmitMsgText(saveTarget); if (result == 0) { foreach (MsgText newTxt in saveTarget) { if (BasisData.TransmitMsgTextInfo.ContainsKey(newTxt.ID)) { MsgText trans = BasisData.TransmitMsgTextInfo[newTxt.ID].MsgTxt; trans.DeepCopyFrom(newTxt); } } MessageBox.Show("문안 정보를 저장하였습니다.", "문안 저장", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("문안 정보 저장 중 오류가 발생하여 요청을 수행할 수 없습니다. ErrorCode=[" + result + "]", "문안 저장", MessageBoxButtons.OK, MessageBoxIcon.Error); } }