/// <summary> /// 리스트 아이템 더블클릭. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lvWaitToOrderSWRList_DoubleClick(object sender, EventArgs e) { try { AdengListView view = sender as AdengListView; if (view == null || view.SelectedItems == null || view.SelectedItems.Count <= 0) { return; } AdengListViewItem item = view.SelectedItems[0]; if (item == null) { return; } SWRProfile profile = item.Tag as SWRProfile; if (profile == null) { return; } SWRWarningItemDetailForm detailForm = new SWRWarningItemDetailForm(profile); detailForm.ShowDialog(this); } catch (Exception ex) { System.Console.WriteLine("[WaitToOrderForm] lvWaitToOrderSWRList_DoubleClick( Exception: \n" + ex.ToString() + ")"); FileLogManager.GetInstance().WriteLog("[WaitToOrderForm] lvWaitToOrderSWRList_DoubleClick( Exception=[" + ex.ToString() + "] )"); } }
/// <summary> /// [경보 발령] 버튼 클릭. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOrder_Click(object sender, EventArgs e) { try { if (this.lvWaitToOrderSWRList.SelectedItems == null || this.lvWaitToOrderSWRList.SelectedItems.Count <= 0) { return; } string targetID = this.lvWaitToOrderSWRList.SelectedItems[0].Name; SWRProfile targetRecord = this.lvWaitToOrderSWRList.SelectedItems[0].Tag as SWRProfile; if (targetID == null || targetRecord == null) { return; } // 메인에 전달 if (this.NotifyUpdateSWRAssociationState != null) { this.Visible = false; this.NotifyUpdateSWRAssociationState(this, new UpdateSWRAssociationStateEventArgs(targetID, SWRAssociationStateCode.Order, targetRecord)); this.Close(); } else { DialogResult result = MessageBox.Show("발령 처리에서 오류가 발생하였습니다. \n errorCode=[-1]", "발령 실패", MessageBoxButtons.OK); } } catch (Exception ex) { System.Console.WriteLine("[WaitToOrderForm] btnOrder_Click( Exception: \n" + ex.ToString() + ")"); FileLogManager.GetInstance().WriteLog("[WaitToOrderForm] btnOrder_Click( Exception=[" + ex.ToString() + "] )"); } }
/// <summary> /// 생성자. /// </summary> /// <param name="waitingList"></param> public WaitToOrderSWRForm(List <SWRProfile> waitingList) { InitializeComponent(); if (waitingList == null) { MessageBox.Show("발령 대기 중인 기상특보가 없습니다.", "미발령 기상특보 목록", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); return; } if (this.currentWaitingList == null) { this.currentWaitingList = new List <SWRProfile>(); } this.currentWaitingList.Clear(); foreach (SWRProfile profile in waitingList) { SWRProfile copy = new SWRProfile(); copy.DeepCopyFrom(profile); this.currentWaitingList.Add(copy); } InitReportList(); }
public SWRWarningItemDetailForm(SWRProfile profile) { InitializeComponent(); this.currentProfile.DeepCopyFrom(profile); InitializeOrderDetailList(); }
private void SetHeadline() { if (this.currentOrderInfo.RefType == OrderReferenceType.SWR) { if (this.currentOrderInfo.Tag == null) { return; } SWRProfile profile = this.currentOrderInfo.Tag as SWRProfile; if (profile == null) { return; } SWRWarningItemProfile warningItem = profile.GetWarningItemProfile(); if (warningItem == null) { return; } StringBuilder builder = new StringBuilder("[기상특보연계] "); if (warningItem.AnnounceTime.Ticks > 0) { builder.Append(warningItem.AnnounceTime.ToString()); } string areaNames = profile.GetTargetAreaNames(); if (!string.IsNullOrEmpty(areaNames)) { builder.Append(" " + areaNames); } if (!string.IsNullOrEmpty(profile.WarnKindCode)) { string kindName = BasisData.FindSWRKindStringByKindCode(profile.WarnKindCode); if (!string.IsNullOrEmpty(kindName)) { builder.Append(" " + kindName); } } if (!string.IsNullOrEmpty(profile.WarnStressCode)) { string stressName = BasisData.FindSWRStressStringByStressCode(profile.WarnStressCode); if (!string.IsNullOrEmpty(stressName)) { builder.Append(" " + stressName); } } if (!string.IsNullOrEmpty(profile.CommandCode)) { string commandName = BasisData.FindSWRCommandStringByCommandCode(profile.CommandCode); if (!string.IsNullOrEmpty(commandName)) { builder.Append(" " + commandName); } } this.lblHeadline.Text = builder.ToString(); } }
public void UpdateSWRList(List <SWRProfile> waitingList) { try { MethodInvoker invoker = delegate() { // 현재 선택된 아이템을 백업 string selectedItemName = string.Empty; if (this.lvWaitToOrderSWRList.SelectedItems != null && this.lvWaitToOrderSWRList.SelectedItems.Count > 0) { selectedItemName = this.lvWaitToOrderSWRList.SelectedItems[0].Text; } // 로컬 리스트 클리어 if (this.currentWaitingList == null) { this.currentWaitingList = new List <SWRProfile>(); } this.currentWaitingList.Clear(); // 새 데이터로 변경 foreach (SWRProfile profile in waitingList) { SWRProfile copy = new SWRProfile(); copy.DeepCopyFrom(profile); this.currentWaitingList.Add(copy); } // 리스트 갱신 UpdateReportList(); // 원래 선택했던 아이템 재선택 처리 if (this.lvWaitToOrderSWRList.Items != null && !string.IsNullOrEmpty(selectedItemName)) { if (this.lvWaitToOrderSWRList.Items.ContainsKey(selectedItemName)) { this.lvWaitToOrderSWRList.Items[selectedItemName].Selected = true; } } }; if (this.InvokeRequired) { Invoke(invoker); } else { invoker(); } } catch (Exception ex) { System.Console.WriteLine("[WaitToOrderForm] UpdateSWRList( Exception: \n" + ex.ToString() + ")"); FileLogManager.GetInstance().WriteLog("[WaitToOrderForm] UpdateSWRList( Exception=[" + ex.ToString() + "] )"); } }
/// <summary> /// [닫기] 버튼 클릭. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClose_Click(object sender, EventArgs e) { if (this.NotifyUpdateSWRAreaVisible != null) { SWRProfile profile = null; if (this.lvWaitToOrderSWRList.SelectedItems != null && this.lvWaitToOrderSWRList.SelectedItems.Count > 0) { profile = this.lvWaitToOrderSWRList.SelectedItems[0].Tag as SWRProfile; } this.NotifyUpdateSWRAreaVisible(this, new UpdateSWRAreaVisibleEventArgs(false, profile)); } this.Close(); }
/// <summary> /// 리스트 아이템 선택 변경. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lvWaitToOrderSWRList_SelectedIndexChanged(object sender, Adeng.Framework.Ctrl.AdengEventArgs e) { try { if (this.lvWaitToOrderSWRList.SelectedItems == null || this.lvWaitToOrderSWRList.SelectedItems.Count <= 0) { this.btnDelete.Enabled = false; this.btnOrder.Enabled = false; return; } // 어째서인지 동일한 아이템을 재선택해도 이 이벤트가 발생한다. if (this.previousSelectedItemIndex == this.lvWaitToOrderSWRList.SelectedItems[0].Index) { return; } this.previousSelectedItemIndex = this.lvWaitToOrderSWRList.SelectedItems[0].Index; this.btnDelete.Enabled = true; this.btnOrder.Enabled = true; SWRProfile profile = this.lvWaitToOrderSWRList.SelectedItems[0].Tag as SWRProfile; if (profile == null) { return; } if (this.NotifyUpdateSWRAreaVisible != null) { this.NotifyUpdateSWRAreaVisible(this, new UpdateSWRAreaVisibleEventArgs(true, profile)); } } catch (Exception ex) { System.Console.WriteLine("[WaitToOrderForm] lvWaitToOrderSWRList_SelectedIndexChanged( Exception: \n" + ex.ToString() + ")"); FileLogManager.GetInstance().WriteLog("[WaitToOrderForm] lvWaitToOrderSWRList_SelectedIndexChanged( Exception=[" + ex.ToString() + "] )"); } }
/// <summary> /// 헤드라인 클릭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lblHeadline_Click(object sender, EventArgs e) { if (this.currentOrderInfo.RefType != OrderReferenceType.SWR) { return; } if (this.currentOrderInfo.Tag == null) { return; } SWRProfile profile = this.currentOrderInfo.Tag as SWRProfile; if (profile == null) { return; } SWRWarningItemDetailForm swrDetailForm = new SWRWarningItemDetailForm(profile); swrDetailForm.Show(); }
public UpdateSWRAreaVisibleEventArgs(bool isVisible, SWRProfile requestedReport) { this.isVisible = isVisible; this.requestedReport = requestedReport; }
public UpdateSWRAssociationStateEventArgs(string reportID, SWRAssociationStateCode associationState, SWRProfile requestedReport) { this.reportID = reportID; this.associationState = associationState; this.requestedReport = requestedReport; }
/// <summary> /// 기상특보통보문 데이터를 파싱. /// </summary> /// <param name="reportXml"></param> /// <returns></returns> private int ParsingWeatherWarningItem(string reportXml, out List <SWRProfile> reportList) { System.Diagnostics.Debug.Assert(reportXml != null); //FileLogManager.GetInstance().WriteLog("[SWRServiceManager] ParsingWeatherWarningItem( start )"); reportList = null; int result = 0; try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(reportXml); XmlNodeList itemsList = xmlDoc.SelectNodes("/response/body/items"); if (itemsList == null) { FileLogManager.GetInstance().WriteLog("[SWRServiceManager] ParsingWeatherWarningItem( 아이템 정보를 찾을 수 없음. )"); result = -1; return(result); } reportList = new List <SWRProfile>(); foreach (XmlNode items in itemsList) { foreach (XmlNode item in items.ChildNodes) { if (item.Name != "item") { continue; } bool isError = false; DateTime announceTime = new DateTime(); int sequenceNo = 0; string targetAreas = string.Empty; foreach (XmlNode node in item) { switch (node.Name) { case "t2": { targetAreas = node.InnerText; } break; case "tmFc": { bool isParsed = DateTime.TryParse(node.InnerText, out announceTime); if (!isParsed) { FileLogManager.GetInstance().WriteLog("[SWRServiceManager] ParsingWeatherWarningItem( 변환 에러. tmFc=[" + node.InnerText + "] )"); isError = true; break; } } break; case "tmSeq": { int temp = 0; if (int.TryParse(node.InnerText, out temp)) { sequenceNo = temp; } else { FileLogManager.GetInstance().WriteLog("[SWRServiceManager] ParsingWeatherWarningItem( 변환 에러. tmSeq=[" + node.InnerText + "] )"); } } break; default: break; } } if (isError || sequenceNo < 1) { continue; } bool isContains = CheckAreaRange(targetAreas); if (!isContains) { continue; } string newReportID = announceTime.Year.ToString("0000") + announceTime.Month.ToString("00") + sequenceNo.ToString("000"); bool isNew = CheckSequenceNo(newReportID, this.currentLatestProfileID); if (!isNew) { continue; } if (CheckSequenceNo(newReportID, this.newDetectedReportID)) { this.newDetectedReportID = newReportID; } SWRProfile report = new SWRProfile(); report.ID = newReportID; report.TargetAreas = string.Empty; report.WarnKindCode = string.Empty; report.WarnStressCode = string.Empty; report.CommandCode = string.Empty; report.OriginalWarningItemReport = "<swr><item>" + item.InnerXml + "</item></swr>"; report.ReceivedTime = DateTime.Now; report.AssociationState = SWRAssociationStateCode.Waiting; reportList.Add(report); } } } catch (Exception ex) { System.Console.WriteLine("[SWRServiceManager] ParsingWeatherWarningItem( " + ex.ToString() + " )"); FileLogManager.GetInstance().WriteLog("[SWRServiceManager] ParsingWeatherWarningItem( " + ex.ToString() + " )"); result = -99; } finally { //FileLogManager.GetInstance().WriteLog("[SWRServiceManager] ParsingWeatherWarningItem( end )"); } return(result); }