first commit

This commit is contained in:
2026-03-20 08:52:16 +09:00
commit 8c0b02233e
41 changed files with 6021 additions and 0 deletions

View File

@@ -0,0 +1,193 @@
namespace Keps.WinForms.Forms
{
partial class DataInputForm
{
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.TableLayoutPanel _layout;
private System.Windows.Forms.FlowLayoutPanel _buttonPanel;
private System.Windows.Forms.Label _lblElection;
private System.Windows.Forms.Label _lblFolder;
private System.Windows.Forms.ComboBox _cmbElection;
private System.Windows.Forms.TextBox _txtFolder;
private System.Windows.Forms.Button _btnFolder;
private System.Windows.Forms.Button _btnImportReal;
private System.Windows.Forms.ProgressBar _progress;
private System.Windows.Forms.Label _lblMain;
private System.Windows.Forms.Label _lblDetail;
private System.Windows.Forms.FolderBrowserDialog _folderDialog;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this._layout = new System.Windows.Forms.TableLayoutPanel();
this._lblElection = new System.Windows.Forms.Label();
this._cmbElection = new System.Windows.Forms.ComboBox();
this._lblFolder = new System.Windows.Forms.Label();
this._txtFolder = new System.Windows.Forms.TextBox();
this._btnFolder = new System.Windows.Forms.Button();
this._progress = new System.Windows.Forms.ProgressBar();
this._lblMain = new System.Windows.Forms.Label();
this._lblDetail = new System.Windows.Forms.Label();
this._buttonPanel = new System.Windows.Forms.FlowLayoutPanel();
this._btnImportReal = new System.Windows.Forms.Button();
this._folderDialog = new System.Windows.Forms.FolderBrowserDialog();
this._layout.SuspendLayout();
this._buttonPanel.SuspendLayout();
this.SuspendLayout();
//
// _layout
//
this._layout.ColumnCount = 3;
this._layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
this._layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this._layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 180F));
this._layout.Controls.Add(this._lblElection, 0, 0);
this._layout.Controls.Add(this._cmbElection, 1, 0);
this._layout.Controls.Add(this._lblFolder, 0, 1);
this._layout.Controls.Add(this._txtFolder, 1, 1);
this._layout.Controls.Add(this._btnFolder, 2, 1);
this._layout.Controls.Add(this._progress, 0, 2);
this._layout.Controls.Add(this._lblMain, 0, 3);
this._layout.Controls.Add(this._lblDetail, 0, 4);
this._layout.Dock = System.Windows.Forms.DockStyle.Top;
this._layout.Location = new System.Drawing.Point(0, 0);
this._layout.Name = "_layout";
this._layout.Padding = new System.Windows.Forms.Padding(12);
this._layout.RowCount = 5;
this._layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
this._layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
this._layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
this._layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
this._layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
this._layout.Size = new System.Drawing.Size(1000, 161);
this._layout.TabIndex = 0;
//
// _lblElection
//
this._lblElection.Anchor = System.Windows.Forms.AnchorStyles.Left;
this._lblElection.AutoSize = true;
this._lblElection.Location = new System.Drawing.Point(15, 19);
this._lblElection.Name = "_lblElection";
this._lblElection.Size = new System.Drawing.Size(53, 12);
this._lblElection.TabIndex = 0;
this._lblElection.Text = "선거년월";
//
// _cmbElection
//
this._cmbElection.Dock = System.Windows.Forms.DockStyle.Fill;
this._cmbElection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this._cmbElection.FormattingEnabled = true;
this._cmbElection.Location = new System.Drawing.Point(135, 15);
this._cmbElection.Name = "_cmbElection";
this._cmbElection.Size = new System.Drawing.Size(670, 20);
this._cmbElection.TabIndex = 1;
//
// _lblFolder
//
this._lblFolder.Anchor = System.Windows.Forms.AnchorStyles.Left;
this._lblFolder.AutoSize = true;
this._lblFolder.Location = new System.Drawing.Point(15, 47);
this._lblFolder.Name = "_lblFolder";
this._lblFolder.Size = new System.Drawing.Size(57, 12);
this._lblFolder.TabIndex = 2;
this._lblFolder.Text = "엑셀 폴더";
//
// _txtFolder
//
this._txtFolder.Dock = System.Windows.Forms.DockStyle.Fill;
this._txtFolder.Location = new System.Drawing.Point(135, 41);
this._txtFolder.Name = "_txtFolder";
this._txtFolder.ReadOnly = true;
this._txtFolder.Size = new System.Drawing.Size(670, 21);
this._txtFolder.TabIndex = 3;
//
// _btnFolder
//
this._btnFolder.Anchor = System.Windows.Forms.AnchorStyles.Left;
this._btnFolder.Location = new System.Drawing.Point(811, 41);
this._btnFolder.Name = "_btnFolder";
this._btnFolder.Size = new System.Drawing.Size(100, 25);
this._btnFolder.TabIndex = 4;
this._btnFolder.Text = "폴더 선택";
this._btnFolder.UseVisualStyleBackColor = true;
this._btnFolder.Click += new System.EventHandler(this.BtnFolder_Click);
//
// _progress
//
this._layout.SetColumnSpan(this._progress, 3);
this._progress.Dock = System.Windows.Forms.DockStyle.Fill;
this._progress.Location = new System.Drawing.Point(15, 72);
this._progress.Name = "_progress";
this._progress.Size = new System.Drawing.Size(970, 23);
this._progress.TabIndex = 5;
//
// _lblMain
//
this._lblMain.AutoSize = true;
this._layout.SetColumnSpan(this._lblMain, 3);
this._lblMain.Location = new System.Drawing.Point(15, 98);
this._lblMain.Name = "_lblMain";
this._lblMain.Size = new System.Drawing.Size(29, 12);
this._lblMain.TabIndex = 6;
this._lblMain.Text = "대기";
//
// _lblDetail
//
this._lblDetail.AutoSize = true;
this._layout.SetColumnSpan(this._lblDetail, 3);
this._lblDetail.Location = new System.Drawing.Point(15, 110);
this._lblDetail.Name = "_lblDetail";
this._lblDetail.Size = new System.Drawing.Size(0, 12);
this._lblDetail.TabIndex = 7;
//
// _buttonPanel
//
this._buttonPanel.Controls.Add(this._btnImportReal);
this._buttonPanel.Dock = System.Windows.Forms.DockStyle.Top;
this._buttonPanel.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
this._buttonPanel.Location = new System.Drawing.Point(0, 161);
this._buttonPanel.Name = "_buttonPanel";
this._buttonPanel.Padding = new System.Windows.Forms.Padding(12, 0, 12, 12);
this._buttonPanel.Size = new System.Drawing.Size(1000, 52);
this._buttonPanel.TabIndex = 1;
//
// _btnImportReal
//
this._btnImportReal.Location = new System.Drawing.Point(846, 3);
this._btnImportReal.Name = "_btnImportReal";
this._btnImportReal.Size = new System.Drawing.Size(127, 25);
this._btnImportReal.TabIndex = 0;
this._btnImportReal.Text = "최종 추출용 입력";
this._btnImportReal.UseVisualStyleBackColor = true;
this._btnImportReal.Click += new System.EventHandler(this.BtnImportReal_Click);
//
// DataInputForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1000, 320);
this.Controls.Add(this._buttonPanel);
this.Controls.Add(this._layout);
this.Name = "DataInputForm";
this.Text = "엑셀 자료 입력";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.DataInputForm_Load);
this._layout.ResumeLayout(false);
this._layout.PerformLayout();
this._buttonPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
}
}

View File

@@ -0,0 +1,152 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;
using Keps.WinForms.Models;
using Keps.WinForms.Services;
namespace Keps.WinForms.Forms
{
public sealed partial class DataInputForm : Form
{
private readonly string _appBasePath = Application.StartupPath;
private ExcelImportService _excelImportService;
public DataInputForm()
{
InitializeComponent();
}
public DataInputForm(ExcelImportService excelImportService)
: this()
{
SetServices(excelImportService);
}
public void SetServices(ExcelImportService excelImportService)
{
_excelImportService = excelImportService;
}
private void DataInputForm_Load(object sender, EventArgs e)
{
if (_excelImportService == null)
{
_lblMain.Text = "서비스 미연결";
_lblDetail.Text = "MainMdiForm.InitializeRuntime 호출 후 사용하세요.";
return;
}
List<string> elections = _excelImportService.LoadElectionYears();
_cmbElection.Items.Clear();
foreach (string election in elections)
{
_cmbElection.Items.Add(election);
}
if (_cmbElection.Items.Count > 0)
{
_cmbElection.SelectedIndex = 0;
}
}
private void BtnFolder_Click(object sender, EventArgs e)
{
// 초기 디렉터리는 _txtFolder의 값(폴더이거나 파일이면 그 폴더) 또는 _appBasePath
string initialDir = _appBasePath;
if (!string.IsNullOrWhiteSpace(_txtFolder.Text))
{
try
{
if (Directory.Exists(_txtFolder.Text))
{
initialDir = _txtFolder.Text;
}
else
{
var dir = Path.GetDirectoryName(_txtFolder.Text);
if (!string.IsNullOrWhiteSpace(dir) && Directory.Exists(dir))
initialDir = dir;
}
}
catch
{
initialDir = _appBasePath;
}
}
// FolderBrowserDialog는 SelectedPath로 초기 경로를 설정
_folderDialog.SelectedPath = initialDir;
if (_folderDialog.ShowDialog(this) == DialogResult.OK)
{
_txtFolder.Text = _folderDialog.SelectedPath;
}
}
private async void BtnImportReal_Click(object sender, EventArgs e)
{
if (_excelImportService == null)
{
MessageBox.Show(this, "ExcelImportService가 초기화되지 않았습니다.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (_cmbElection.SelectedItem == null)
{
MessageBox.Show(this, "선거년월을 선택하세요.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrWhiteSpace(_txtFolder.Text) || !Directory.Exists(_txtFolder.Text))
{
MessageBox.Show(this, "엑셀 폴더를 선택하세요.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
string folderPath = _txtFolder.Text;
string electionName = _cmbElection.SelectedItem.ToString();
ToggleState(false);
_progress.Value = 0;
_lblMain.Text = "엑셀자료 입력 시작 - 최종 투표구 추출용";
Progress<ImportProgress> progress = new Progress<ImportProgress>(p =>
{
_progress.Value = Math.Max(0, Math.Min(100, p.Percent));
_lblDetail.Text = p.Message;
});
try
{
await Task.Run(() =>
{
_excelImportService.Import(folderPath, electionName, ImportMode.Real, progress);
});
_lblMain.Text = "완료";
MessageBox.Show(this, "엑셀 기초자료 DB 적재와 군집 재구성이 완료되었습니다.", "완료", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
_lblMain.Text = "실패";
MessageBox.Show(this, ex.Message, "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
ToggleState(true);
}
}
private void ToggleState(bool enabled)
{
_cmbElection.Enabled = enabled;
_btnFolder.Enabled = enabled;
_btnImportReal.Enabled = enabled;
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="_folderDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,68 @@
namespace Keps.WinForms.Forms
{
partial class MainMdiForm
{
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.MenuStrip _menu;
private System.Windows.Forms.ToolStripMenuItem _mnuData;
private System.Windows.Forms.ToolStripMenuItem _mnuReal;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this._menu = new System.Windows.Forms.MenuStrip();
this._mnuData = new System.Windows.Forms.ToolStripMenuItem();
this._mnuReal = new System.Windows.Forms.ToolStripMenuItem();
this._menu.SuspendLayout();
this.SuspendLayout();
//
// _menu
//
this._menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._mnuData,
this._mnuReal});
this._menu.Location = new System.Drawing.Point(0, 0);
this._menu.Name = "_menu";
this._menu.Size = new System.Drawing.Size(1400, 24);
this._menu.TabIndex = 0;
this._menu.Text = "menuStrip1";
//
// _mnuData
//
this._mnuData.Name = "_mnuData";
this._mnuData.Size = new System.Drawing.Size(91, 20);
this._mnuData.Text = "기초자료입력";
//
// _mnuReal
//
this._mnuReal.Name = "_mnuReal";
this._mnuReal.Size = new System.Drawing.Size(111, 20);
this._mnuReal.Text = "최종 투표구 추출";
//
// MainMdiForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1400, 900);
this.Controls.Add(this._menu);
this.IsMdiContainer = true;
this.MainMenuStrip = this._menu;
this.Name = "MainMdiForm";
this.Text = "KEPS (C# WinForms Migration)";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this._menu.ResumeLayout(false);
this._menu.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
}
}

View File

@@ -0,0 +1,104 @@
using System;
using System.Windows.Forms;
using Keps.WinForms.Infrastructure;
using Keps.WinForms.Services;
namespace Keps.WinForms.Forms
{
public sealed partial class MainMdiForm : Form
{
private SqlConnectionFactory _connectionFactory;
private AppVersionService _versionService;
private ExcelImportService _excelImportService;
private DataInputForm _dataForm;
private RealExtractionForm _realForm;
public MainMdiForm()
{
InitializeComponent();
WireEvents();
}
public MainMdiForm(SqlConnectionFactory connectionFactory)
: this()
{
InitializeRuntime(connectionFactory);
}
public void InitializeRuntime(SqlConnectionFactory connectionFactory)
{
_connectionFactory = connectionFactory;
_versionService = connectionFactory == null ? null : new AppVersionService(connectionFactory);
_excelImportService = connectionFactory == null ? null : new ExcelImportService(connectionFactory);
}
private void WireEvents()
{
Load += MainMdiForm_Load;
_mnuData.Click += delegate { ShowDataInput(); };
_mnuReal.Click += delegate { ShowReal(); };
}
private void MainMdiForm_Load(object sender, EventArgs e)
{
if (DesignTimeHelper.IsDesignMode(this) || _versionService == null)
{
return;
}
try
{
string version = _versionService.GetCurrentVersion();
if (!string.IsNullOrWhiteSpace(version))
{
Text += " - DB Ver: " + version;
}
}
catch (Exception ex)
{
MessageBox.Show(this,
"초기 DB 연결에는 성공했지만 버전 조회 중 오류가 발생했습니다.\r\n\r\n" + ex.Message,
"초기화 경고",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
}
}
private void ShowDataInput()
{
HideChildren();
if (_dataForm == null || _dataForm.IsDisposed)
{
_dataForm = new DataInputForm();
_dataForm.SetServices(_excelImportService);
_dataForm.MdiParent = this;
}
_dataForm.Show();
_dataForm.BringToFront();
}
private void ShowReal()
{
HideChildren();
if (_realForm == null || _realForm.IsDisposed)
{
_realForm = new RealExtractionForm();
_realForm.SetConnectionFactory(_connectionFactory);
_realForm.MdiParent = this;
}
_realForm.Show();
_realForm.BringToFront();
}
private void HideChildren()
{
foreach (Form child in MdiChildren)
{
child.Hide();
}
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="_menu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,648 @@
using System.Drawing;
namespace Keps.WinForms.Forms
{
partial class RealExtractionForm
{
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.TableLayoutPanel _rootLayout;
private System.Windows.Forms.Panel _headerPanel;
private System.Windows.Forms.Label _lblQuickCaption;
private System.Windows.Forms.Label _lblOffsetPreview;
private System.Windows.Forms.Label _lblMainStatus;
private System.Windows.Forms.ProgressBar _progressBar;
private System.Windows.Forms.Label _lblDetailStatus;
private System.Windows.Forms.GroupBox _grpCriteria;
private System.Windows.Forms.Label _lblElectionCaption;
private System.Windows.Forms.ComboBox _cmbElection;
private System.Windows.Forms.Label _lblAreaCaption;
private System.Windows.Forms.ComboBox _cmbArea;
private System.Windows.Forms.Label _lblClusterCaption;
private System.Windows.Forms.ComboBox _cmbClusterMax;
private System.Windows.Forms.Label _lblSortMetricCaption;
private System.Windows.Forms.ComboBox _cmbSortMetric;
private System.Windows.Forms.ComboBox _cmbSortDirection;
private System.Windows.Forms.Button _btnPrepare;
private System.Windows.Forms.Button _btnExtract;
private System.Windows.Forms.SplitContainer _outerSplit;
private System.Windows.Forms.TableLayoutPanel _bodyLayout;
private System.Windows.Forms.GroupBox _grpSampleOption;
private System.Windows.Forms.RadioButton _rdoAuto;
private System.Windows.Forms.RadioButton _rdoManual;
private System.Windows.Forms.NumericUpDown _numTotalSamples;
private System.Windows.Forms.Label _lblTotalCaption;
private System.Windows.Forms.Panel _allocationPanel;
private System.Windows.Forms.DataGridView _gridAuto;
private System.Windows.Forms.DataGridView _gridManual;
private System.Windows.Forms.GroupBox _grpPosition;
private System.Windows.Forms.RadioButton _optOffsetSubtract;
private System.Windows.Forms.RadioButton _optOffsetBasic;
private System.Windows.Forms.RadioButton _optOffsetAdd;
private System.Windows.Forms.Label _lblOffsetRange;
private System.Windows.Forms.Label _lblOffsetValue;
private System.Windows.Forms.NumericUpDown _numOffsetValue;
private System.Windows.Forms.GroupBox _grpAdjustment;
private System.Windows.Forms.DataGridView _gridAdjustment;
private System.Windows.Forms.GroupBox _grpVerification;
private System.Windows.Forms.DataGridView _gridVerification;
private System.Windows.Forms.GroupBox _grpResult;
private System.Windows.Forms.DataGridView _gridResult;
private System.Windows.Forms.FlowLayoutPanel _exportPanel;
private System.Windows.Forms.Button _btnExportExcel;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this._rootLayout = new System.Windows.Forms.TableLayoutPanel();
this._headerPanel = new System.Windows.Forms.Panel();
this._lblQuickCaption = new System.Windows.Forms.Label();
this._lblOffsetPreview = new System.Windows.Forms.Label();
this._lblMainStatus = new System.Windows.Forms.Label();
this._progressBar = new System.Windows.Forms.ProgressBar();
this._lblDetailStatus = new System.Windows.Forms.Label();
this._grpCriteria = new System.Windows.Forms.GroupBox();
this._lblElectionCaption = new System.Windows.Forms.Label();
this._cmbElection = new System.Windows.Forms.ComboBox();
this._lblAreaCaption = new System.Windows.Forms.Label();
this._cmbArea = new System.Windows.Forms.ComboBox();
this._lblClusterCaption = new System.Windows.Forms.Label();
this._cmbClusterMax = new System.Windows.Forms.ComboBox();
this._lblSortMetricCaption = new System.Windows.Forms.Label();
this._cmbSortMetric = new System.Windows.Forms.ComboBox();
this._cmbSortDirection = new System.Windows.Forms.ComboBox();
this._btnPrepare = new System.Windows.Forms.Button();
this._btnExtract = new System.Windows.Forms.Button();
this._outerSplit = new System.Windows.Forms.SplitContainer();
this._bodyLayout = new System.Windows.Forms.TableLayoutPanel();
this._grpSampleOption = new System.Windows.Forms.GroupBox();
this._rdoAuto = new System.Windows.Forms.RadioButton();
this._rdoManual = new System.Windows.Forms.RadioButton();
this._lblTotalCaption = new System.Windows.Forms.Label();
this._numTotalSamples = new System.Windows.Forms.NumericUpDown();
this._allocationPanel = new System.Windows.Forms.Panel();
this._gridAuto = new System.Windows.Forms.DataGridView();
this._gridManual = new System.Windows.Forms.DataGridView();
this._grpPosition = new System.Windows.Forms.GroupBox();
this._optOffsetSubtract = new System.Windows.Forms.RadioButton();
this._optOffsetBasic = new System.Windows.Forms.RadioButton();
this._optOffsetAdd = new System.Windows.Forms.RadioButton();
this._lblOffsetRange = new System.Windows.Forms.Label();
this._lblOffsetValue = new System.Windows.Forms.Label();
this._numOffsetValue = new System.Windows.Forms.NumericUpDown();
this._grpAdjustment = new System.Windows.Forms.GroupBox();
this._gridAdjustment = new System.Windows.Forms.DataGridView();
this._grpVerification = new System.Windows.Forms.GroupBox();
this._gridVerification = new System.Windows.Forms.DataGridView();
this._grpResult = new System.Windows.Forms.GroupBox();
this._gridResult = new System.Windows.Forms.DataGridView();
this._exportPanel = new System.Windows.Forms.FlowLayoutPanel();
this._btnExportExcel = new System.Windows.Forms.Button();
this._rootLayout.SuspendLayout();
this._headerPanel.SuspendLayout();
this._grpCriteria.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._outerSplit)).BeginInit();
this._outerSplit.Panel1.SuspendLayout();
this._outerSplit.Panel2.SuspendLayout();
this._outerSplit.SuspendLayout();
this._bodyLayout.SuspendLayout();
this._grpSampleOption.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._numTotalSamples)).BeginInit();
this._allocationPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._gridAuto)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this._gridManual)).BeginInit();
this._grpPosition.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._numOffsetValue)).BeginInit();
this._grpAdjustment.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._gridAdjustment)).BeginInit();
this._grpVerification.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._gridVerification)).BeginInit();
this._grpResult.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._gridResult)).BeginInit();
this._exportPanel.SuspendLayout();
this.SuspendLayout();
//
// _rootLayout
//
this._rootLayout.ColumnCount = 1;
this._rootLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this._rootLayout.Controls.Add(this._headerPanel, 0, 0);
this._rootLayout.Controls.Add(this._grpCriteria, 0, 1);
this._rootLayout.Controls.Add(this._outerSplit, 0, 2);
this._rootLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this._rootLayout.Location = new System.Drawing.Point(0, 0);
this._rootLayout.Name = "_rootLayout";
this._rootLayout.RowCount = 3;
this._rootLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 125F));
this._rootLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 105F));
this._rootLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this._rootLayout.Size = new System.Drawing.Size(1528, 860);
this._rootLayout.TabIndex = 0;
//
// _headerPanel
//
this._headerPanel.Controls.Add(this._lblQuickCaption);
this._headerPanel.Controls.Add(this._lblOffsetPreview);
this._headerPanel.Controls.Add(this._lblMainStatus);
this._headerPanel.Controls.Add(this._progressBar);
this._headerPanel.Controls.Add(this._lblDetailStatus);
this._headerPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this._headerPanel.Location = new System.Drawing.Point(3, 3);
this._headerPanel.Name = "_headerPanel";
this._headerPanel.Size = new System.Drawing.Size(1522, 119);
this._headerPanel.TabIndex = 0;
//
// _lblQuickCaption
//
this._lblQuickCaption.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this._lblQuickCaption.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold);
this._lblQuickCaption.Location = new System.Drawing.Point(25, 18);
this._lblQuickCaption.Name = "_lblQuickCaption";
this._lblQuickCaption.Size = new System.Drawing.Size(100, 28);
this._lblQuickCaption.TabIndex = 0;
this._lblQuickCaption.Text = "추출위치";
this._lblQuickCaption.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// _lblOffsetPreview
//
this._lblOffsetPreview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this._lblOffsetPreview.Font = new System.Drawing.Font("굴림", 9F);
this._lblOffsetPreview.Location = new System.Drawing.Point(135, 18);
this._lblOffsetPreview.Name = "_lblOffsetPreview";
this._lblOffsetPreview.Size = new System.Drawing.Size(110, 28);
this._lblOffsetPreview.TabIndex = 1;
this._lblOffsetPreview.Text = "n - 0";
this._lblOffsetPreview.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// _lblMainStatus
//
this._lblMainStatus.AutoSize = true;
this._lblMainStatus.Font = new System.Drawing.Font("굴림", 15.75F);
this._lblMainStatus.Location = new System.Drawing.Point(20, 68);
this._lblMainStatus.Name = "_lblMainStatus";
this._lblMainStatus.Size = new System.Drawing.Size(94, 21);
this._lblMainStatus.TabIndex = 3;
this._lblMainStatus.Text = "완료......";
//
// _progressBar
//
this._progressBar.Location = new System.Drawing.Point(24, 94);
this._progressBar.Name = "_progressBar";
this._progressBar.Size = new System.Drawing.Size(640, 18);
this._progressBar.TabIndex = 4;
//
// _lblDetailStatus
//
this._lblDetailStatus.AutoSize = true;
this._lblDetailStatus.Font = new System.Drawing.Font("굴림", 14.25F);
this._lblDetailStatus.ForeColor = System.Drawing.Color.Blue;
this._lblDetailStatus.Location = new System.Drawing.Point(680, 93);
this._lblDetailStatus.Name = "_lblDetailStatus";
this._lblDetailStatus.Size = new System.Drawing.Size(95, 19);
this._lblDetailStatus.TabIndex = 5;
this._lblDetailStatus.Text = "100.000 %";
//
// _grpCriteria
//
this._grpCriteria.Controls.Add(this._lblElectionCaption);
this._grpCriteria.Controls.Add(this._cmbElection);
this._grpCriteria.Controls.Add(this._lblAreaCaption);
this._grpCriteria.Controls.Add(this._cmbArea);
this._grpCriteria.Controls.Add(this._lblClusterCaption);
this._grpCriteria.Controls.Add(this._cmbClusterMax);
this._grpCriteria.Controls.Add(this._lblSortMetricCaption);
this._grpCriteria.Controls.Add(this._cmbSortMetric);
this._grpCriteria.Controls.Add(this._cmbSortDirection);
this._grpCriteria.Controls.Add(this._btnPrepare);
this._grpCriteria.Controls.Add(this._btnExtract);
this._grpCriteria.Dock = System.Windows.Forms.DockStyle.Fill;
this._grpCriteria.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold);
this._grpCriteria.ForeColor = System.Drawing.Color.Blue;
this._grpCriteria.Location = new System.Drawing.Point(3, 128);
this._grpCriteria.Name = "_grpCriteria";
this._grpCriteria.Size = new System.Drawing.Size(1522, 99);
this._grpCriteria.TabIndex = 1;
this._grpCriteria.TabStop = false;
this._grpCriteria.Text = "추출용 선거";
//
// _lblElectionCaption
//
this._lblElectionCaption.AutoSize = true;
this._lblElectionCaption.Location = new System.Drawing.Point(22, 33);
this._lblElectionCaption.Name = "_lblElectionCaption";
this._lblElectionCaption.Size = new System.Drawing.Size(41, 16);
this._lblElectionCaption.TabIndex = 0;
this._lblElectionCaption.Text = "선거";
//
// _cmbElection
//
this._cmbElection.FormattingEnabled = true;
this._cmbElection.Location = new System.Drawing.Point(78, 29);
this._cmbElection.Name = "_cmbElection";
this._cmbElection.Size = new System.Drawing.Size(110, 24);
this._cmbElection.TabIndex = 1;
//
// _lblAreaCaption
//
this._lblAreaCaption.AutoSize = true;
this._lblAreaCaption.Location = new System.Drawing.Point(218, 33);
this._lblAreaCaption.Name = "_lblAreaCaption";
this._lblAreaCaption.Size = new System.Drawing.Size(41, 16);
this._lblAreaCaption.TabIndex = 2;
this._lblAreaCaption.Text = "지역";
//
// _cmbArea
//
this._cmbArea.FormattingEnabled = true;
this._cmbArea.Location = new System.Drawing.Point(270, 29);
this._cmbArea.Name = "_cmbArea";
this._cmbArea.Size = new System.Drawing.Size(110, 24);
this._cmbArea.TabIndex = 3;
//
// _lblClusterCaption
//
this._lblClusterCaption.AutoSize = true;
this._lblClusterCaption.Location = new System.Drawing.Point(405, 33);
this._lblClusterCaption.Name = "_lblClusterCaption";
this._lblClusterCaption.Size = new System.Drawing.Size(72, 16);
this._lblClusterCaption.TabIndex = 4;
this._lblClusterCaption.Text = "층(군집)";
//
// _cmbClusterMax
//
this._cmbClusterMax.FormattingEnabled = true;
this._cmbClusterMax.Location = new System.Drawing.Point(476, 29);
this._cmbClusterMax.Name = "_cmbClusterMax";
this._cmbClusterMax.Size = new System.Drawing.Size(96, 24);
this._cmbClusterMax.TabIndex = 5;
//
// _lblSortMetricCaption
//
this._lblSortMetricCaption.AutoSize = true;
this._lblSortMetricCaption.Location = new System.Drawing.Point(598, 33);
this._lblSortMetricCaption.Name = "_lblSortMetricCaption";
this._lblSortMetricCaption.Size = new System.Drawing.Size(41, 16);
this._lblSortMetricCaption.TabIndex = 6;
this._lblSortMetricCaption.Text = "Sort";
//
// _cmbSortMetric
//
this._cmbSortMetric.FormattingEnabled = true;
this._cmbSortMetric.Location = new System.Drawing.Point(648, 29);
this._cmbSortMetric.Name = "_cmbSortMetric";
this._cmbSortMetric.Size = new System.Drawing.Size(160, 24);
this._cmbSortMetric.TabIndex = 7;
//
// _cmbSortDirection
//
this._cmbSortDirection.FormattingEnabled = true;
this._cmbSortDirection.Location = new System.Drawing.Point(818, 29);
this._cmbSortDirection.Name = "_cmbSortDirection";
this._cmbSortDirection.Size = new System.Drawing.Size(96, 24);
this._cmbSortDirection.TabIndex = 8;
//
// _btnPrepare
//
this._btnPrepare.Font = new System.Drawing.Font("굴림", 11.25F, System.Drawing.FontStyle.Bold);
this._btnPrepare.ForeColor = System.Drawing.Color.Black;
this._btnPrepare.Location = new System.Drawing.Point(24, 61);
this._btnPrepare.Name = "_btnPrepare";
this._btnPrepare.Size = new System.Drawing.Size(170, 30);
this._btnPrepare.TabIndex = 9;
this._btnPrepare.Text = "1. 추출 사전 단계";
this._btnPrepare.UseVisualStyleBackColor = true;
//
// _btnExtract
//
this._btnExtract.Font = new System.Drawing.Font("굴림", 11.25F, System.Drawing.FontStyle.Bold);
this._btnExtract.ForeColor = System.Drawing.Color.Black;
this._btnExtract.Location = new System.Drawing.Point(205, 61);
this._btnExtract.Name = "_btnExtract";
this._btnExtract.Size = new System.Drawing.Size(270, 30);
this._btnExtract.TabIndex = 10;
this._btnExtract.Text = "2. 추출 및 검즘-등간 정수";
this._btnExtract.UseVisualStyleBackColor = true;
//
// _outerSplit
//
this._outerSplit.Dock = System.Windows.Forms.DockStyle.Fill;
this._outerSplit.Location = new System.Drawing.Point(3, 233);
this._outerSplit.Name = "_outerSplit";
this._outerSplit.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// _outerSplit.Panel1
//
this._outerSplit.Panel1.Controls.Add(this._bodyLayout);
//
// _outerSplit.Panel2
//
this._outerSplit.Panel2.Controls.Add(this._grpResult);
this._outerSplit.Panel2.Controls.Add(this._exportPanel);
this._outerSplit.Size = new System.Drawing.Size(1522, 624);
this._outerSplit.SplitterDistance = 350;
this._outerSplit.TabIndex = 2;
//
// _bodyLayout
//
this._bodyLayout.ColumnCount = 3;
this._bodyLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 27.85808F));
this._bodyLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.12615F));
this._bodyLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 58.01577F));
this._bodyLayout.Controls.Add(this._grpSampleOption, 0, 0);
this._bodyLayout.Controls.Add(this._grpAdjustment, 1, 0);
this._bodyLayout.Controls.Add(this._grpVerification, 2, 0);
this._bodyLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this._bodyLayout.Location = new System.Drawing.Point(0, 0);
this._bodyLayout.Name = "_bodyLayout";
this._bodyLayout.RowCount = 1;
this._bodyLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this._bodyLayout.Size = new System.Drawing.Size(1522, 350);
this._bodyLayout.TabIndex = 0;
//
// _grpSampleOption
//
this._grpSampleOption.Controls.Add(this._rdoAuto);
this._grpSampleOption.Controls.Add(this._rdoManual);
this._grpSampleOption.Controls.Add(this._lblTotalCaption);
this._grpSampleOption.Controls.Add(this._numTotalSamples);
this._grpSampleOption.Controls.Add(this._allocationPanel);
this._grpSampleOption.Controls.Add(this._grpPosition);
this._grpSampleOption.Dock = System.Windows.Forms.DockStyle.Fill;
this._grpSampleOption.Font = new System.Drawing.Font("굴림", 10.5F, System.Drawing.FontStyle.Bold);
this._grpSampleOption.Location = new System.Drawing.Point(3, 3);
this._grpSampleOption.Name = "_grpSampleOption";
this._grpSampleOption.Size = new System.Drawing.Size(418, 344);
this._grpSampleOption.TabIndex = 0;
this._grpSampleOption.TabStop = false;
this._grpSampleOption.Text = "투표구수 지정 옵션";
//
// _rdoAuto
//
this._rdoAuto.AutoSize = true;
this._rdoAuto.ForeColor = System.Drawing.Color.Blue;
this._rdoAuto.Location = new System.Drawing.Point(18, 28);
this._rdoAuto.Name = "_rdoAuto";
this._rdoAuto.Size = new System.Drawing.Size(163, 18);
this._rdoAuto.TabIndex = 0;
this._rdoAuto.TabStop = true;
this._rdoAuto.Text = "합계 기준 자동 설정";
this._rdoAuto.UseVisualStyleBackColor = true;
//
// _rdoManual
//
this._rdoManual.AutoSize = true;
this._rdoManual.ForeColor = System.Drawing.Color.Blue;
this._rdoManual.Location = new System.Drawing.Point(186, 28);
this._rdoManual.Name = "_rdoManual";
this._rdoManual.Size = new System.Drawing.Size(207, 18);
this._rdoManual.TabIndex = 1;
this._rdoManual.Text = "층(군집)별 개수 수동 지정";
this._rdoManual.UseVisualStyleBackColor = true;
//
// _lblTotalCaption
//
this._lblTotalCaption.AutoSize = true;
this._lblTotalCaption.Location = new System.Drawing.Point(206, 57);
this._lblTotalCaption.Name = "_lblTotalCaption";
this._lblTotalCaption.Size = new System.Drawing.Size(118, 14);
this._lblTotalCaption.TabIndex = 2;
this._lblTotalCaption.Text = "총 추출투표구수";
//
// _numTotalSamples
//
this._numTotalSamples.Location = new System.Drawing.Point(321, 53);
this._numTotalSamples.Name = "_numTotalSamples";
this._numTotalSamples.Size = new System.Drawing.Size(83, 24);
this._numTotalSamples.TabIndex = 3;
//
// _allocationPanel
//
this._allocationPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this._allocationPanel.Controls.Add(this._gridAuto);
this._allocationPanel.Controls.Add(this._gridManual);
this._allocationPanel.Location = new System.Drawing.Point(12, 82);
this._allocationPanel.Name = "_allocationPanel";
this._allocationPanel.Size = new System.Drawing.Size(395, 153);
this._allocationPanel.TabIndex = 4;
//
// _gridAuto
//
this._gridAuto.Dock = System.Windows.Forms.DockStyle.Fill;
this._gridAuto.Location = new System.Drawing.Point(0, 0);
this._gridAuto.Name = "_gridAuto";
this._gridAuto.Size = new System.Drawing.Size(395, 153);
this._gridAuto.TabIndex = 0;
//
// _gridManual
//
this._gridManual.Dock = System.Windows.Forms.DockStyle.Fill;
this._gridManual.Location = new System.Drawing.Point(0, 0);
this._gridManual.Name = "_gridManual";
this._gridManual.Size = new System.Drawing.Size(395, 153);
this._gridManual.TabIndex = 1;
//
// _grpPosition
//
this._grpPosition.Controls.Add(this._optOffsetSubtract);
this._grpPosition.Controls.Add(this._optOffsetBasic);
this._grpPosition.Controls.Add(this._optOffsetAdd);
this._grpPosition.Controls.Add(this._lblOffsetRange);
this._grpPosition.Controls.Add(this._lblOffsetValue);
this._grpPosition.Controls.Add(this._numOffsetValue);
this._grpPosition.Font = new System.Drawing.Font("굴림", 10.5F, System.Drawing.FontStyle.Bold);
this._grpPosition.ForeColor = System.Drawing.Color.Blue;
this._grpPosition.Location = new System.Drawing.Point(12, 241);
this._grpPosition.Name = "_grpPosition";
this._grpPosition.Size = new System.Drawing.Size(390, 95);
this._grpPosition.TabIndex = 5;
this._grpPosition.TabStop = false;
this._grpPosition.Text = "추출위치";
//
// _optOffsetSubtract
//
this._optOffsetSubtract.AutoSize = true;
this._optOffsetSubtract.Location = new System.Drawing.Point(14, 24);
this._optOffsetSubtract.Name = "_optOffsetSubtract";
this._optOffsetSubtract.Size = new System.Drawing.Size(121, 18);
this._optOffsetSubtract.TabIndex = 0;
this._optOffsetSubtract.Text = "추출위치 빼기";
this._optOffsetSubtract.UseVisualStyleBackColor = true;
//
// _optOffsetBasic
//
this._optOffsetBasic.AutoSize = true;
this._optOffsetBasic.Location = new System.Drawing.Point(14, 46);
this._optOffsetBasic.Name = "_optOffsetBasic";
this._optOffsetBasic.Size = new System.Drawing.Size(55, 18);
this._optOffsetBasic.TabIndex = 1;
this._optOffsetBasic.Text = "기본";
this._optOffsetBasic.UseVisualStyleBackColor = true;
//
// _optOffsetAdd
//
this._optOffsetAdd.AutoSize = true;
this._optOffsetAdd.Location = new System.Drawing.Point(14, 68);
this._optOffsetAdd.Name = "_optOffsetAdd";
this._optOffsetAdd.Size = new System.Drawing.Size(136, 18);
this._optOffsetAdd.TabIndex = 2;
this._optOffsetAdd.Text = "추출위치 더하기";
this._optOffsetAdd.UseVisualStyleBackColor = true;
//
// _lblOffsetRange
//
this._lblOffsetRange.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this._lblOffsetRange.ForeColor = System.Drawing.Color.Black;
this._lblOffsetRange.Location = new System.Drawing.Point(161, 19);
this._lblOffsetRange.Name = "_lblOffsetRange";
this._lblOffsetRange.Size = new System.Drawing.Size(210, 25);
this._lblOffsetRange.TabIndex = 3;
this._lblOffsetRange.Text = "가감 범위 1 ~ 11";
this._lblOffsetRange.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// _lblOffsetValue
//
this._lblOffsetValue.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this._lblOffsetValue.ForeColor = System.Drawing.Color.Black;
this._lblOffsetValue.Location = new System.Drawing.Point(161, 55);
this._lblOffsetValue.Name = "_lblOffsetValue";
this._lblOffsetValue.Size = new System.Drawing.Size(102, 25);
this._lblOffsetValue.TabIndex = 4;
this._lblOffsetValue.Text = "가감 값";
this._lblOffsetValue.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// _numOffsetValue
//
this._numOffsetValue.Location = new System.Drawing.Point(278, 57);
this._numOffsetValue.Name = "_numOffsetValue";
this._numOffsetValue.Size = new System.Drawing.Size(74, 24);
this._numOffsetValue.TabIndex = 5;
//
// _grpAdjustment
//
this._grpAdjustment.Controls.Add(this._gridAdjustment);
this._grpAdjustment.Dock = System.Windows.Forms.DockStyle.Fill;
this._grpAdjustment.Font = new System.Drawing.Font("굴림", 10.5F, System.Drawing.FontStyle.Bold);
this._grpAdjustment.Location = new System.Drawing.Point(427, 3);
this._grpAdjustment.Name = "_grpAdjustment";
this._grpAdjustment.Size = new System.Drawing.Size(209, 344);
this._grpAdjustment.TabIndex = 1;
this._grpAdjustment.TabStop = false;
this._grpAdjustment.Text = "수동 조정시 층별 ID 조정";
//
// _gridAdjustment
//
this._gridAdjustment.Dock = System.Windows.Forms.DockStyle.Fill;
this._gridAdjustment.Location = new System.Drawing.Point(3, 20);
this._gridAdjustment.Name = "_gridAdjustment";
this._gridAdjustment.Size = new System.Drawing.Size(203, 321);
this._gridAdjustment.TabIndex = 0;
//
// _grpVerification
//
this._grpVerification.Controls.Add(this._gridVerification);
this._grpVerification.Dock = System.Windows.Forms.DockStyle.Fill;
this._grpVerification.Font = new System.Drawing.Font("굴림", 10.5F, System.Drawing.FontStyle.Bold);
this._grpVerification.Location = new System.Drawing.Point(642, 3);
this._grpVerification.Name = "_grpVerification";
this._grpVerification.Size = new System.Drawing.Size(877, 344);
this._grpVerification.TabIndex = 2;
this._grpVerification.TabStop = false;
this._grpVerification.Text = "자가 검증 - 요약분석";
//
// _gridVerification
//
this._gridVerification.Dock = System.Windows.Forms.DockStyle.Fill;
this._gridVerification.Location = new System.Drawing.Point(3, 20);
this._gridVerification.Name = "_gridVerification";
this._gridVerification.Size = new System.Drawing.Size(871, 321);
this._gridVerification.TabIndex = 0;
//
// _grpResult
//
this._grpResult.Controls.Add(this._gridResult);
this._grpResult.Dock = System.Windows.Forms.DockStyle.Fill;
this._grpResult.Font = new System.Drawing.Font("굴림", 10.5F, System.Drawing.FontStyle.Bold);
this._grpResult.Location = new System.Drawing.Point(0, 34);
this._grpResult.Name = "_grpResult";
this._grpResult.Size = new System.Drawing.Size(1522, 236);
this._grpResult.TabIndex = 1;
this._grpResult.TabStop = false;
this._grpResult.Text = "최종 투표소 추출현황";
//
// _gridResult
//
this._gridResult.Dock = System.Windows.Forms.DockStyle.Fill;
this._gridResult.Location = new System.Drawing.Point(3, 20);
this._gridResult.Name = "_gridResult";
this._gridResult.Size = new System.Drawing.Size(1516, 213);
this._gridResult.TabIndex = 0;
//
// _exportPanel
//
this._exportPanel.Controls.Add(this._btnExportExcel);
this._exportPanel.Dock = System.Windows.Forms.DockStyle.Top;
this._exportPanel.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
this._exportPanel.Location = new System.Drawing.Point(0, 0);
this._exportPanel.Name = "_exportPanel";
this._exportPanel.Padding = new System.Windows.Forms.Padding(6);
this._exportPanel.Size = new System.Drawing.Size(1522, 34);
this._exportPanel.TabIndex = 0;
//
// _btnExportExcel
//
this._btnExportExcel.Location = new System.Drawing.Point(1418, 9);
this._btnExportExcel.Name = "_btnExportExcel";
this._btnExportExcel.Size = new System.Drawing.Size(89, 23);
this._btnExportExcel.TabIndex = 0;
this._btnExportExcel.Text = "엑셀 저장";
this._btnExportExcel.UseVisualStyleBackColor = true;
//
// RealExtractionForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1528, 860);
this.Controls.Add(this._rootLayout);
this.Name = "RealExtractionForm";
this.Text = "KEPS(Korea Research Exit Poll Sampling) - [층화 후 득표율 기준 정렬 등간 추출 방식 - 최종 투표구 추출]";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this._rootLayout.ResumeLayout(false);
this._headerPanel.ResumeLayout(false);
this._headerPanel.PerformLayout();
this._grpCriteria.ResumeLayout(false);
this._grpCriteria.PerformLayout();
this._outerSplit.Panel1.ResumeLayout(false);
this._outerSplit.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._outerSplit)).EndInit();
this._outerSplit.ResumeLayout(false);
this._bodyLayout.ResumeLayout(false);
this._grpSampleOption.ResumeLayout(false);
this._grpSampleOption.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this._numTotalSamples)).EndInit();
this._allocationPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._gridAuto)).EndInit();
((System.ComponentModel.ISupportInitialize)(this._gridManual)).EndInit();
this._grpPosition.ResumeLayout(false);
this._grpPosition.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this._numOffsetValue)).EndInit();
this._grpAdjustment.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._gridAdjustment)).EndInit();
this._grpVerification.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._gridVerification)).EndInit();
this._grpResult.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._gridResult)).EndInit();
this._exportPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
}
}

View File

@@ -0,0 +1,546 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Keps.WinForms.Infrastructure;
using Keps.WinForms.Models;
using Keps.WinForms.Services;
namespace Keps.WinForms.Forms
{
public sealed partial class RealExtractionForm : Form
{
private SqlConnectionFactory _connectionFactory;
private LookupService _lookupService;
private SamplingService _samplingService;
private ExcelReportService _excelReportService;
private RealScenarioContext _preparedContext;
private BindingList<ClusterSummaryRow> _autoRows = new BindingList<ClusterSummaryRow>();
private BindingList<ClusterSummaryRow> _manualRows = new BindingList<ClusterSummaryRow>();
private BindingList<AdjustmentRow> _adjustmentRows = new BindingList<AdjustmentRow>();
private BindingList<VerificationSummaryRow> _verificationRows = new BindingList<VerificationSummaryRow>();
private BindingList<ExtractionRow> _resultRows = new BindingList<ExtractionRow>();
private RealExtractionResult _lastResult;
private List<string> _candidateNames = new List<string>();
public RealExtractionForm()
{
InitializeComponent();
WireEvents();
InitializeDefaults();
InitializeGridColumns();
}
public void SetConnectionFactory(SqlConnectionFactory connectionFactory)
{
_connectionFactory = connectionFactory;
if (_connectionFactory == null)
{
_lookupService = null;
_samplingService = null;
_excelReportService = null;
return;
}
_lookupService = new LookupService(_connectionFactory);
_samplingService = new SamplingService(_connectionFactory);
_excelReportService = new ExcelReportService();
}
private void WireEvents()
{
Load += RealExtractionForm_Load;
_cmbElection.SelectedIndexChanged += CmbElection_SelectedIndexChanged;
_cmbArea.SelectedIndexChanged += CmbArea_SelectedIndexChanged;
_btnPrepare.Click += BtnPrepare_Click;
_btnExtract.Click += BtnExtract_Click;
_btnExportExcel.Click += BtnExportExcel_Click;
_rdoAuto.CheckedChanged += ToggleAllocationMode;
_rdoManual.CheckedChanged += ToggleAllocationMode;
_optOffsetSubtract.CheckedChanged += OffsetModeChanged;
_optOffsetBasic.CheckedChanged += OffsetModeChanged;
_optOffsetAdd.CheckedChanged += OffsetModeChanged;
_numOffsetValue.ValueChanged += OffsetModeChanged;
_numTotalSamples.ValueChanged += TotalSamplesChanged;
}
private void InitializeDefaults()
{
_cmbElection.DropDownStyle = ComboBoxStyle.DropDownList;
_cmbArea.DropDownStyle = ComboBoxStyle.DropDownList;
_cmbClusterMax.DropDownStyle = ComboBoxStyle.DropDownList;
_cmbSortMetric.DropDownStyle = ComboBoxStyle.DropDownList;
_cmbSortDirection.DropDownStyle = ComboBoxStyle.DropDownList;
_cmbSortDirection.Items.Add("내림차순");
_cmbSortDirection.Items.Add("오름차순");
_cmbSortDirection.SelectedIndex = 0;
_numTotalSamples.Minimum = 1;
_numTotalSamples.Maximum = 5000;
_numTotalSamples.Value = 123;
_numOffsetValue.Minimum = 0;
_numOffsetValue.Maximum = 100;
_preparedContext = null;
_rdoAuto.Checked = true;
_optOffsetBasic.Checked = true;
_lblMainStatus.Text = "완료......";
_lblDetailStatus.Text = "0.000 %";
_progressBar.Value = 0;
ToggleAllocationMode(this, EventArgs.Empty);
OffsetModeChanged(this, EventArgs.Empty);
}
private void RealExtractionForm_Load(object sender, EventArgs e)
{
if (_lookupService == null)
{
_lblMainStatus.Text = "서비스 미연결";
return;
}
ReloadElections();
}
private void ReloadElections()
{
_cmbElection.Items.Clear();
foreach (string item in _lookupService.LoadRealElections())
{
_cmbElection.Items.Add(item);
}
if (_cmbElection.Items.Count > 0)
{
_cmbElection.SelectedIndex = 0;
}
}
private void CmbElection_SelectedIndexChanged(object sender, EventArgs e)
{
if (DesignTimeHelper.IsDesignMode(this) || _lookupService == null || _cmbElection.SelectedItem == null)
{
return;
}
_cmbArea.Items.Clear();
_cmbClusterMax.Items.Clear();
_cmbSortMetric.Items.Clear();
foreach (string area in _lookupService.LoadRealAreas(_cmbElection.SelectedItem.ToString()))
{
_cmbArea.Items.Add(area);
}
if (_cmbArea.Items.Count > 0)
{
_cmbArea.SelectedIndex = 0;
}
foreach (CandidateOption option in _lookupService.LoadCandidateOptions(_cmbElection.SelectedItem.ToString()))
{
_cmbSortMetric.Items.Add(option);
}
_cmbSortMetric.DisplayMember = "DisplayName";
_cmbSortMetric.ValueMember = "Key";
if (_cmbSortMetric.Items.Count > 0)
{
_cmbSortMetric.SelectedIndex = 0;
}
}
private void CmbArea_SelectedIndexChanged(object sender, EventArgs e)
{
if (DesignTimeHelper.IsDesignMode(this) || _lookupService == null || _cmbElection.SelectedItem == null || _cmbArea.SelectedItem == null)
{
return;
}
_cmbClusterMax.Items.Clear();
foreach (int value in _lookupService.LoadRealClusterMaxList(_cmbElection.SelectedItem.ToString(), _cmbArea.SelectedItem.ToString()))
{
_cmbClusterMax.Items.Add(value);
}
if (_cmbClusterMax.Items.Count > 0)
{
_cmbClusterMax.SelectedIndex = 0;
}
}
private void BtnPrepare_Click(object sender, EventArgs e)
{
if (!ValidateScenarioInputs() || _samplingService == null)
{
return;
}
SetProgress(10, "조건 로드 중...");
string election = _cmbElection.SelectedItem.ToString();
string area = _cmbArea.SelectedItem.ToString();
int clusterMax = Convert.ToInt32(_cmbClusterMax.SelectedItem);
RealScenarioContext context = _samplingService.LoadRealScenario(election, area, clusterMax);
_preparedContext = context;
_autoRows = new BindingList<ClusterSummaryRow>(_samplingService.AllocateAutoSampleCounts(context.AutoRows, Convert.ToInt32(_numTotalSamples.Value)));
_manualRows = new BindingList<ClusterSummaryRow>(context.ManualRows.Select(CloneRow).ToList());
for (int i = 0; i < _manualRows.Count && i < _autoRows.Count; i++)
{
_manualRows[i].SampleCount = _autoRows[i].SampleCount;
}
_adjustmentRows = new BindingList<AdjustmentRow>(BuildDefaultAdjustmentRows(GetWorkingRows()));
_verificationRows = new BindingList<VerificationSummaryRow>();
_resultRows = new BindingList<ExtractionRow>();
_lastResult = null;
BindGridSources();
ApplyVerificationHeaders();
UpdateOffsetRange();
SetProgress(100, "사전 단계 완료");
}
private void BtnExtract_Click(object sender, EventArgs e)
{
if (!ValidateScenarioInputs() || _samplingService == null)
{
return;
}
List<ClusterSummaryRow> workingRows = GetWorkingRows();
if (workingRows.Count == 0 || workingRows.All(x => x.SampleCount <= 0))
{
MessageBox.Show(this, "추출 대상 층별 개수를 먼저 설정하세요.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
string election = _cmbElection.SelectedItem.ToString();
string area = _cmbArea.SelectedItem.ToString();
int clusterMax = Convert.ToInt32(_cmbClusterMax.SelectedItem);
CandidateOption option = _cmbSortMetric.SelectedItem as CandidateOption;
string sortKey = option == null ? "투표인수" : option.Key;
bool descending = _cmbSortDirection.SelectedIndex == 0;
int offset = GetSignedOffset();
SetProgress(15, "최종 추출 실행 중...");
_lastResult = _samplingService.RunRealExtraction(election, area, clusterMax, sortKey, option == null ? "투표인수" : option.DisplayName, descending, workingRows, offset, GetOffsetDescription(), _rdoAuto.Checked);
_candidateNames = (_lastResult.CandidateNames ?? new List<string>()).ToList();
_resultRows = new BindingList<ExtractionRow>(_lastResult.ExtractedRows ?? new List<ExtractionRow>());
_adjustmentRows = new BindingList<AdjustmentRow>(_lastResult.AdjustmentRows ?? new List<AdjustmentRow>());
_verificationRows = new BindingList<VerificationSummaryRow>(_lastResult.VerificationRows ?? new List<VerificationSummaryRow>());
BindGridSources();
ApplyVerificationHeaders();
SetProgress(100, "최종 추출 완료");
}
private void BtnExportExcel_Click(object sender, EventArgs e)
{
if (_lastResult == null || _resultRows.Count == 0)
{
MessageBox.Show(this, "먼저 최종 추출을 실행하세요.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
using (SaveFileDialog dialog = new SaveFileDialog())
{
dialog.Filter = "Excel 파일 (*.xlsx)|*.xlsx";
dialog.FileName = string.Format("층화_후_득표율_기준_{0}-{1}_최종_{2:yyyyMMdd_HHmmss}.xlsx", _cmbElection.SelectedItem, _cmbArea.SelectedItem, DateTime.Now);
if (dialog.ShowDialog(this) == DialogResult.OK)
{
_excelReportService.ExportRealExtractionWorkbook(dialog.FileName, _cmbElection.SelectedItem.ToString(), _cmbArea.SelectedItem.ToString(), GetWorkingRows(), _lastResult);
MessageBox.Show(this, "엑셀 저장 완료" + Environment.NewLine + dialog.FileName, "완료", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
private void TotalSamplesChanged(object sender, EventArgs e)
{
if (_samplingService == null || _preparedContext == null)
{
_lblOffsetPreview.Text = GetOffsetDescription();
return;
}
if (_rdoAuto.Checked)
{
_autoRows = new BindingList<ClusterSummaryRow>(_samplingService.AllocateAutoSampleCounts(_preparedContext.AutoRows, Convert.ToInt32(_numTotalSamples.Value)));
if (_manualRows == null || _manualRows.Count != _autoRows.Count)
{
_manualRows = new BindingList<ClusterSummaryRow>(_preparedContext.ManualRows.Select(CloneRow).ToList());
}
for (int i = 0; i < _manualRows.Count && i < _autoRows.Count; i++)
{
_manualRows[i].SampleCount = _autoRows[i].SampleCount;
}
BindGridSources();
}
UpdateOffsetRange();
}
private void ToggleAllocationMode(object sender, EventArgs e)
{
_gridAuto.Visible = _rdoAuto.Checked;
_gridManual.Visible = _rdoManual.Checked;
UpdateOffsetRange();
}
private void OffsetModeChanged(object sender, EventArgs e)
{
bool showOffset = !_optOffsetBasic.Checked;
_lblOffsetValue.Enabled = showOffset;
_numOffsetValue.Enabled = showOffset && _numOffsetValue.Maximum > 0;
_lblOffsetPreview.Text = GetOffsetDescription();
}
private string GetOffsetDescription()
{
if (_optOffsetBasic.Checked)
{
return "n - 0";
}
string prefix = _optOffsetSubtract.Checked ? "n - " : "n + ";
return prefix + Convert.ToInt32(_numOffsetValue.Value);
}
private int GetSignedOffset()
{
if (_optOffsetBasic.Checked)
{
return 0;
}
int value = Convert.ToInt32(_numOffsetValue.Value);
return _optOffsetSubtract.Checked ? -value : value;
}
private void UpdateOffsetRange()
{
List<ClusterSummaryRow> rows = GetWorkingRows();
ClusterSummaryRow targetRow = rows.LastOrDefault(x => x.SampleCount > 0);
int maxRange = 0;
bool offsetEnabled = true;
if (targetRow != null)
{
int total = targetRow.PollingPlaceCount;
int sample = Math.Max(0, targetRow.SampleCount);
if (sample > 0)
{
int interval = total / sample;
int start = interval / 2;
int endPoint = start + (interval * (sample - 1));
int x1 = total - endPoint;
int x2 = start - 1;
start = (int)Math.Round((x1 + x2) / 2m, 0, MidpointRounding.AwayFromZero);
maxRange = total - (interval * (sample - 1)) - start;
if (interval == 0)
{
maxRange = 0;
offsetEnabled = false;
}
}
}
if (maxRange < 0)
{
maxRange = 0;
}
_lblOffsetRange.Text = "가감 범위 1 ~ " + maxRange;
_numOffsetValue.Maximum = Math.Max(0, maxRange);
if (!offsetEnabled)
{
_numOffsetValue.Value = 0;
_numOffsetValue.Enabled = false;
}
else
{
if (!_optOffsetBasic.Checked)
{
_numOffsetValue.Enabled = true;
}
if (_numOffsetValue.Value > _numOffsetValue.Maximum)
{
_numOffsetValue.Value = _numOffsetValue.Maximum;
}
}
_lblOffsetPreview.Text = GetOffsetDescription();
}
private bool ValidateScenarioInputs()
{
if (_cmbElection.SelectedItem == null)
{
MessageBox.Show(this, "선거를 선택하세요.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
if (_cmbArea.SelectedItem == null)
{
MessageBox.Show(this, "지역을 선택하세요.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
if (_cmbClusterMax.SelectedItem == null)
{
MessageBox.Show(this, "군집수를 선택하세요.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
return true;
}
private List<ClusterSummaryRow> GetWorkingRows()
{
return (_rdoAuto.Checked ? _autoRows : _manualRows).Select(CloneRow).ToList();
}
private static ClusterSummaryRow CloneRow(ClusterSummaryRow source)
{
return new ClusterSummaryRow
{
ClusterNo = source.ClusterNo,
ClusterLabel = source.ClusterLabel,
PollingPlaceCount = source.PollingPlaceCount,
Ratio = source.Ratio,
SampleCount = source.SampleCount
};
}
private static List<AdjustmentRow> BuildDefaultAdjustmentRows(List<ClusterSummaryRow> rows)
{
List<AdjustmentRow> result = new List<AdjustmentRow>();
foreach (ClusterSummaryRow row in rows)
{
int interval = row.SampleCount <= 0 ? 1 : Math.Max(1, row.PollingPlaceCount / row.SampleCount);
for (int i = 0; i < row.SampleCount; i++)
{
result.Add(new AdjustmentRow { ClusterNo = row.ClusterNo, ExtractId = 1 + (i * interval) });
}
}
return result;
}
private void BindGridSources()
{
_gridAuto.DataSource = _autoRows;
_gridManual.DataSource = _manualRows;
_gridAdjustment.DataSource = _adjustmentRows;
_gridVerification.DataSource = _verificationRows;
_gridResult.DataSource = _resultRows;
}
private void SetProgress(int percent, string text)
{
_progressBar.Value = Math.Max(0, Math.Min(100, percent));
_lblMainStatus.Text = text;
_lblDetailStatus.Text = string.Format("{0:0.000} %", percent);
}
private void InitializeGridColumns()
{
ConfigureGridBase(_gridAuto);
ConfigureGridBase(_gridManual);
ConfigureGridBase(_gridAdjustment);
ConfigureGridBase(_gridVerification);
ConfigureGridBase(_gridResult);
ConfigureClusterGrid(_gridAuto, true);
ConfigureClusterGrid(_gridManual, false);
ConfigureAdjustmentGrid();
ConfigureVerificationGrid();
ConfigureResultGrid();
BindGridSources();
}
private static void ConfigureGridBase(DataGridView grid)
{
grid.AllowUserToAddRows = false;
grid.AllowUserToDeleteRows = false;
grid.RowHeadersVisible = false;
grid.SelectionMode = DataGridViewSelectionMode.CellSelect;
grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
grid.BackgroundColor = System.Drawing.Color.White;
grid.BorderStyle = BorderStyle.FixedSingle;
}
private static void ConfigureClusterGrid(DataGridView grid, bool readOnlySampleCount)
{
grid.AutoGenerateColumns = false;
grid.Columns.Clear();
grid.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "ClusterNo", HeaderText = "층", ReadOnly = true, Width = 50 });
grid.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "PollingPlaceCount", HeaderText = "투표구수", ReadOnly = true, Width = 80 });
grid.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Ratio", HeaderText = "층의비율", ReadOnly = true, Width = 85, DefaultCellStyle = new DataGridViewCellStyle { Format = "0.00000" } });
grid.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "SampleCount", HeaderText = "층별추출개수", ReadOnly = readOnlySampleCount, Width = 95 });
}
private void ConfigureAdjustmentGrid()
{
_gridAdjustment.AutoGenerateColumns = false;
_gridAdjustment.Columns.Clear();
_gridAdjustment.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "ClusterNo", HeaderText = "층", ReadOnly = true, Width = 45 });
_gridAdjustment.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "ExtractId", HeaderText = "추출ID", ReadOnly = true, Width = 70 });
_gridAdjustment.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "AdjustId", HeaderText = "조정ID", Width = 70 });
}
private void ConfigureVerificationGrid()
{
_gridVerification.AutoGenerateColumns = false;
_gridVerification.Columns.Clear();
_gridVerification.ColumnHeadersHeight = 42; // 원하는 높이
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "RowLabel", HeaderText = "구분", ReadOnly = true, Width = 70 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Extracted1", HeaderText = "추출1", ReadOnly = true, Width = 80 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Extracted2", HeaderText = "추출2", ReadOnly = true, Width = 80 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Extracted3", HeaderText = "추출3", ReadOnly = true, Width = 80 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Actual1", HeaderText = "실제1", ReadOnly = true, Width = 80 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Actual2", HeaderText = "실제2", ReadOnly = true, Width = 80 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Actual3", HeaderText = "실제3", ReadOnly = true, Width = 80 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "WeightedError1", HeaderText = "1오차", ReadOnly = true, Width = 80 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "WeightedError2", HeaderText = "2오차", ReadOnly = true, Width = 80 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "WeightedError3", HeaderText = "3오차", ReadOnly = true, Width = 80 });
_gridVerification.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "WeightedErrorSum", HeaderText = "오차합", ReadOnly = true, Width = 80 });
}
private void ConfigureResultGrid()
{
_gridResult.AutoGenerateColumns = false;
_gridResult.Columns.Clear();
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "ClusterNo", HeaderText = "층", ReadOnly = true, Width = 45 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "ClusterOrder", HeaderText = "추출순번", ReadOnly = true, Width = 80 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "OriginalOrder", HeaderText = "원본정렬순번", ReadOnly = true, Width = 120 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Interval", HeaderText = "간격", ReadOnly = true, Width = 50 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "StartPosition", HeaderText = "시작위치", ReadOnly = true, Width = 80 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "OffsetDescription", HeaderText = "추출위치", ReadOnly = true, Width = 80 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "DistrictName", HeaderText = "선거구명", ReadOnly = true, Width = 120 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "EupMyeonDong", HeaderText = "읍면동", ReadOnly = true, Width = 120 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "PollingPlaceNo", HeaderText = "투표구", ReadOnly = true, Width = 60 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "EligibleVoterCount", HeaderText = "유권자수", ReadOnly = true, Width = 80 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "VoteCount", HeaderText = "투표인수", ReadOnly = true, Width = 80 });
_gridResult.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "SortValue", HeaderText = "정렬값", ReadOnly = true, Width = 60 });
}
private void ApplyVerificationHeaders()
{
List<string> names = (_candidateNames ?? new List<string>()).ToList();
while (names.Count < 3)
{
names.Add("후보" + (names.Count + 1));
}
if (_gridVerification.Columns.Count >= 11)
{
_gridVerification.Columns[1].HeaderText = "추출" + Environment.NewLine + names[0];
_gridVerification.Columns[2].HeaderText = "추출" + Environment.NewLine + names[1];
_gridVerification.Columns[3].HeaderText = "추출" + Environment.NewLine + names[2];
_gridVerification.Columns[4].HeaderText = "실제" + Environment.NewLine + names[0];
_gridVerification.Columns[5].HeaderText = "실제" + Environment.NewLine + names[1];
_gridVerification.Columns[6].HeaderText = "실제" + Environment.NewLine + names[2];
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>