/// <summary> /// [재난 종류] 코드 선택 변경 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbboxDisasterKind_SelectedIndexChanged(object sender, EventArgs e) { if (!this.cmbboxDisasterKind.Focused) { return; } this.orderInquiryCondition.Disaster.Kind = null; if (this.orderInquiryCondition.Disaster == null || this.orderInquiryCondition.Disaster.Category == null) { return; } ComboBox cmb = sender as ComboBox; if (cmb.SelectedIndex < 0) { return; } if (cmb.SelectedIndex == 0 && cmb.SelectedText == "전체") { return; } DisasterKind selectedKind = cmb.SelectedItem as DisasterKind; if (selectedKind == null) { return; } this.orderInquiryCondition.Disaster.Kind = selectedKind; }
/// <summary> /// [재난 종류] 종류 리스트 선택 변경 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbboxDisasterKind_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cmbbox = sender as ComboBox; if (cmbbox == null) { return; } string selectedKindCode = string.Empty; if (cmbbox.SelectedItem != null) { DisasterKind selectedKind = cmbbox.SelectedItem as DisasterKind; if (selectedKind != null) { selectedKindCode = selectedKind.Code; } } if (cmbbox.Focused) { this.currentProfile.DisasterKindCode = selectedKindCode; } }
private List <MsgText> GetMsgTextByCurrentConditions() { if (this.lstboxDisasterKind.SelectedIndex < 0) { return(null); } if (this.lstboxLanguageKind.SelectedIndex < 0) { return(null); } if (this.lstboxCityType.SelectedIndex < 0) { return(null); } DisasterKind kindInfo = lstboxDisasterKind.SelectedItem as DisasterKind; MsgTextDisplayLanguageKind selectedLangKind = this.lstboxLanguageKind.SelectedItem as MsgTextDisplayLanguageKind; MsgTextCityType selectedCityType = this.lstboxCityType.SelectedItem as MsgTextCityType; if (kindInfo == null || selectedLangKind == null || selectedCityType == null) { return(null); } List <MsgText> msgInfo = BasisData.FindMsgTextInfoByDisasterCode(kindInfo.Code); if (msgInfo == null) { return(null); } List <MsgText> result = null; foreach (MsgText txt in msgInfo) { if (txt.LanguageKindID != selectedLangKind.ID) { continue; } if (txt.CityTypeID != selectedCityType.ID) { continue; } if (result == null) { result = new List <MsgText>(); } MsgText copy = new MsgText(); copy.DeepCopyFrom(txt); result.Add(copy); } return(result); }
/// <summary> /// 발령 정보에서 설정한 대로 재난 카테고리/종류 정보를 설정(선택) /// </summary> private void UpdateDisasterSelection() { // 재난 카테고리 선택 상태 if (this.cmbboxDisasterCategory.Items == null) { this.cmbboxDisasterCategory.Enabled = false; return; } for (int index = 0; index < this.cmbboxDisasterCategory.Items.Count; index++) { DisasterInfo info = this.cmbboxDisasterCategory.Items[index] as DisasterInfo; if (info == null || info.Category == null) { continue; } if (info.Category.Code == this.currentOrderInfo.Disaster.Category.Code) { this.cmbboxDisasterCategory.SelectedIndex = index; break; } } if (this.cmbboxDisasterCategory.SelectedIndex < 0) { this.cmbboxDisasterKind.Items.Clear(); this.cmbboxDisasterKind.Enabled = false; return; } // 재난 종류 선택 상태 if (this.cmbboxDisasterKind.Items == null) { this.cmbboxDisasterKind.Enabled = false; return; } for (int index = 0; index < this.cmbboxDisasterKind.Items.Count; index++) { DisasterKind info = this.cmbboxDisasterKind.Items[index] as DisasterKind; if (info == null) { // 아직 데이터가 설정되지 않았다. continue; } if (info.Code == this.currentOrderInfo.Disaster.Kind.Code) { this.cmbboxDisasterKind.SelectedIndex = index; break; } } }
/// <summary> /// 재난 종류 선택 변경 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbboxDisasterKind_SelectedIndexChanged(object sender, EventArgs e) { ComboBox combbox = sender as ComboBox; this.currentOrderInfo.MsgTextInfo.OriginalTransmitMsgText.Clear(); this.currentOrderInfo.MsgTextInfo.CurrentTransmitMsgText.Clear(); if (combbox.SelectedItem == null) { return; } DisasterKind info = combbox.SelectedItem as DisasterKind; if (info == null) { return; } this.btnMsgText.Enabled = true; this.currentOrderInfo.Disaster.Kind.DeepCopyFrom(info); // 문안 변경 적용 foreach (DisasterMsgText msgTxt in BasisData.TransmitMsgTextInfo.Values) { if (msgTxt.Disaster == null || msgTxt.Disaster.Kind == null) { continue; } if (msgTxt.Disaster.Kind.Code == info.Code) { MsgText original = new MsgText(); MsgText current = new MsgText(); original.DeepCopyFrom(msgTxt.MsgTxt); int index = original.Text.IndexOf("(지역명)"); if (index > 0) { original.Text = original.Text.Replace("(지역명)", BasisData.TopRegion.Name); } current.DeepCopyFrom(original); this.currentOrderInfo.MsgTextInfo.OriginalTransmitMsgText.Add(original); this.currentOrderInfo.MsgTextInfo.CurrentTransmitMsgText.Add(current); } } }
/// <summary> /// 그룹 정보에서 등록된 대로 재난 카테고리/종류 정보를 갱신. /// </summary> private void UpdateDisasterSelection() { // 사용 유무 if (this.currentProfile.DisasterCategoryID <= 0) { this.chkboxUseDisasterSet.Checked = false; this.cmbboxDisasterCategory.Enabled = false; this.cmbboxDisasterKind.Enabled = false; return; } this.chkboxUseDisasterSet.Checked = true; // 재난 카테고리 선택 상태 if (this.cmbboxDisasterCategory.Items == null) { this.cmbboxDisasterCategory.Enabled = false; return; } this.cmbboxDisasterCategory.Enabled = true; for (int index = 0; index < this.cmbboxDisasterCategory.Items.Count; index++) { DisasterInfo info = this.cmbboxDisasterCategory.Items[index] as DisasterInfo; if (info == null || info.Category == null) { continue; } if (info.Category.ID == this.currentProfile.DisasterCategoryID) { this.cmbboxDisasterCategory.SelectedIndex = index; break; } } if (this.cmbboxDisasterCategory.SelectedIndex < 0) { this.cmbboxDisasterKind.Items.Clear(); this.cmbboxDisasterKind.Enabled = false; return; } // 재난 종류 선택 상태 if (this.cmbboxDisasterKind.Items == null) { this.cmbboxDisasterKind.Enabled = false; return; } this.cmbboxDisasterKind.Enabled = true; for (int index = 0; index < this.cmbboxDisasterKind.Items.Count; index++) { DisasterKind info = this.cmbboxDisasterKind.Items[index] as DisasterKind; if (info == null) { continue; } if (info.Code == this.currentProfile.DisasterKindCode) { this.cmbboxDisasterKind.SelectedIndex = index; break; } } }
/// <summary> /// [발령] 버튼 클릭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOrder_Click(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.None; if (this.cmbboxDisasterCategory.SelectedItem == null || this.cmbboxDisasterKind.SelectedItem == null) { DialogResult result = MessageBox.Show("재난 종류를 선택해야 합니다.", "발령 준비 확인", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btnOrder.ChkValue = false; return; } DisasterKind selectedDisaster = this.cmbboxDisasterKind.SelectedItem as DisasterKind; if (selectedDisaster == null) { FileLogManager.GetInstance().WriteLog("[OrderForm] btnOrder_Click( 재난 정보 데이터 오류 )"); DialogResult result = MessageBox.Show("재난 종류 정보에 오류가 있습니다. 발령을 수행할 수 없습니다.", "발령 준비 오류", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); return; } DisasterKind copy = new DisasterKind(); copy.DeepCopyFrom(selectedDisaster); this.currentOrderInfo.Disaster.Kind = copy; // 문안 체크 foreach (MsgText msg in this.currentOrderInfo.MsgTextInfo.CurrentTransmitMsgText) { bool isTargetLanguage = false; foreach (MsgTextDisplayLanguageKind language in this.currentOrderInfo.MsgTextInfo.SelectedLanguages) { if (msg.LanguageKindID == language.ID) { isTargetLanguage = true; break; } } if (!isTargetLanguage) { continue; } if (msg.CityTypeID != this.currentOrderInfo.MsgTextInfo.SelectedCityType.ID) { continue; } foreach (string key in BasisData.KEYWORD_TIMES) { int index = msg.Text.IndexOf(key); if (index > 0) { msg.Text = msg.Text.Replace(key, "현재시각"); break; } } foreach (string key in BasisData.KEYWORD_REGIONS) { int index = msg.Text.IndexOf(key); if (index > 0) { msg.Text = msg.Text.Replace(key, "우리지역"); break; } } } // [2016-03-29] 실제 발령시 확인창 표출을 위해 추가함 - by Gonzi if (this.currentOrderInfo.Mode.Code == CAPLib.StatusType.Actual) { DialogResult result = MessageBox.Show("실제 발령을 수행하시겠습니까?", "발령 확인", MessageBoxButtons.YesNo); if (result != System.Windows.Forms.DialogResult.Yes) { return; } } if (this.NotifyOrderProvisionResult != null) { this.NotifyOrderProvisionResult(this, new OrderPrepareEventArgs(true, this.currentOrderInfo)); } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }