260512_02_ENH: 기초자료 입력시 입력하는 투표 연월 수정할 수 있도록 수정
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Keps.WinForms.Models;
|
using Keps.WinForms.Models;
|
||||||
@@ -41,6 +42,7 @@ namespace Keps.WinForms.Forms
|
|||||||
|
|
||||||
|
|
||||||
List<string> elections = _excelImportService.LoadElectionYears();
|
List<string> elections = _excelImportService.LoadElectionYears();
|
||||||
|
_cmbElection.DropDownStyle = ComboBoxStyle.DropDown;
|
||||||
_cmbElection.Items.Clear();
|
_cmbElection.Items.Clear();
|
||||||
foreach (string election in elections)
|
foreach (string election in elections)
|
||||||
{
|
{
|
||||||
@@ -55,7 +57,7 @@ namespace Keps.WinForms.Forms
|
|||||||
|
|
||||||
private void BtnFolder_Click(object sender, EventArgs e)
|
private void BtnFolder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// 초기 디렉터리는 _txtFile의 값(폴더이거나 파일이면 그 폴더) 또는 _appBasePath
|
// 초기 디렉터리는 선택된 파일의 폴더 또는 앱 실행 폴더를 사용합니다.
|
||||||
string initialDir = _appBasePath;
|
string initialDir = _appBasePath;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_txtFile.Text))
|
if (!string.IsNullOrWhiteSpace(_txtFile.Text))
|
||||||
@@ -96,9 +98,10 @@ namespace Keps.WinForms.Forms
|
|||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,11 +112,10 @@ namespace Keps.WinForms.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
string filePath = _txtFile.Text;
|
string filePath = _txtFile.Text;
|
||||||
string electionName = _cmbElection.SelectedItem.ToString();
|
|
||||||
|
|
||||||
ToggleState(false);
|
ToggleState(false);
|
||||||
_progress.Value = 0;
|
_progress.Value = 0;
|
||||||
_lblMain.Text = "엑셀자료 입력 시작 - 최종 투표구 추출용";
|
_lblMain.Text = "엑셀자료 입력 시작 - 최종 투표소 추출용";
|
||||||
|
|
||||||
Progress<ImportProgress> progress = new Progress<ImportProgress>(p =>
|
Progress<ImportProgress> progress = new Progress<ImportProgress>(p =>
|
||||||
{
|
{
|
||||||
@@ -148,5 +150,12 @@ namespace Keps.WinForms.Forms
|
|||||||
_btnFolder.Enabled = enabled;
|
_btnFolder.Enabled = enabled;
|
||||||
_btnImportReal.Enabled = enabled;
|
_btnImportReal.Enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsValidElectionYear(string value)
|
||||||
|
{
|
||||||
|
return !string.IsNullOrWhiteSpace(value)
|
||||||
|
&& value.Length == 6
|
||||||
|
&& value.All(char.IsDigit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user