From 1a1c8e71fcd14858f595029f089b2d4a00202b32 Mon Sep 17 00:00:00 2001
From: ogi <Administrator@S-OGI-PC>
Date: Fri, 05 Dec 2025 09:24:16 +0900
Subject: [PATCH] プロジェクトファイルを追加。

---
 HotelPms.SourceFactory/ExcelToTable.cs |   90 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/HotelPms.SourceFactory/ExcelToTable.cs b/HotelPms.SourceFactory/ExcelToTable.cs
new file mode 100644
index 0000000..24508ad
--- /dev/null
+++ b/HotelPms.SourceFactory/ExcelToTable.cs
@@ -0,0 +1,90 @@
+using HotelPms.Share.Data;
+using HotelPms.Share.Windows.Util;
+using HotelPms.SourceFactory.Table;
+using HotelPms.SourceFactory.Util;
+using NPOI.SS.UserModel;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace HotelPms.SourceFactory
+{
+    public partial class ExcelToTable : Form
+    {
+        public ExcelToTable()
+        {
+            InitializeComponent();
+        }
+
+        private void OpenExcel_Click(object sender, EventArgs e)
+        {
+            if (txtExcelPath.Text.Length == 0)
+            {
+                openFileDialog1.InitialDirectory = Application.StartupPath;
+                if (openFileDialog1.ShowDialog() != DialogResult.OK) { return; }
+                txtExcelPath.Text = openFileDialog1.FileName;
+            }
+
+            cmbSheet.Items.Clear();
+            using (NPOIExcel excel = new NPOIExcel(txtExcelPath.Text))
+            {
+                for (int i = 0; i < excel.Workbook.NumberOfSheets; i++)
+                {
+                    cmbSheet.Items.Add(excel.Workbook.GetSheetAt(i).SheetName);
+                }
+            }
+        }
+
+        private void button3_Click(object sender, EventArgs e)
+        {
+            using(SqlFactory sqlFactory = new SqlFactory())
+            {
+                sqlFactory.CreateByExcel(txtExcelPath.Text, new DBConnectItem() { HostName = txtHost.Text, UserID = txtUser.Text, Password = txtPassword.Text, DBName = txtDB.Text });
+            }
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            using (NPOIExcel excel = new NPOIExcel(txtExcelPath.Text))
+            {
+                ICell A1 = excel.GetCell("A1");
+                ICell B1 = excel.GetCell("B1");
+                ICell C1 = excel.GetCell("C1");
+                ICell D1 = excel.GetCell("D1");
+                ICell E1 = excel.GetCell("E1");
+                ICell F1 = excel.GetCell("F1");
+                ICell G1 = excel.GetCell("G1");
+                ICell H1 = excel.GetCell("H1");
+                ICell I1 = excel.GetCell("I1");
+                ICell J1 = excel.GetCell("J1");
+                ICell K1 = excel.GetCell("K1");
+                ICell L1 = excel.GetCell("L1");
+            }
+        }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            using (NPOIExcel excel = new NPOIExcel(txtExcelPath.Text))
+            {
+                excel.SetCurrentSheet(cmbSheet.SelectedIndex);
+                using (SqlFactory sqlFactory = new())
+                {
+                    sqlFactory.DBSetting = new DBConnectItem() { HostName = txtHost.Text, UserID = txtUser.Text, Password = txtPassword.Text, DBName = txtDB.Text };
+                    bool ret = sqlFactory.CreateBySheet(excel);
+                    MessageBox.Show($"結果:{ret}");
+                }
+            }
+        }
+
+        private void button4_Click(object sender, EventArgs e)
+        {
+            txtContext.Text = EnumFactory.Create(txtExcelPath.Text, cmbSheet.SelectedIndex);
+        }
+    }
+}

--
Gitblit v1.10.0