From 45dfda4eabf428493471b014da1bf354eaedc82f Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Tue, 12 May 2026 12:31:17 +0900 Subject: [PATCH] =?UTF-8?q?260512=5F02=5FENH:=20=EA=B8=B0=EC=B4=88?= =?UTF-8?q?=EC=9E=90=EB=A3=8C=20=EC=9E=85=EB=A0=A5=EC=8B=9C=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=ED=95=98=EB=8A=94=20=ED=88=AC=ED=91=9C=20=EC=97=B0?= =?UTF-8?q?=EC=9B=94=20=EC=88=98=EC=A0=95=ED=95=A0=20=EC=88=98=20=EC=9E=88?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Keps.WinForms/Forms/DataInputForm.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Keps.WinForms/Forms/DataInputForm.cs b/Keps.WinForms/Forms/DataInputForm.cs index c528425..6386f2e 100644 --- a/Keps.WinForms/Forms/DataInputForm.cs +++ b/Keps.WinForms/Forms/DataInputForm.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using Keps.WinForms.Models; @@ -41,6 +42,7 @@ namespace Keps.WinForms.Forms List elections = _excelImportService.LoadElectionYears(); + _cmbElection.DropDownStyle = ComboBoxStyle.DropDown; _cmbElection.Items.Clear(); foreach (string election in elections) { @@ -55,7 +57,7 @@ namespace Keps.WinForms.Forms private void BtnFolder_Click(object sender, EventArgs e) { - // 초기 디렉터리는 _txtFile의 값(폴더이거나 파일이면 그 폴더) 또는 _appBasePath + // 초기 디렉터리는 선택된 파일의 폴더 또는 앱 실행 폴더를 사용합니다. string initialDir = _appBasePath; if (!string.IsNullOrWhiteSpace(_txtFile.Text)) @@ -96,9 +98,10 @@ namespace Keps.WinForms.Forms return; } - if (_cmbElection.SelectedItem == null) + string electionName = _cmbElection.Text.Trim(); + if (!IsValidElectionYear(electionName)) { - MessageBox.Show(this, "선거년월을 선택하세요.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning); + MessageBox.Show(this, "선거년월을 yyyymm 형식으로 입력 또는 선택해주세요.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } @@ -109,11 +112,10 @@ namespace Keps.WinForms.Forms } string filePath = _txtFile.Text; - string electionName = _cmbElection.SelectedItem.ToString(); ToggleState(false); _progress.Value = 0; - _lblMain.Text = "엑셀자료 입력 시작 - 최종 투표구 추출용"; + _lblMain.Text = "엑셀자료 입력 시작 - 최종 투표소 추출용"; Progress progress = new Progress(p => { @@ -148,5 +150,12 @@ namespace Keps.WinForms.Forms _btnFolder.Enabled = enabled; _btnImportReal.Enabled = enabled; } + + private static bool IsValidElectionYear(string value) + { + return !string.IsNullOrWhiteSpace(value) + && value.Length == 6 + && value.All(char.IsDigit); + } } }