From 8a0a4ccc4ca46d5fe201aa08b532cf26ad7ec4a8 Mon Sep 17 00:00:00 2001 From: backuppc Date: Tue, 25 Nov 2025 17:30:08 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20OWIN=20=EC=9B=B9=EC=84=9C=EB=B2=84?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0,=20WebView2=20VirtualHost=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EC=A0=84=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - OWIN 관련 패키지 제거 (Microsoft.Owin.*, Microsoft.AspNet.WebApi.*) - 모든 Web API 컨트롤러 삭제 (Controllers/*.cs) - Startup.cs 삭제 - 기존 WebView2 Dialog 삭제 (fDashboard, fHolyday, fJobReport, fLogin_WB, fCommon) - fDashboardNew만 유지 (SetVirtualHostNameToFolderMapping 방식) - fMain.cs에서 OWIN 서버 시작 코드 제거 - 품목검색/설명서 메뉴 수정 (로컬 파일 참조로 변경) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Project/Dialog/fCommon.Designer.cs | 46 - Project/Dialog/fCommon.cs | 87 -- Project/Dialog/fCommon.resx | 120 --- Project/Dialog/fDashboard.Designer.cs | 63 -- Project/Dialog/fDashboard.cs | 94 -- Project/Dialog/fDashboard.resx | 120 --- Project/Dialog/fHolyday.Designer.cs | 46 - Project/Dialog/fHolyday.cs | 86 -- Project/Dialog/fHolyday.resx | 120 --- Project/Dialog/fJobReport.Designer.cs | 46 - Project/Dialog/fJobReport.cs | 86 -- Project/Dialog/fJobReport.resx | 120 --- Project/Dialog/fLogin_WB.Designer.cs | 289 ------ Project/Dialog/fLogin_WB.cs | 491 ---------- Project/Dialog/fLogin_WB.resx | 160 --- Project/EETGW.csproj | 96 -- Project/Web/Controllers/APIController.cs | 143 --- Project/Web/Controllers/BaseController.cs | 267 ----- Project/Web/Controllers/CommonController.cs | 454 --------- Project/Web/Controllers/CustomerController.cs | 198 ---- .../Web/Controllers/DashBoardController.cs | 496 ---------- Project/Web/Controllers/HomeController.cs | 346 ------- Project/Web/Controllers/ItemController.cs | 153 --- .../Web/Controllers/JobreportController.cs | 919 ------------------ Project/Web/Controllers/KuntaeController.cs | 293 ------ Project/Web/Controllers/ManualController.cs | 88 -- Project/Web/Controllers/ProjectController.cs | 408 -------- Project/Web/Controllers/PurchaseController.cs | 215 ---- Project/Web/Controllers/ReactController.cs | 358 ------- Project/Web/Controllers/ResourceController.cs | 156 --- Project/Web/Controllers/ResultController.cs | 64 -- Project/Web/Controllers/SettingController.cs | 63 -- Project/Web/Controllers/TodoController.cs | 439 --------- Project/Web/Startup.cs | 111 --- Project/fMain.cs | 82 +- Project/packages.config | 17 +- 36 files changed, 16 insertions(+), 7324 deletions(-) delete mode 100644 Project/Dialog/fCommon.Designer.cs delete mode 100644 Project/Dialog/fCommon.cs delete mode 100644 Project/Dialog/fCommon.resx delete mode 100644 Project/Dialog/fDashboard.Designer.cs delete mode 100644 Project/Dialog/fDashboard.cs delete mode 100644 Project/Dialog/fDashboard.resx delete mode 100644 Project/Dialog/fHolyday.Designer.cs delete mode 100644 Project/Dialog/fHolyday.cs delete mode 100644 Project/Dialog/fHolyday.resx delete mode 100644 Project/Dialog/fJobReport.Designer.cs delete mode 100644 Project/Dialog/fJobReport.cs delete mode 100644 Project/Dialog/fJobReport.resx delete mode 100644 Project/Dialog/fLogin_WB.Designer.cs delete mode 100644 Project/Dialog/fLogin_WB.cs delete mode 100644 Project/Dialog/fLogin_WB.resx delete mode 100644 Project/Web/Controllers/APIController.cs delete mode 100644 Project/Web/Controllers/BaseController.cs delete mode 100644 Project/Web/Controllers/CommonController.cs delete mode 100644 Project/Web/Controllers/CustomerController.cs delete mode 100644 Project/Web/Controllers/DashBoardController.cs delete mode 100644 Project/Web/Controllers/HomeController.cs delete mode 100644 Project/Web/Controllers/ItemController.cs delete mode 100644 Project/Web/Controllers/JobreportController.cs delete mode 100644 Project/Web/Controllers/KuntaeController.cs delete mode 100644 Project/Web/Controllers/ManualController.cs delete mode 100644 Project/Web/Controllers/ProjectController.cs delete mode 100644 Project/Web/Controllers/PurchaseController.cs delete mode 100644 Project/Web/Controllers/ReactController.cs delete mode 100644 Project/Web/Controllers/ResourceController.cs delete mode 100644 Project/Web/Controllers/ResultController.cs delete mode 100644 Project/Web/Controllers/SettingController.cs delete mode 100644 Project/Web/Controllers/TodoController.cs delete mode 100644 Project/Web/Startup.cs diff --git a/Project/Dialog/fCommon.Designer.cs b/Project/Dialog/fCommon.Designer.cs deleted file mode 100644 index ec918a5..0000000 --- a/Project/Dialog/fCommon.Designer.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Project.Dialog -{ - partial class fCommon - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // fHolyday - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1063, 567); - this.Name = "fHolyday"; - this.Text = "근태입력"; - this.ResumeLayout(false); - - } - - #endregion - } -} \ No newline at end of file diff --git a/Project/Dialog/fCommon.cs b/Project/Dialog/fCommon.cs deleted file mode 100644 index 5e1e8c3..0000000 --- a/Project/Dialog/fCommon.cs +++ /dev/null @@ -1,87 +0,0 @@ -using FCM0000.Mail; -using FCOMMON; -using Microsoft.Web.WebView2.Core; -using Microsoft.Web.WebView2.WinForms; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Project.Dialog -{ - public partial class fCommon : fBase - { - private WebView2 webView21; - public fCommon() - { - InitializeComponent(); - - this.Text = "공용코드 관리"; - this.Size = new Size(1000, 900); - InitializeWebView2(); - - - } - private void InitializeWebView2() - { - // 수동으로 WebView2 컨트롤 생성 - this.webView21 = new WebView2(); - - // 기본 속성 설정 - this.webView21.CreationProperties = null; - this.webView21.DefaultBackgroundColor = Color.White; - this.webView21.Dock = DockStyle.Fill; - this.webView21.Location = new Point(0, 0); - this.webView21.Name = "webView21"; - this.webView21.Size = new Size(800, 600); - this.webView21.TabIndex = 0; - this.webView21.ZoomFactor = 1D; - - // 폼에 추가 - this.Controls.Add(this.webView21); - - // 비동기 초기화 - InitializeAsync(); - } - private async void InitializeAsync() - { - try - { - // Fixed Version 경로 설정 - string runtimePath = Path.Combine(Application.StartupPath, "WebView2Runtime"); - - if (Directory.Exists(runtimePath)) - { - var env = await CoreWebView2Environment.CreateAsync(runtimePath); - await this.webView21.EnsureCoreWebView2Async(env); - } - else - { - // 시스템에 설치된 WebView2 사용 - await this.webView21.EnsureCoreWebView2Async(); - } - // OWIN 서버의 DashBoard 페이지로 연결 - webView21.Source = new Uri($"{Pub.WebServiceURL}/Common"); - } - catch (Exception ex) - { - MessageBox.Show($"WebView2 초기화 실패: {ex.Message}"); - } - } - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - EnsureVisibleAndUsableSize(); - } - private void label1_Click(object sender, EventArgs e) - { - - } - } -} diff --git a/Project/Dialog/fCommon.resx b/Project/Dialog/fCommon.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Project/Dialog/fCommon.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Project/Dialog/fDashboard.Designer.cs b/Project/Dialog/fDashboard.Designer.cs deleted file mode 100644 index 66c7523..0000000 --- a/Project/Dialog/fDashboard.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Project.Dialog -{ - partial class fDashboard - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.Dock = System.Windows.Forms.DockStyle.Fill; - this.label1.Font = new System.Drawing.Font("맑은 고딕", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.label1.ForeColor = System.Drawing.Color.DimGray; - this.label1.Location = new System.Drawing.Point(0, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(1063, 567); - this.label1.TabIndex = 0; - this.label1.Text = "요약 화면 구성 중 입니다.\r\n\r\n업무일지는 \"관리->업무일지->목록\" 을 사용하세요"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.label1.Click += new System.EventHandler(this.label1_Click); - // - // fDashboard - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1063, 567); - this.Controls.Add(this.label1); - this.Name = "fDashboard"; - this.Text = "요약"; - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label label1; - } -} \ No newline at end of file diff --git a/Project/Dialog/fDashboard.cs b/Project/Dialog/fDashboard.cs deleted file mode 100644 index 9560962..0000000 --- a/Project/Dialog/fDashboard.cs +++ /dev/null @@ -1,94 +0,0 @@ -using FCM0000.Mail; -using FCOMMON; -using Microsoft.Web.WebView2.Core; -using Microsoft.Web.WebView2.WinForms; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Project.Dialog -{ - public partial class fDashboard : fBase - { - private WebView2 webView21; - public fDashboard() - { - InitializeComponent(); - - - InitializeWebView2(); - - - } - bool loadok = false; - public void RefreshView() - { - if (loadok) - webView21.Reload(); - } - private void InitializeWebView2() - { - // 수동으로 WebView2 컨트롤 생성 - this.webView21 = new WebView2(); - - // 기본 속성 설정 - this.webView21.CreationProperties = null; - this.webView21.DefaultBackgroundColor = Color.White; - this.webView21.Dock = DockStyle.Fill; - this.webView21.Location = new Point(0, 0); - this.webView21.Name = "webView21"; - this.webView21.Size = new Size(800, 600); - this.webView21.TabIndex = 0; - this.webView21.ZoomFactor = 1D; - - // 폼에 추가 - this.Controls.Add(this.webView21); - - // 비동기 초기화 - InitializeAsync(); - } - private async void InitializeAsync() - { - try - { - // Fixed Version 경로 설정 - string runtimePath = Path.Combine(Application.StartupPath, "WebView2Runtime"); - - if (Directory.Exists(runtimePath)) - { - var env = await CoreWebView2Environment.CreateAsync(runtimePath); - await this.webView21.EnsureCoreWebView2Async(env); - } - else - { - // 시스템에 설치된 WebView2 사용 - await this.webView21.EnsureCoreWebView2Async(); - } - // OWIN 서버의 DashBoard 페이지로 연결 - webView21.Source = new Uri($"{Pub.WebServiceURL}/DashBoard"); - label1.Visible = false; - loadok = true; - } - catch (Exception ex) - { - MessageBox.Show($"WebView2 초기화 실패: {ex.Message}"); - } - } - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - EnsureVisibleAndUsableSize(); - } - private void label1_Click(object sender, EventArgs e) - { - - } - } -} diff --git a/Project/Dialog/fDashboard.resx b/Project/Dialog/fDashboard.resx deleted file mode 100644 index 29dcb1b..0000000 --- a/Project/Dialog/fDashboard.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Project/Dialog/fHolyday.Designer.cs b/Project/Dialog/fHolyday.Designer.cs deleted file mode 100644 index fd15a40..0000000 --- a/Project/Dialog/fHolyday.Designer.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Project.Dialog -{ - partial class fHolyday - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // fHolyday - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1063, 567); - this.Name = "fHolyday"; - this.Text = "근태입력"; - this.ResumeLayout(false); - - } - - #endregion - } -} \ No newline at end of file diff --git a/Project/Dialog/fHolyday.cs b/Project/Dialog/fHolyday.cs deleted file mode 100644 index 99f23d0..0000000 --- a/Project/Dialog/fHolyday.cs +++ /dev/null @@ -1,86 +0,0 @@ -using FCM0000.Mail; -using FCOMMON; -using Microsoft.Web.WebView2.Core; -using Microsoft.Web.WebView2.WinForms; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Project.Dialog -{ - public partial class fHolyday : fBase - { - private WebView2 webView21; - public fHolyday() - { - InitializeComponent(); - - - InitializeWebView2(); - - - } - private void InitializeWebView2() - { - // 수동으로 WebView2 컨트롤 생성 - this.webView21 = new WebView2(); - - // 기본 속성 설정 - this.webView21.CreationProperties = null; - this.webView21.DefaultBackgroundColor = Color.White; - this.webView21.Dock = DockStyle.Fill; - this.webView21.Location = new Point(0, 0); - this.webView21.Name = "webView21"; - this.webView21.Size = new Size(800, 600); - this.webView21.TabIndex = 0; - this.webView21.ZoomFactor = 1D; - - // 폼에 추가 - this.Controls.Add(this.webView21); - - // 비동기 초기화 - InitializeAsync(); - } - private async void InitializeAsync() - { - try - { - // Fixed Version 경로 설정 - string runtimePath = Path.Combine(Application.StartupPath, "WebView2Runtime"); - - if (Directory.Exists(runtimePath)) - { - var env = await CoreWebView2Environment.CreateAsync(runtimePath); - await this.webView21.EnsureCoreWebView2Async(env); - } - else - { - // 시스템에 설치된 WebView2 사용 - await this.webView21.EnsureCoreWebView2Async(); - } - // OWIN 서버의 DashBoard 페이지로 연결 - webView21.Source = new Uri($"{Pub.WebServiceURL}/kuntae"); - } - catch (Exception ex) - { - MessageBox.Show($"WebView2 초기화 실패: {ex.Message}"); - } - } - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - EnsureVisibleAndUsableSize(); - } - private void label1_Click(object sender, EventArgs e) - { - - } - } -} diff --git a/Project/Dialog/fHolyday.resx b/Project/Dialog/fHolyday.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Project/Dialog/fHolyday.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Project/Dialog/fJobReport.Designer.cs b/Project/Dialog/fJobReport.Designer.cs deleted file mode 100644 index c8a5b49..0000000 --- a/Project/Dialog/fJobReport.Designer.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Project.Dialog -{ - partial class fJobReport - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // fJobReport - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1063, 567); - this.Name = "fJobReport"; - this.Text = "업무일지"; - this.ResumeLayout(false); - - } - - #endregion - } -} \ No newline at end of file diff --git a/Project/Dialog/fJobReport.cs b/Project/Dialog/fJobReport.cs deleted file mode 100644 index 172b956..0000000 --- a/Project/Dialog/fJobReport.cs +++ /dev/null @@ -1,86 +0,0 @@ -using FCM0000.Mail; -using FCOMMON; -using Microsoft.Web.WebView2.Core; -using Microsoft.Web.WebView2.WinForms; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Project.Dialog -{ - public partial class fJobReport : fBase - { - private WebView2 webView21; - public fJobReport() - { - InitializeComponent(); - - - InitializeWebView2(); - - - } - private void InitializeWebView2() - { - // 수동으로 WebView2 컨트롤 생성 - this.webView21 = new WebView2(); - - // 기본 속성 설정 - this.webView21.CreationProperties = null; - this.webView21.DefaultBackgroundColor = Color.White; - this.webView21.Dock = DockStyle.Fill; - this.webView21.Location = new Point(0, 0); - this.webView21.Name = "webView21"; - this.webView21.Size = new Size(800, 600); - this.webView21.TabIndex = 0; - this.webView21.ZoomFactor = 1D; - - // 폼에 추가 - this.Controls.Add(this.webView21); - - // 비동기 초기화 - InitializeAsync(); - } - private async void InitializeAsync() - { - try - { - // Fixed Version 경로 설정 - string runtimePath = Path.Combine(Application.StartupPath, "WebView2Runtime"); - - if (Directory.Exists(runtimePath)) - { - var env = await CoreWebView2Environment.CreateAsync(runtimePath); - await this.webView21.EnsureCoreWebView2Async(env); - } - else - { - // 시스템에 설치된 WebView2 사용 - await this.webView21.EnsureCoreWebView2Async(); - } - // OWIN 서버의 DashBoard 페이지로 연결 - webView21.Source = new Uri($"{Pub.WebServiceURL}/Jobreport"); - } - catch (Exception ex) - { - MessageBox.Show($"WebView2 초기화 실패: {ex.Message}"); - } - } - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - EnsureVisibleAndUsableSize(); - } - private void label1_Click(object sender, EventArgs e) - { - - } - } -} diff --git a/Project/Dialog/fJobReport.resx b/Project/Dialog/fJobReport.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Project/Dialog/fJobReport.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Project/Dialog/fLogin_WB.Designer.cs b/Project/Dialog/fLogin_WB.Designer.cs deleted file mode 100644 index 5e780c5..0000000 --- a/Project/Dialog/fLogin_WB.Designer.cs +++ /dev/null @@ -1,289 +0,0 @@ -namespace Project.Dialog -{ - partial class fLogin_WB - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(fLogin)); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.panel1 = new System.Windows.Forms.Panel(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.listView1 = new System.Windows.Forms.ListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.linkLabel1 = new System.Windows.Forms.LinkLabel(); - this.label4 = new System.Windows.Forms.Label(); - this.cmbDept = new System.Windows.Forms.ComboBox(); - this.label3 = new System.Windows.Forms.Label(); - this.tbID = new System.Windows.Forms.ComboBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.tbPW = new System.Windows.Forms.TextBox(); - this.panel2 = new System.Windows.Forms.Panel(); - this.btLogin = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.panel1.SuspendLayout(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.panel2.SuspendLayout(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.Location = new System.Drawing.Point(405, 25); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(80, 80); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBox1.TabIndex = 3; - this.pictureBox1.TabStop = false; - // - // panel1 - // - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(245)))), ((int)(((byte)(244))))); - this.panel1.Controls.Add(this.tabControl1); - this.panel1.Controls.Add(this.linkLabel1); - this.panel1.Controls.Add(this.label4); - this.panel1.Controls.Add(this.cmbDept); - this.panel1.Controls.Add(this.label3); - this.panel1.Controls.Add(this.tbID); - this.panel1.Controls.Add(this.label2); - this.panel1.Controls.Add(this.label1); - this.panel1.Controls.Add(this.tbPW); - this.panel1.Controls.Add(this.pictureBox1); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(888, 639); - this.panel1.TabIndex = 0; - // - // tabControl1 - // - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point(16, 288); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(860, 327); - this.tabControl1.TabIndex = 13; - // - // tabPage1 - // - this.tabPage1.Controls.Add(this.listView1); - this.tabPage1.Location = new System.Drawing.Point(4, 32); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(852, 291); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "FAQ"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // listView1 - // - this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1}); - this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; - this.listView1.HideSelection = false; - this.listView1.Location = new System.Drawing.Point(3, 3); - this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(846, 285); - this.listView1.TabIndex = 13; - this.listView1.UseCompatibleStateImageBehavior = false; - this.listView1.View = System.Windows.Forms.View.Details; - this.listView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDoubleClick); - // - // columnHeader1 - // - this.columnHeader1.Text = "제목"; - this.columnHeader1.Width = 836; - // - // tabPage2 - // - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(852, 301); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "PATCH"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // linkLabel1 - // - this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(806, 110); - this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(70, 23); - this.linkLabel1.TabIndex = 11; - this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "신규가입"; - this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("맑은 고딕", 9F); - this.label4.ForeColor = System.Drawing.Color.Teal; - this.label4.Location = new System.Drawing.Point(13, 257); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(243, 15); - this.label4.TabIndex = 10; - this.label4.Text = "문의 ) Chickyun.kim@amkor.co.kr, T.8567"; - // - // cmbDept - // - this.cmbDept.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbDept.Font = new System.Drawing.Font("Calibri", 20.25F); - this.cmbDept.FormattingEnabled = true; - this.cmbDept.Location = new System.Drawing.Point(16, 136); - this.cmbDept.Name = "cmbDept"; - this.cmbDept.Size = new System.Drawing.Size(860, 41); - this.cmbDept.TabIndex = 9; - this.cmbDept.SelectedIndexChanged += new System.EventHandler(this.cmbDept_SelectedIndexChanged); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.ForeColor = System.Drawing.Color.Gray; - this.label3.Location = new System.Drawing.Point(13, 119); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(31, 15); - this.label3.TabIndex = 8; - this.label3.Text = "부서"; - // - // tbID - // - this.tbID.Font = new System.Drawing.Font("Calibri", 20.25F); - this.tbID.FormattingEnabled = true; - this.tbID.ImeMode = System.Windows.Forms.ImeMode.Alpha; - this.tbID.Location = new System.Drawing.Point(16, 205); - this.tbID.Name = "tbID"; - this.tbID.Size = new System.Drawing.Size(364, 41); - this.tbID.TabIndex = 3; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("맑은 고딕", 9F); - this.label2.ForeColor = System.Drawing.Color.Gray; - this.label2.Location = new System.Drawing.Point(509, 187); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(31, 15); - this.label2.TabIndex = 4; - this.label2.Text = "암호"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.Gray; - this.label1.Location = new System.Drawing.Point(13, 188); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(55, 15); - this.label1.TabIndex = 2; - this.label1.Text = "사원번호"; - // - // tbPW - // - this.tbPW.Font = new System.Drawing.Font("Calibri", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.tbPW.ImeMode = System.Windows.Forms.ImeMode.Alpha; - this.tbPW.Location = new System.Drawing.Point(512, 205); - this.tbPW.Name = "tbPW"; - this.tbPW.PasswordChar = '●'; - this.tbPW.Size = new System.Drawing.Size(364, 40); - this.tbPW.TabIndex = 5; - this.tbPW.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // panel2 - // - this.panel2.BackColor = System.Drawing.SystemColors.Control; - this.panel2.Controls.Add(this.btLogin); - this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel2.Location = new System.Drawing.Point(0, 639); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(888, 82); - this.panel2.TabIndex = 6; - // - // btLogin - // - this.btLogin.Dock = System.Windows.Forms.DockStyle.Fill; - this.btLogin.Font = new System.Drawing.Font("맑은 고딕", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btLogin.Location = new System.Drawing.Point(0, 0); - this.btLogin.Name = "btLogin"; - this.btLogin.Size = new System.Drawing.Size(888, 82); - this.btLogin.TabIndex = 0; - this.btLogin.Text = "접속"; - this.btLogin.UseVisualStyleBackColor = true; - this.btLogin.Click += new System.EventHandler(this.button1_Click); - // - // fLogin - // - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.BackColor = System.Drawing.Color.OrangeRed; - this.ClientSize = new System.Drawing.Size(888, 721); - this.Controls.Add(this.panel1); - this.Controls.Add(this.panel2); - this.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "fLogin"; - this.Text = "사용자확인"; - this.Load += new System.EventHandler(this.fLogin_Load); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.panel2.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.Button btLogin; - public System.Windows.Forms.TextBox tbPW; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox tbID; - private System.Windows.Forms.ComboBox cmbDept; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.LinkLabel linkLabel1; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.ListView listView1; - private System.Windows.Forms.ColumnHeader columnHeader1; - private System.Windows.Forms.TabPage tabPage2; - } -} \ No newline at end of file diff --git a/Project/Dialog/fLogin_WB.cs b/Project/Dialog/fLogin_WB.cs deleted file mode 100644 index 5e8c87f..0000000 --- a/Project/Dialog/fLogin_WB.cs +++ /dev/null @@ -1,491 +0,0 @@ -using FCOMMON; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Net; -using System.Net.NetworkInformation; -using System.Text; -using System.Windows.Forms; -using Microsoft.Web.WebView2.Core; -using Microsoft.Web.WebView2.WinForms; -using System.IO; - -namespace Project.Dialog -{ - public partial class fLogin_WB : fBase - { - private WebView2 webView21; - public fLogin_WB() - { - InitializeComponent(); - InitializeWebView2(); - this.tbID.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.Enter) tbPW.Focus(); }; - this.tbPW.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.Enter) btLogin.PerformClick(); }; - this.KeyPreview = true; - this.KeyDown += (s1, e1) => - { - if (e1.KeyCode == Keys.Escape) this.Close(); - }; - this.Text = string.Format("사용자 확인(v{0})", Application.ProductVersion); - - var lv = this.listView1.Items.Add("[25-04-06] 데이터베이스 이전 작업 완료 (버그신고:chikyun.kim@amkor.co.kr)"); - lv.Tag = "기존 데이터베이스 삭제 예정으로 인한 신규 데이터베이스 업데이트 작업 완료\n일부 기능에 문제가 발생할 수 있습니다. 문제 발생시에는 chikyun.kim@amkor.co.kr 로 문의 주세요"; - - - } - private void InitializeWebView2() - { - // 수동으로 WebView2 컨트롤 생성 - this.webView21 = new WebView2(); - - // 기본 속성 설정 - this.webView21.CreationProperties = null; - this.webView21.DefaultBackgroundColor = Color.White; - this.webView21.Dock = DockStyle.Fill; - this.webView21.Location = new Point(0, 0); - this.webView21.Name = "webView21"; - this.webView21.Size = new Size(800, 600); - this.webView21.TabIndex = 0; - this.webView21.ZoomFactor = 1D; - - // 폼에 추가 - this.Controls.Clear(); - this.Controls.Add(this.webView21); - - // 비동기 초기화 - InitializeAsync(); - } - - private async void InitializeAsync() - { - try - { - // Fixed Version 경로 설정 - string runtimePath = Path.Combine(Application.StartupPath, "WebView2Runtime"); - - if (Directory.Exists(runtimePath)) - { - var env = await CoreWebView2Environment.CreateAsync(runtimePath); - await this.webView21.EnsureCoreWebView2Async(env); - } - else - { - // 시스템에 설치된 WebView2 사용 - await this.webView21.EnsureCoreWebView2Async(); - } - // WebView2에서 C# 메서드를 호출할 수 있도록 설정 - webView21.CoreWebView2.WebMessageReceived += WebView2_WebMessageReceived; - - //var wwwroot = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "web", "wwwroot"); - //var mapnme = $"gw{DateTime.Now.ToString("mmssfff")}.local"; - //webView21.CoreWebView2.SetVirtualHostNameToFolderMapping(mapnme, wwwroot, CoreWebView2HostResourceAccessKind.Allow); - //Pub.WebServiceURL = $"http://{mapnme}"; - - // OWIN 서버의 Login 페이지로 연결 - webView21.Source = new Uri($"{Pub.WebServiceURL}/home/login"); - label1.Visible = false; - } - catch (Exception ex) - { - MessageBox.Show($"WebView2 초기화 실패: {ex.Message}"); - } - } - // WebView2에서 보낸 메시지를 받아서 처리 - private void WebView2_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e) - { - try - { - var message = e.TryGetWebMessageAsString(); - - if (message == "LOGIN_SUCCESS") - { - // UI 스레드에서 실행 - this.Invoke(new Action(() => - { - // button1_Click과 동일한 로직 실행 - ExecuteLoginLogic(); - })); - } - } - catch (Exception ex) - { - Console.WriteLine($"WebView2 메시지 처리 오류: {ex.Message}"); - } - } - - // 로그인 성공 시 실행할 로직 (button1_Click과 동일) - private void ExecuteLoginLogic() - { - DateTime dt = DateTime.Now; - - // 로그인 정보가 이미 설정되어 있다고 가정 (웹에서 처리됨) - if (string.IsNullOrEmpty(FCOMMON.info.Login.no)) - { - MessageBox.Show("로그인 정보가 설정되지 않았습니다."); - return; - } - - try - { - // 로그인정보 기록 - AddLoginInfo(); - - //210221 - Pub.MakeAutoJobReportbyLogin(); - - //210613 - Pub.MakeAutoJobReportByAuto(); - - DialogResult = DialogResult.OK; - FCOMMON.info.Login.loginusetime = (DateTime.Now - dt).TotalMilliseconds; - } - catch (Exception ex) - { - Util.MsgE("로그인 처리 중 오류가 발생했습니다.\n\n" + ex.Message); - DialogResult = System.Windows.Forms.DialogResult.Cancel; - } - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - EnsureVisibleAndUsableSize(); - } - - private void fLogin_Load(object sender, EventArgs e) - { - //EnsureVisibleAndUsableSize(); - var list = Pub.setting.lastid.Split(';'); - foreach (var item in list) - if (item != "") tbID.Items.Add(item); - if (tbID.Items.Count > 0) tbID.SelectedIndex = 0; - - - - //S1 사용자 그룹목록 확인 - //var tas1 = new S1ACCESS300Entities(); - //var deptlist = tas1.VIEW_CARD_PERSON - // .Where(t => t.CardStatusID == 0 && string.IsNullOrEmpty(t.CardUser2) == false) - // .GroupBy(t => t.PersonUser2) - // .OrderBy(t => t.Key) - // .ToList(); - - //this.cmbDept.Items.Clear(); - //foreach (var dept in deptlist) - // cmbDept.Items.Add(dept); - - - //그룹목록가져오기 - //Util.MsgE(Properties.Settings.Default.CS); - var tagrp = new dsMSSQLTableAdapters.UserGroupTableAdapter(); - //Util.MsgE(tagrp.Connection.ConnectionString); - var grplist = tagrp.GetData(); - this.cmbDept.DataSource = grplist; - this.cmbDept.DisplayMember = "dept"; - this.cmbDept.ValueMember = "gcode"; - - //마지막으로사용한 부서이름 - if (Pub.setting.lastdpt.isEmpty()) this.cmbDept.SelectedIndex = -1; - else this.cmbDept.Text = Pub.setting.lastdpt; - if (cmbDept.SelectedIndex == -1 && Pub.setting.lastgcode.isEmpty() == false) - { - var dr = grplist.Where(t => t.gcode.Equals(Pub.setting.lastgcode)).FirstOrDefault(); - if (dr != null) cmbDept.Text = dr.dept; - } - //foreach (var item in dlist) - // if (item != "") this.cmbDept.Items.Add(item); - //if (cmbDept.Items.Count > 0) cmbDept.SelectedIndex = 0; - - this.Show(); - Application.DoEvents(); - - if (this.tbID.Text.isEmpty() == false) tbPW.Focus(); - else tbID.Focus(); - } - private void button1_Click(object sender, EventArgs e) - { - DateTime dt = DateTime.Now; - - //if(tbID.Text != "dev" && (dt.ToShortDateString() == "2025-04-05" || - // dt.ToShortDateString() == "2025-04-06")) - //{ - // Util.MsgE("4월 5일~6일은 데이터베이스 마이그레이션 기간이므로 프로그램 사용이 중단 됩니다\n문의 010-9155-9051 (EEDP:김치균)"); - // return; - //} - if (this.tbID.Text.isEmpty()) - { - tbID.Focus(); - return; - } - if (this.tbPW.Text.isEmpty()) - { - tbPW.Focus(); - return; - } - if (cmbDept.SelectedIndex < 0) - { - FCOMMON.Util.MsgE("소속 부서를 선택하세요"); - cmbDept.Focus(); - return; - } - - List idlist = new List(); - idlist.Add(tbID.Text.Trim()); - foreach (var item in this.tbID.Items) - if (idlist.Contains(item) == false) idlist.Add(item.ToString()); - - //List deptlist = new List(); - //deptlist.Add(cmbDept.Text.Trim()); - //foreach (var item in this.cmbDept.Items) - // if (deptlist.Contains(item) == false) deptlist.Add(item.ToString()); - - //180605 - var vuserlist = ""; - foreach (var item in idlist) - vuserlist += ";" + item; - - //var vdeptlist = ""; - //foreach(var item in deptlist) - // vdeptlist += ";" + item; - - var gCode = this.cmbDept.SelectedValue.ToString();// as dsMSSQL.UserGroupRow; - - Pub.setting.lastid = vuserlist;// tbID.Text.Trim(); - Pub.setting.lastdpt = cmbDept.Text; //부서저장 201006 - Pub.setting.lastgcode = gCode; - Pub.setting.Save(); - - var encpass = Pub.MakePasswordEnc(tbPW.Text.Trim()); - var id = tbID.Text.Trim(); - //var ta = new dsMSSQLTableAdapters.QueriesTableAdapter();//.UsersTableAdapter(); - try - { - if (id.ToUpper().Equals("DEV") == false) - { - var taGrpUser = new dsMSSQLTableAdapters.EETGW_GroupUserTableAdapter(); - var drGrpUser = taGrpUser.GetbyID(gCode, id).FirstOrDefault(); - if (drGrpUser == null) - { - Util.MsgE($"입력한 사용자 계정이 존재하지 않습니다\n\n담당부서명:{cmbDept.Text}\n부서코드:{gCode}\n\n접속 부서를 확인하시고 관리자 문의 하세요"); - tbPW.SelectAll(); - tbPW.Focus(); - return; - } - else if (drGrpUser.level == 0) - { - Util.MsgE($"해당 계정이 활성화되지 않았습니다\n계정 담당자 문의하세요"); - tbPW.SelectAll(); - tbPW.Focus(); - return; - } - - //사용자테이블에서 암호를 확인합니다. - var taUser = new dsMSSQLTableAdapters.UsersTableAdapter(); - var drUser = taUser.GetID(id).FirstOrDefault(); - if (drUser == null) - { - Util.MsgE($"입력한 사용자 계정이 존재하지 않습니다\n\n담당부서명:{cmbDept.Text}\n부서코드:{gCode}\n\n접속 부서를 확인하시고 관리자 문의 하세요"); - tbPW.SelectAll(); - tbPW.Focus(); - return; - } - else if (drUser.password.Equals(encpass) == false) - { - Util.MsgE($"암호가 일치하지 않습니다.\n암호를 분실했을 경우에는 계정담당자에 초기화를 요청 하세요"); - tbPW.SelectAll(); - tbPW.Focus(); - return; - } - - //이사용자의 부서 코드확인 - //var taUser = new dsMSSQLTableAdapters.vGroupUserTableAdapter(); - //var userdr = taUser.GetByID(userGcode, id).Rows[0] as dsMSSQL.vGroupUserRow; - - var MaxVerstion = FCOMMON.DBM.GetMaxVersion(); - if (MaxVerstion.isEmpty() == false) - { - var curversion = Application.ProductVersion; - var verchk = curversion.CompareTo(MaxVerstion); - if (verchk < 0) - { - //내버젼이 낮다 - Util.MsgE("현재 구 버젼을 사용하고 있습니다.\n업데이트를 진행 하고 사용하시기 바랍니다"); - } - } - - FCOMMON.info.Login.no = drUser.id; - FCOMMON.info.Login.nameK = drUser.name; - FCOMMON.info.Login.dept = cmbDept.Text;// userdr.dept;// cmbDept.Text; - FCOMMON.info.Login.level = drGrpUser.level; - FCOMMON.info.Login.email = drUser.email; - FCOMMON.info.Login.nameE = drUser.nameE; - FCOMMON.info.Login.hp = drUser.hp; - FCOMMON.info.Login.tel = drUser.tel; - FCOMMON.info.Login.title = drUser.dept + "(" + drUser.grade + ")"; - FCOMMON.info.NotShowJobReportview = Pub.setting.NotShowJobreportPRewView; - //var gcode = FCOMMON.DBM.ExecuteScalar("select isnull(gcode,'NOGCODE') from UserGroup where dept ='" + cmbDept.Text + "'"); - var gperm = FCOMMON.DBM.ExecuteScalar("select isnull(permission,0) from UserGroup where dept ='" + cmbDept.Text + "'"); - FCOMMON.info.Login.gcode = gCode;// gcode; - FCOMMON.info.Login.process = drUser.id == "dev" ? "개발자" : drGrpUser.Process; - FCOMMON.info.Login.permission = 0; - FCOMMON.info.Login.gpermission = int.Parse(gperm); - //FCOMMON.info.datapath = Pub.setting.SharedDataPath; - FCOMMON.info.ShowBuyerror = Pub.setting.Showbuyerror; //210625 - - - - } - else - { - if (tbPW.Text.Equals("123") == false) - { - return; - } - FCOMMON.info.Login.no = "dev"; - FCOMMON.info.Login.nameK = "개발자"; - FCOMMON.info.Login.dept = cmbDept.Text;// userdr.dept;// cmbDept.Text; - FCOMMON.info.Login.level = 10; - FCOMMON.info.Login.email = ""; - FCOMMON.info.Login.nameE = "DEVELOPER"; - FCOMMON.info.Login.hp = ""; - FCOMMON.info.Login.tel = ""; - FCOMMON.info.Login.title = "업무일지 개발자"; - FCOMMON.info.NotShowJobReportview = Pub.setting.NotShowJobreportPRewView; - //var gcode = FCOMMON.DBM.ExecuteScalar("select isnull(gcode,'NOGCODE') from UserGroup where dept ='" + cmbDept.Text + "'"); - var gperm = FCOMMON.DBM.ExecuteScalar("select isnull(permission,0) from UserGroup where dept ='" + cmbDept.Text + "'"); - FCOMMON.info.Login.gcode = gCode; - FCOMMON.info.Login.process = "개발자"; - FCOMMON.info.Login.permission = 0; - FCOMMON.info.Login.gpermission = int.Parse(gperm); - //var datapath = FCOMMON.DBM.getCodeSavlue("55", "01"); - //FCOMMON.info.datapath = datapath;// Pub.setting.SharedDataPath; - FCOMMON.info.ShowBuyerror = Pub.setting.Showbuyerror; //210625 - } - - //if (FCOMMON.info.datapath.isEmpty() && gCode == "EET1P") //210524 - // FCOMMON.info.datapath = @"\\k4fs3201n\k4bpartcenter$"; - //using (var dbEnity = new EEEntitiesMain()) - //{ - // var drGrpUser = dbEnity.EETGW_GroupUser.Where(t => t.uid == userdr.id & t.gcode == gCode).FirstOrDefault(); - // if (drGrpUser == null) FCOMMON.info.Login.process = (userdr.id == "dev" ? "개발자" : ""); - // else FCOMMON.info.Login.process = drGrpUser.Process; - //} - - //로그인정보 기록 - AddLoginInfo(); - - //210221 - Pub.MakeAutoJobReportbyLogin(); - - //210613 - Pub.MakeAutoJobReportByAuto(); - - DialogResult = DialogResult.OK; - FCOMMON.info.Login.loginusetime = (DateTime.Now - dt).TotalMilliseconds; - } - catch (Exception ex) - { - Util.MsgE("데이터베이스 조회 실패 다음 오류 메세지를 참고하세요.\n\n" + ex.Message + "\n\n증상이 동일 할 경우 서버가 접속가능한지 먼저 확인하세요"); - DialogResult = System.Windows.Forms.DialogResult.Cancel; - } - } - - - - void AddLoginInfo() - { - string ip = string.Empty; - string hostname = Dns.GetHostName(); - string fullname = System.Net.Dns.GetHostEntry("").HostName; - - var nif = NetworkInterface.GetAllNetworkInterfaces(); - var host = Dns.GetHostEntry(hostname); - foreach (IPAddress r in host.AddressList) - { - string str = r.ToString(); - - if (str != "" && str.Substring(0, 3) == "10.") - { - ip = str; - break; - } - } - - if (ip == "" || hostname == "") return; - - try - { - var ta = new dsMSSQLTableAdapters.EETGW_LoginInfoTableAdapter(); - ta.Insert(FCOMMON.info.Login.no, DateTime.Now, ip, fullname, info.Login.no, DateTime.Now); - } - catch (Exception ex) - { - FCOMMON.Util.MsgE(ex.Message); - Console.WriteLine(ex.Message); - } - } - private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - FCOMMON.Util.RunExplorer("mailto:chikyun.kim@amkor.co.kr"); - } - - private void cmbDept_SelectedIndexChanged(object sender, EventArgs e) - { - //부서명이 변경되었다 - label4.Text = "문의) 정보없음(?)"; - var sel = cmbDept.SelectedItem as DataRowView; - if (sel == null) return; - var dr = sel.Row as dsMSSQL.UserGroupRow; - if (dr == null) return; - - var admin = dr.managerinfo; - if (string.IsNullOrEmpty(admin)) - admin = "--"; - - var dev = dr.devinfo; - if (string.IsNullOrEmpty(dev)) - dev = "chikyun.kim@amkor.co.kr(T8567)"; - - label4.Text = $"문의) 관리:{admin},개발:{dev}"; - - } - - private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - //if (System.Diagnostics.Debugger.IsAttached == false) - //{ - // Util.MsgE("이 기능은 준비중 입니다"); - // return; - //} - - var gCode = this.cmbDept.SelectedValue.ToString();// as dsMSSQL.UserGroupRow; - FCOMMON.info.Login.gcode = gCode; - FCOMMON.info.Login.no = "new"; - FCOMMON.info.Login.dept = this.cmbDept.Text; - - var dlg = FCOMMON.Util.MsgQ($"현재 선택된 그룹[{this.cmbDept.Text}]의 사용자를 추가할까요?\n" + - "추가된 사용자는 담당자로부터 승인 완료되어야 접속이 가능 합니다\n" + - "사용자 추가 후 그룹담당자에게 문의 하시기 바랍니다"); - if (dlg != DialogResult.Yes) return; - var f = new _Common.fAddNewUser(cmbDept.Text, string.Empty, 0);//.fUserInfo(); - dlg = f.ShowDialog(); - if (dlg == DialogResult.OK) - { - tbID.Text = f.tbId.Text.Trim(); - } - } - - private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) - { - var lv = this.listView1.FocusedItem; - if (lv == null) return; - if (lv.Tag == null) return; - var msg = lv.Tag.ToString(); - Util.MsgI(msg); - - } - } -} diff --git a/Project/Dialog/fLogin_WB.resx b/Project/Dialog/fLogin_WB.resx deleted file mode 100644 index 0f2f96b..0000000 --- a/Project/Dialog/fLogin_WB.resx +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAb - rQAAG60BIeRSlQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAeaSURBVHhe7Vrr - bxRVFK9+8ItRY/Qf8BE1auIravykRpjdlvcbFCMkxsREfACKxmCqobszW55CUikgL5ECkoLQIkTjB9md - 2W6rQmm7te1SmijvtpQ3FMZzZs+F6fYMULZ3d7adX/ILZM+555z768w9985MngcPHoao1fcpochwRTNC - PlWvBDYD21PYpGh6BfyroW9+oXEvDR+cKCw071S0yGifGtkGolwEmn0kjDHKgaMwFoUdBDDNO/zByBQQ - oD5FkHRYB5xIGQYu8kPhR2Civ9om3q/0q5HdQ4KxhyndwAJddV2pk7bxkF+LLIdb+k1fSH9+xPzqB4cF - /7gfif9XgsYLlk3VS32a3pYy1s5OyDWB0g4AwC0Lkw8wE0V2gxhl+aHIq31Zx9DXH9Rf82nGZisGG9v4 - GnPTkBwFTAAEKmEnGNR3FASij5HnbcOv7X2cunPvHJA7p0X0BSPfMBM7C1fO2+TSb4Arcpqi6ueYfBq5 - 5BaUoD6JmcwxXMvIpd/hD4ZfhBwnUnKacIW+RS65AbjyHoXCUxvG8fyA8SS5SINSFH4acp1MyX0qp7oz - bCd+S5nAeZ8WeYnM0uEPhF+BnBd61mD8QmZ3g7t1YW16n8wZA+SckVoHbG/GkNmdwO0FFNrQs/DITjJn - HJAfz9W2WvQ6Vx/74K+en1JwtxKIPEHmjMOnVj2FNdhrguXFR2b3AYrbYi8WBF1PpqwBtkw/2mvCjTuZ - 3IWR2t57oMAeC7cS0F8mc9ZADeV6TbBXVIr33U1m98AfMArshQKbyJRd4GlI1RP22oYGDYWs7gHcGqq9 - SGgey8iUdSiq8V3P2vQiMrkHeLa1F4lPX8iUdfhVY6q9NnyISyb3AAprtBc5NBR+lkxZR/JRmF1AvZ5M - 7gEU1eP49EYg+gCZsg58nmivDXiMTO4BFHXJXuSEwrq7yJR1YC322oAXyOQepBRo0s+ugdvr8wRMF24v - 0O31eQKmC7cX6Pb6PAH7gvxg5DnYzX8FheyBI1wt/HvUXlyO8CjVDnMw5srf+OP7XdWYDAl7nDgGFo04 - PlHv91eh+P4WEtSIRBOXVpuBHQmzorbDjBw8ax44csk82Hk1p4g1Y+0Vte3WXCZ8W31NSL8aieGLMZp+ - elBUfQQEPY2Bp5b8ZW6tOW4mOviicpk4J5wbzpGE7MLP6EiG2wOsDa9DIOuI9vmmRjN+optNPpAYP37Z - nFPWKES8iJ+dkBx9g/UllZZ8QFBc2WommGQDlXg1ahUHLRHhDjyhFEcfIlluEcmnuFEM8FlZfEDesjcj - znn2xri4EsN9aiyKZozHgZOW1liXNJdgMLD+2GWrYaIWt/5OOXn1We92N0SPsoEHE9frR8RVWEcK3Rj4 - cSMOmLLsT7Ol4wobdDARNZi8rIZEjD5DMjkDHIvQOVTRygaUzXDijJV7+vK/zbGLYxanl+6zGlkY9m3c - GNlUqaHg53okkzPA8Xd03rm/nQ0mi80nr5jBnQkzXzPELdOLaMPJNLdn9s7Ysa/dyo8fTZFMzgDHf9A5 - eugcG0wGUbyPf6hPihQyzNmbE+bq2GmzvP6SxdVVXfBbi1lA4n6yod4aw8WSQaP1LP0RjTjJ5AxwtE4d - mey+835usQocu6TGXFt92qxsvspyDYg6bnFyPcLjFxdLBlGLpIB6F8nkDHJkA8kgrnl+TTeHFUfNdTVn - WOHsRIELQlHrdo4kMrcmCl1IJmdkWkCxQH+xtZUVjOOcn5JjsLFwMWVQ6EIyOUM4ckFkcBp0W8yHax4n - FsfvYU3EMdiduZgyKHQhmZwhHLkgMjhyQZWVb3tjNysWx+3x5JqEY7mYMih0IZmcIRy5IDI4emFSwPKG - y6xYHLEz45gxi2JsTBkUupBMzhCOXBAZfHflfivfqugpViyOK4xT1pj3Vu1nY8qg0IVkcoZw5ILIIDYC - zDdrUwsrFseZ4Itj5u/ymohZBRt23MbgtmQlXFmcYHauMDotXxxT1XaejSmDrhUQuWj3ISvnqIUxSyBO - OGSp3glrZszyXbKnjY0li0IXkskZwpELIot4tp21scHKi8e1udvazMqm68JVNF0xvyxvu3aU+3RjPONP - ioQuJJMzhCMXRCZRELEe4vbEfuVVAIfPT3Zr9MnGYzahC8nkDOHIBZHNPQ2dVu5pKw70EBD5TmmtZUMf - bqxsCl1IJmcIRy6IbK7e+5+VG7tsqoAzy5Kdd034MDtWNoUuJJMzhCMXRDbxCQvmLtr1by8B58FvaMNn - htxY2RS6kEzOEI5cENn8YG2dlbsk3NFLwJJw8qHmjHV17FjZFLqQTM4QjlwQ2Ry3JPkGbEvthV4Cbobf - 0DYefLixsil0IZmcIRy5IDJZe/iilXfkglgv8QTRhj7oy8WQSaELyeQM4cgFkcnd9c4dWBBt6JONTix0 - IZmcIRy5IDJ5ow4smM1OLHQhmZwhHLkgMik6MHZbTjxkNjux0IVkcoZw5ILI5IfQXUXum/Gj9ZnvxCI3 - yeQM4cgFkUnRgW+F6MvFkEmRm2RyhnDkggxmegKmSU/ANOkJmCY9AdOkJ2Ca9ARMk56AabLPAnrkSTI5 - gxvk8TpJJg8ePHjwkJeX9z9IbqKdvJUGzgAAAABJRU5ErkJggg== - - - \ No newline at end of file diff --git a/Project/EETGW.csproj b/Project/EETGW.csproj index b3324b6..1ee4a2d 100644 --- a/Project/EETGW.csproj +++ b/Project/EETGW.csproj @@ -146,24 +146,6 @@ ..\DLL\libxl.net.dll - - ..\packages\Microsoft.Owin.4.2.2\lib\net45\Microsoft.Owin.dll - - - ..\packages\Microsoft.Owin.Cors.4.2.2\lib\net45\Microsoft.Owin.Cors.dll - - - ..\packages\Microsoft.Owin.FileSystems.4.2.2\lib\net45\Microsoft.Owin.FileSystems.dll - - - ..\packages\Microsoft.Owin.Host.HttpListener.4.2.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll - - - ..\packages\Microsoft.Owin.Hosting.4.1.1\lib\net45\Microsoft.Owin.Hosting.dll - - - ..\packages\Microsoft.Owin.StaticFiles.4.2.0\lib\net45\Microsoft.Owin.StaticFiles.dll - ..\packages\Microsoft.ReportingServices.ReportViewerControl.Winforms.150.1586.0\lib\net40\Microsoft.ReportViewer.Common.dll @@ -194,9 +176,6 @@ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll - - ..\packages\Owin.1.0\lib\net40\Owin.dll - ..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.dll @@ -216,9 +195,6 @@ - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll - ..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll @@ -229,15 +205,6 @@ ..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll - - ..\packages\Microsoft.AspNet.Cors.5.2.9\lib\net45\System.Web.Cors.dll - - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.9\lib\net45\System.Web.Http.dll - - - ..\packages\Microsoft.AspNet.WebApi.Owin.5.2.9\lib\net45\System.Web.Http.Owin.dll - @@ -253,36 +220,12 @@ - - Form - - - fCommon.cs - Form fDashboardNew.cs - - Form - - - fHolyday.cs - - - Form - - - fJobReport.cs - - - Form - - - fLogin_WB.cs - Form @@ -302,12 +245,6 @@ fDisableItem.cs - - Form - - - fDashboard.cs - Form @@ -413,23 +350,6 @@ - - - - - - - - - - - - - - - - - @@ -441,7 +361,6 @@ - @@ -507,27 +426,12 @@ fDisableItem.cs - - fCommon.cs - fDashboardNew.cs - - fHolyday.cs - - - fJobReport.cs - - - fDashboard.cs - fDebug.cs - - fLogin_WB.cs - fMsgWindow.cs diff --git a/Project/Web/Controllers/APIController.cs b/Project/Web/Controllers/APIController.cs deleted file mode 100644 index 0fefd27..0000000 --- a/Project/Web/Controllers/APIController.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using System.Linq; -using System.Net.Http; -using System.Web.Http; -using Newtonsoft.Json; - -namespace Project.Web.Controllers -{ - public class APIController : BaseController - { - [HttpGet] - public HttpResponseMessage Getdata() - { - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - var sql = string.Empty; - var p_sql = getParams.Where(t => t.Key == "sql").FirstOrDefault(); - if (p_sql.Key.isEmpty() == false) sql = p_sql.Value; - else - { - var p_table = getParams.Where(t => t.Key == "table").FirstOrDefault(); - var p_gcode = getParams.Where(t => t.Key == "gcode").FirstOrDefault(); - var p_where = getParams.Where(t => t.Key == "w").FirstOrDefault(); - var p_order = getParams.Where(t => t.Key == "o").FirstOrDefault(); - sql = "select * from {0} where gcode = '{gcode}'"; - sql = string.Format(sql, p_table.Value, p_gcode.Value); - if (p_where.Key != null) sql += " and " + p_where.Value; - if (p_order.Key != null) sql += " order by " + p_order.Value; - } - - sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode); - - var cs = Properties.Settings.Default.gwcs; // "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!"; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage Gettable() - { - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - var sql = string.Empty; - var p_sql = getParams.Where(t => t.Key == "sql").FirstOrDefault(); - if (p_sql.Key.isEmpty() == false) sql = p_sql.Value; - else - { - var p_table = getParams.Where(t => t.Key == "table").FirstOrDefault(); - var p_gcode = getParams.Where(t => t.Key == "gcode").FirstOrDefault(); - var p_where = getParams.Where(t => t.Key == "w").FirstOrDefault(); - var p_order = getParams.Where(t => t.Key == "o").FirstOrDefault(); - sql = "select * from {0} where gcode = '{gcode}'"; - sql = string.Format(sql, p_table.Value, p_gcode.Value); - if (p_where.Key != null) sql += " and " + p_where.Value; - if (p_order.Key != null) sql += " order by " + p_order.Value; - } - - - sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode); - - var cs = Properties.Settings.Default.gwcs;// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!"; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - - - } - - - - [HttpGet] - public HttpResponseMessage Index() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var contents = result.Content; - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - } -} diff --git a/Project/Web/Controllers/BaseController.cs b/Project/Web/Controllers/BaseController.cs deleted file mode 100644 index 743ea38..0000000 --- a/Project/Web/Controllers/BaseController.cs +++ /dev/null @@ -1,267 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Web.Http; -using Project.Web.Model; - -namespace Project.Web.Controllers -{ - public struct MethodResult : IEquatable - { - public string Content; - public byte[] Contentb; - public string Redirecturl; - - public override bool Equals(object obj) - { - if (!(obj is MethodResult)) - return false; - - return Equals((MethodResult)obj); - } - - public override int GetHashCode() - { - if (Contentb == null) - return Content.GetHashCode() ^ Redirecturl.GetHashCode(); - else - return Content.GetHashCode() ^ Redirecturl.GetHashCode() ^ Contentb.GetHexString().GetHashCode(); - - } - - public bool Equals(MethodResult other) - { - if (Content != other.Content) - return false; - - if (Redirecturl != other.Redirecturl) - return false; - - return Contentb == other.Contentb; - } - - - public static bool operator ==(MethodResult point1, MethodResult point2) - { - return point1.Equals(point2); - } - - public static bool operator !=(MethodResult point1, MethodResult point2) - { - return !point1.Equals(point2); - } - } - - sealed class PostRequest : Attribute - { - - } - - public class BaseController : ApiController - { - public string QueryString { get; set; } - public string PostData { get; set; } - public string ParamData { get; set; } - - protected string Trig_Ctrl { get; set; } - protected string Trig_func { get; set; } - - public PageModel GetGlobalModel() - { - var config = RequestContext.Configuration; - var routeData = config.Routes.GetRouteData(Request).Values.ToList(); - var name_ctrl = routeData[0].Value.ToString(); - var name_action = routeData[1].Value.ToString(); - - - return new PageModel - { - RouteData = routeData, - urlcontrol = name_ctrl, - urlaction = name_action - }; - } - - - public MethodResult View(bool nosubdir=false) - { - var config = RequestContext.Configuration; - if (config != null) - { - var routeData = config.Routes.GetRouteData(Request).Values.ToList(); - var name_ctrl = routeData[0].Value.ToString(); - if (nosubdir) name_ctrl = string.Empty; - var name_action = routeData[1].Value.ToString(); - return View(name_ctrl, name_action); - } - else - { - return View(Trig_Ctrl + "/" + Trig_func); - } - - } - - - public static void ApplyCommonValue(ref string contents) - { - //메뉴 푸터 - 개발자 정보 - if (contents.Contains("{title}")) - contents = contents.Replace("{title}", FCOMMON.info.Login.gcode + " Groupware"); - - } - - public MethodResult View(string Controller, string Action, Boolean applydefaultview = true) - { - var retval = new MethodResult(); - - if (Action.IndexOf(".") == -1) - Action += ".html"; //기본값 html 을 넣는다 - - var file = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", Controller, Action); - - var contents = string.Empty; - - if (System.IO.File.Exists(file) == false) - { - //error 폴더의 404.html 파일을 찾는다. - var file404 = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", "Error", "404.html"); - if (System.IO.File.Exists(file404)) - { - contents = System.IO.File.ReadAllText(file404, System.Text.Encoding.UTF8); - contents = contents.Replace("{errorfilename}", file); - } - - else - contents = "ERROR CODE - 404 (NOT FOUND)
" + file; - - Console.WriteLine("view File not found : " + file); - } - else - { - //디폴트뷰의 내용을 가져온다 (있다면 적용한다) - if (applydefaultview) - { - //뷰파일이 있다면 그것을 적용한다 - var laytoutfile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", "Layout", "default.html"); - if (System.IO.File.Exists(laytoutfile)) - contents = System.IO.File.ReadAllText(laytoutfile, System.Text.Encoding.UTF8); - - var fileContents = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8); - if (String.IsNullOrEmpty(contents)) contents = fileContents; - else contents = contents.Replace("{contents}", fileContents); - } - else - { - //해당 뷰를 가져와서 반환한다 - contents = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8); - } - } - - - - - //시스템변수 replace - contents = contents.Replace("{param_control}", Trig_Ctrl); - contents = contents.Replace("{param_function}", Trig_func); - - retval.Content = contents; - return retval; - } - public MethodResult View(string viewfilename, Boolean applydefaultview = true) - { - var retval = new MethodResult(); - - if (viewfilename.IndexOf(".") == -1) - viewfilename += ".html"; //기본값 html 을 넣는다 - - var file = AppDomain.CurrentDomain.BaseDirectory + "View" + viewfilename.Replace("/", "\\"); - - var contents = string.Empty; - - if (System.IO.File.Exists(file) == false) - { - //error 폴더의 404.html 파일을 찾는다. - var file404 = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", "Error", "404.html"); - if (System.IO.File.Exists(file404)) - { - contents = System.IO.File.ReadAllText(file404, System.Text.Encoding.UTF8); - contents = contents.Replace("{errorfilename}", file); - } - - else - contents = "ERROR CODE - 404 (NOT FOUND)
" + file; - - Console.WriteLine("view File not found : " + file); - } - else - { - //디폴트뷰의 내용을 가져온다 (있다면 적용한다) - if (applydefaultview) - { - //뷰파일이 있다면 그것을 적용한다 - var laytoutfile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", "Layout", "default.html"); - if (System.IO.File.Exists(laytoutfile)) - contents = System.IO.File.ReadAllText(laytoutfile, System.Text.Encoding.UTF8); - - var fileContents = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8); - if (String.IsNullOrEmpty(contents)) contents = fileContents; - else contents = contents.Replace("{contents}", fileContents); - } - else - { - //해당 뷰를 가져와서 반환한다 - contents = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8); - } - } - - - - - - //콘텐츠내의 file 을 찾아서 처리한다. ; 정규식의 처리속도가 느릴듯하여, 그냥 처리해본다 - while (true) - { - var fileindexS = contents.IndexOf("{file:"); - if (fileindexS == -1) break; - var fileindexE = contents.IndexOf("}", fileindexS); - if (fileindexE == -1) break; - if (fileindexE <= fileindexS + 5) break; - var inlinestr = contents.Substring(fileindexS, fileindexE - fileindexS + 1); - var filename = contents.Substring(fileindexS + 7, fileindexE - fileindexS - 8); - var load_file = String.Concat(AppDomain.CurrentDomain.BaseDirectory, "View", "\\", filename.Replace("/", "\\")); - load_file = load_file.Replace("\\\\", "\\"); - String fileContents;// = String.Empty; - - Console.WriteLine("file impot : " + load_file); - if (System.IO.File.Exists(load_file)) - { - fileContents = System.IO.File.ReadAllText(load_file, System.Text.Encoding.UTF8); - } - else - { - fileContents = "{FileNotFound:" + filename + "}"; //파일이없다면 해당 부분은 오류 처리한다. - } - contents = contents.Replace(inlinestr, fileContents); - } - - //시스템변수 replace - contents = contents.Replace("{param_control}", Trig_Ctrl); - contents = contents.Replace("{param_function}", Trig_func); - - retval.Content = contents; - return retval; - } - protected class Parameter - { - public string Key { get; set; } - public string Value { get; set; } - public Parameter(string key_, string value_) - { - Key = key_; - Value = value_; - } - } - - } -} diff --git a/Project/Web/Controllers/CommonController.cs b/Project/Web/Controllers/CommonController.cs deleted file mode 100644 index 3bf0dd2..0000000 --- a/Project/Web/Controllers/CommonController.cs +++ /dev/null @@ -1,454 +0,0 @@ -using FCM0000; -using Microsoft.Owin; -using Newtonsoft.Json; -using System; -using System.Linq; -using System.Net.Http; -using System.Web; -using System.Web.Http; - -namespace Project.Web.Controllers -{ - public class CommonController : BaseController - { - [HttpGet] - public HttpResponseMessage GetList(string grp=null) - { - var sql = string.Empty; - - //코드그룹이 없다면 전체 목록을 조회할 수 있도록 99를 조회한다 - if (string.IsNullOrEmpty(grp)) grp = "99"; - - // 특정 그룹의 데이터만 가져옴 - sql = "select *" + - " from common" + - " where gcode = @gcode" + - " and grp = @grp" + - " order by code,svalue"; - - - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - - if (!string.IsNullOrEmpty(grp)) - { - cmd.Parameters.AddWithValue("grp", grp); - } - - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - - - [HttpGet] - public HttpResponseMessage Index() - { - // 직접 파일을 읽어서 반환 - var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Common.html"); - var contents = string.Empty; - - if (System.IO.File.Exists(filePath)) - { - contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8); - } - else - { - // 파일이 없으면 404 에러 페이지 또는 기본 메시지 - contents = "

404 - File Not Found

The requested file was not found: " + filePath + "

"; - } - - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - contents, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpPost] - public HttpResponseMessage Save([FromBody] CommonModel model) - { - try - { - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var sql = string.Empty; - var cmd = new System.Data.SqlClient.SqlCommand(); - cmd.Connection = cn; - - if (model.idx > 0) - { - // 업데이트 - sql = @"UPDATE common SET - grp = @grp, - code = @code, - svalue = @svalue, - ivalue = @ivalue, - fvalue = @fvalue, - svalue2 = @svalue2, - memo = @memo, - wuid = @wuid, - wdate = GETDATE() - WHERE idx = @idx AND gcode = @gcode"; - } - else - { - // 신규 추가 - sql = @"INSERT INTO common (gcode, grp, code, svalue, ivalue, fvalue, svalue2, memo, wuid, wdate) - VALUES (@gcode, @grp, @code, @svalue, @ivalue, @fvalue, @svalue2, @memo, @wuid, GETDATE())"; - } - - cmd.CommandText = sql; - cmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - cmd.Parameters.AddWithValue("@grp", model.grp ?? ""); - cmd.Parameters.AddWithValue("@code", model.code ?? ""); - cmd.Parameters.AddWithValue("@svalue", model.svalue ?? ""); - cmd.Parameters.AddWithValue("@ivalue", model.ivalue); - cmd.Parameters.AddWithValue("@fvalue", model.fvalue); - cmd.Parameters.AddWithValue("@svalue2", model.svalue2 ?? ""); - cmd.Parameters.AddWithValue("@memo", model.memo ?? ""); - cmd.Parameters.AddWithValue("@wuid", FCOMMON.info.Login.no); - - if (model.idx > 0) - { - cmd.Parameters.AddWithValue("@idx", model.idx); - } - - cn.Open(); - var result = cmd.ExecuteNonQuery(); - cn.Close(); - - cmd.Dispose(); - cn.Dispose(); - - var response = new - { - Success = result > 0, - Message = result > 0 ? "저장되었습니다." : "저장에 실패했습니다." - }; - - return CreateJsonResponse(response); - } - catch (Exception ex) - { - var response = new - { - Success = false, - Message = "오류가 발생했습니다: " + ex.Message - }; - return CreateJsonResponse(response); - } - } - - [HttpPost] - public HttpResponseMessage Delete([FromBody] DeleteModel model) - { - try - { - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var sql = "DELETE FROM common WHERE idx = @idx AND gcode = @gcode"; - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - - cmd.Parameters.AddWithValue("@idx", model.idx); - cmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - - cn.Open(); - var result = cmd.ExecuteNonQuery(); - cn.Close(); - - cmd.Dispose(); - cn.Dispose(); - - var response = new - { - Success = result > 0, - Message = result > 0 ? "삭제되었습니다." : "삭제에 실패했습니다." - }; - - return CreateJsonResponse(response); - } - catch (Exception ex) - { - var response = new - { - Success = false, - Message = "오류가 발생했습니다: " + ex.Message - }; - return CreateJsonResponse(response); - } - } - - [HttpGet] - public HttpResponseMessage GetGroups() - { - try - { - var sql = "select code, svalue, memo from common WITH (nolock) " + - "where gcode = @gcode and grp = '99' " + - "order by code"; - - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - catch (Exception ex) - { - var response = new - { - Message = ex.Message, - }; - return CreateJsonResponse(response); - } - } - - [HttpPost] - public HttpResponseMessage InitializeGroups() - { - try - { - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - - // 기본 그룹코드들 정의 - var defaultGroups = new[] - { - new { code = "01", svalue = "부서코드" }, - new { code = "02", svalue = "직급코드" }, - new { code = "03", svalue = "공정코드" }, - new { code = "04", svalue = "품목분류" }, - new { code = "05", svalue = "업체분류" }, - new { code = "06", svalue = "제조공정" }, - new { code = "07", svalue = "장비제조" }, - new { code = "08", svalue = "장비모델" }, - new { code = "09", svalue = "장비기술" }, - new { code = "99", svalue = "기타" } - }; - - cn.Open(); - - int insertedCount = 0; - foreach (var group in defaultGroups) - { - // 이미 존재하는지 확인 - var checkSql = "SELECT COUNT(*) FROM common WHERE gcode = @gcode AND grp = '99' AND code = @code"; - var checkCmd = new System.Data.SqlClient.SqlCommand(checkSql, cn); - checkCmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - checkCmd.Parameters.AddWithValue("@code", group.code); - - var exists = (int)checkCmd.ExecuteScalar() > 0; - checkCmd.Dispose(); - - if (!exists) - { - // 새로 추가 - var insertSql = @"INSERT INTO common (gcode, grp, code, svalue, ivalue, fvalue, svalue2, memo, wuid, wdate) - VALUES (@gcode, '99', @code, @svalue, 0, 0.0, '', '코드그룹 정의', @wuid, GETDATE())"; - var insertCmd = new System.Data.SqlClient.SqlCommand(insertSql, cn); - insertCmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - insertCmd.Parameters.AddWithValue("@code", group.code); - insertCmd.Parameters.AddWithValue("@svalue", group.svalue); - insertCmd.Parameters.AddWithValue("@wuid", FCOMMON.info.Login.no); - - insertCmd.ExecuteNonQuery(); - insertCmd.Dispose(); - insertedCount++; - } - } - - cn.Close(); - cn.Dispose(); - - var response = new - { - Success = true, - Message = $"그룹코드 초기화 완료. {insertedCount}개 추가됨." - }; - - return CreateJsonResponse(response); - } - catch (Exception ex) - { - var response = new - { - Success = false, - Message = "오류가 발생했습니다: " + ex.Message - }; - return CreateJsonResponse(response); - } - } - - [HttpGet] - public HttpResponseMessage GetNavigationMenu() - { - try - { - // 메뉴 정보를 하드코딩하거나 데이터베이스에서 가져올 수 있습니다. - // 향후 사용자 권한에 따른 메뉴 표시/숨김 기능도 추가 가능합니다. - var menuItems = new[] - { - new { - key = "dashboard", - title = "대시보드", - url = "/Dashboard/", - icon = "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z", - isVisible = true, - sortOrder = 1 - }, - new { - key = "common", - title = "공용코드", - url = "/Common", - icon = "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z", - isVisible = true, - sortOrder = 2 - }, - new { - key = "jobreport", - title = "업무일지", - url = "/Jobreport/", - icon = "M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2", - isVisible = true, - sortOrder = 3 - }, - new { - key = "kuntae", - title = "근태관리", - url = "/Kuntae/", - icon = "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z", - isVisible = true, - sortOrder = 4 - }, - new { - key = "todo", - title = "할일관리", - url = "/Todo/", - icon = "M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2M12 12l2 2 4-4", - isVisible = true, - sortOrder = 5 - }, - new { - key = "project", - title = "프로젝트", - url = "/Project/", - icon = "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10", - isVisible = true, - sortOrder = 6 - } - }; - - // 사용자 권한에 따른 메뉴 필터링 로직을 여기에 추가할 수 있습니다. - // 예: var userLevel = FCOMMON.info.Login.level; - // if (userLevel < 5) { /* 특정 메뉴 숨김 */ } - - var response = new - { - Success = true, - Data = menuItems, - Message = "메뉴 정보를 성공적으로 가져왔습니다." - }; - - return CreateJsonResponse(response); - } - catch (Exception ex) - { - var response = new - { - Success = false, - Data = (object)null, - Message = "메뉴 정보를 가져오는 중 오류가 발생했습니다: " + ex.Message - }; - return CreateJsonResponse(response); - } - } - - private HttpResponseMessage CreateJsonResponse(object data) - { - var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - return new HttpResponseMessage() - { - Content = new StringContent( - json, - System.Text.Encoding.UTF8, - "application/json") - }; - } - } - - public class DeleteModel - { - public int idx { get; set; } - } - - public class CommonModel - { - - - public int idx { get; set; } // 데이터고유번호 - public string gcode { get; set; } // 그룹코드(데이터 그룹간 식별) - public string grp { get; set; } // 코드그룹 - public string code { get; set; } // 코드 - public string svalue { get; set; } // 값(문자열) - public int ivalue { get; set; } // 값(숫자) - public float fvalue { get; set; } // 값(실수) - public string memo { get; set; } // 비고 - public string svalue2 { get; set; } // 값2(문자열) - public string wuid { get; set; } // 데이터기록자 사원번호 - public string wdate { get; set; } // 데이터를기록한일시 - } -} - - - diff --git a/Project/Web/Controllers/CustomerController.cs b/Project/Web/Controllers/CustomerController.cs deleted file mode 100644 index bb1bc79..0000000 --- a/Project/Web/Controllers/CustomerController.cs +++ /dev/null @@ -1,198 +0,0 @@ -using System; -using System.Linq; -using System.Net.Http; -using System.Web.Http; - -namespace Project.Web.Controllers -{ - public class CustomerController : BaseController - { - - // PUT api/values/5 - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - public void Delete(int id) - { - } - - [HttpGet] - public string Test() - { - return "test"; - } - - [HttpGet] - public HttpResponseMessage Find() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - - var gets = Request.GetQueryNameValuePairs();// GetParameters(data); - - - var key_search = gets.Where(t => t.Key == "search").FirstOrDefault(); - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var searchkey = string.Empty; - if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim(); - - var tbody = new System.Text.StringBuilder(); - - //테이블데이터생성 - var itemcnt = 0; - if (searchkey.isEmpty() == false) - { - var db = new dsMSSQLTableAdapters.CustomsTableAdapter();//.custrom EEEntitiesCommon(); - var rows = db.GetData(FCOMMON.info.Login.gcode);// db.Customs.Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t => t.name); - itemcnt = rows.Count(); - foreach (var item in rows) - { - tbody.AppendLine(""); - tbody.AppendLine($"{item.name}"); - tbody.AppendLine($"{item.name2}"); - tbody.AppendLine($"{item.name}"); - //tbody.AppendLine($"{item.model}"); - - //if (item.price == null) - // tbody.AppendLine($"--"); - //else - //{ - // var price = (double)item.price / 1000.0; - - // tbody.AppendLine($"{price.ToString("N0")}"); - //} - - - //tbody.AppendLine($"{item.manu}"); - //tbody.AppendLine($"{item.supply}"); - - //if (item.remark.Length > 10) - // tbody.AppendLine($"{item.remark.Substring(0, 10)}..."); - //else - // tbody.AppendLine($"{item.remark}"); - tbody.AppendLine(""); - } - } - - //아잍쳄이 없는경우 - if (itemcnt == 0) - { - tbody.AppendLine(""); - tbody.AppendLine("1"); - tbody.AppendLine("자료가 없습니다"); - tbody.AppendLine(""); - } - - - var contents = result.Content.Replace("{search}", searchkey); - contents = contents.Replace("{tabledata}", tbody.ToString()); - contents = contents.Replace("{cnt}", itemcnt.ToString()); - - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage Index() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - - var gets = Request.GetQueryNameValuePairs();// GetParameters(data); - - - var key_search = gets.Where(t => t.Key == "search").FirstOrDefault(); - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var searchkey = string.Empty; - if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim(); - - var tbody = new System.Text.StringBuilder(); - - //테이블데이터생성 - var itemcnt = 0; - //if (searchkey.isEmpty() == false) - { - var db = new dsMSSQLTableAdapters.CustomsTableAdapter();// EEEntitiesCommon(); - var sd = DateTime.Now.ToString("yyyy-MM-01"); - var rows = db.GetData(FCOMMON.info.Login.gcode);// .Customs.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t=>t.name); - itemcnt = rows.Count(); - foreach (var item in rows) - { - tbody.AppendLine(""); - tbody.AppendLine($"{item.grp}"); - tbody.AppendLine($"{item.name}"); - tbody.AppendLine($"{item.name2}"); - tbody.AppendLine($"{item.tel}"); - tbody.AppendLine($"{item.fax}"); - tbody.AppendLine($"{item.email}"); - tbody.AppendLine($"{item.address}"); - - - - if (string.IsNullOrEmpty( item.memo)==false && item.memo.Length > 10) tbody.AppendLine($"{item.memo.Substring(0, 10)}..."); - else tbody.AppendLine($"{item.memo}"); - - tbody.AppendLine(""); - } - } - - //아잍쳄이 없는경우 - if (itemcnt == 0) - { - tbody.AppendLine(""); - tbody.AppendLine("1"); - tbody.AppendLine("자료가 없습니다"); - tbody.AppendLine(""); - } - - - var contents = result.Content.Replace("{search}", searchkey); - contents = contents.Replace("{tabledata}", tbody.ToString()); - contents = contents.Replace("{cnt}", itemcnt.ToString()); - - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - } -} diff --git a/Project/Web/Controllers/DashBoardController.cs b/Project/Web/Controllers/DashBoardController.cs deleted file mode 100644 index 80979c2..0000000 --- a/Project/Web/Controllers/DashBoardController.cs +++ /dev/null @@ -1,496 +0,0 @@ -using FCOMMON; -using Newtonsoft.Json; -using System; -using System.Data; -using System.Linq; -using System.Net.Http; -using System.Security.Cryptography; -using System.Web.Http; - -namespace Project.Web.Controllers -{ - public class DashBoardController : BaseController - { - [HttpPost] - public void Index([FromBody] string value) - { - - } - - //// PUT api/values/5 - //public void Put(int id, [FromBody] string value) - //{ - //} - - //// DELETE api/values/5 - //public void Delete(int id) - //{ - //} - - [HttpGet] - public string TodayCountH() - { - - var sql = "select count(*) from EETGW_HolydayRequest WITH (nolock) " + - " where gcode = @gcode and isnull(conf,0) = 1 " + - " and sdate <= convert(varchar(10),GETDATE(),120) and edate >= convert(varchar(10),GETDATE(),120)"; - - var cn = DBM.getCn(); - cn.Open(); - - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = FCOMMON.info.Login.gcode; - var cnt1 = (int)cmd.ExecuteScalar(); - cmd.Dispose(); - cn.Dispose(); - - return cnt1.ToString(); - } - - [HttpGet] - public HttpResponseMessage GetHolydayRequestCount() - { - - try - { - var cn = DBM.getCn(); - - var sql = "select count(*) from EETGW_HolydayRequest WITH (nolock) " + - " where gcode = @gcode" + - " and isnull(conf,0) = 0"; - - cn.Open(); - - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = FCOMMON.info.Login.gcode; - var cnt1 = (int)cmd.ExecuteScalar(); - cn.Dispose(); - - var response = new - { - HOLY = cnt1, - Message = string.Empty, - }; - return CreateJsonResponse(response); - } - catch (Exception ex) - { - var response = new - { - HOLY = 0, - Message = ex.Message, - }; - return CreateJsonResponse(response); - } - } - - - [HttpGet] - public HttpResponseMessage GetholyRequestUser() - { - var sql = string.Empty; - sql = $" select uid,cate,sdate,edate,HolyReason,Users.name,holydays,holytimes,remark " + - $" from EETGW_HolydayRequest WITH (nolock) INNER JOIN " + - $" Users ON EETGW_HolydayRequest.uid = Users.id " + - $" where EETGW_HolydayRequest.gcode = @gcode" + - $" and isnull(conf,0) = 0 "; - //" and sdate <= convert(varchar(10),GETDATE(),120) and edate >= convert(varchar(10),GETDATE(),120)"; - - //sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode); - - var cs = Properties.Settings.Default.gwcs;// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!"; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage GetJobData(string startDate = "", string endDate = "") - { - var sql = string.Empty; - - // 기본값 설정 (이번 달) - if (string.IsNullOrEmpty(startDate) || string.IsNullOrEmpty(endDate)) - { - var now = DateTime.Now; - var firstDayOfMonth = new DateTime(now.Year, now.Month, 1); - var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1); - startDate = firstDayOfMonth.ToString("yyyy-MM-dd"); - endDate = lastDayOfMonth.ToString("yyyy-MM-dd"); - } - - sql = $" select idx,pdate,status,projectName, uid, requestpart, package,type,process,description," + - " hrs,ot,otStart,otEnd" + - " from JobReport WITH (nolock)" + - " where gcode = @gcode and uid = @uid" + - " and pdate between @startDate and @endDate" + - " order by pdate desc, wdate desc"; - - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no); - cmd.Parameters.AddWithValue("startDate", startDate); - cmd.Parameters.AddWithValue("endDate", endDate); - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - - - - - [HttpGet] - public HttpResponseMessage GetCurrentUserCount() - { - - try - { - var cn = DBM.getCn(); - - - - var sql = "select count(*) from vGroupUser WITH (nolock) " + - " where gcode = @gcode and useUserState = 1 and useJobReport = 1" + - " and id not in (select uid from vEETGW_TodayNoneWorkUser where gcode = @gcode and kunmu = 0)"; - - - cn.Open(); - - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = FCOMMON.info.Login.gcode; - var cnt1 = (int)cmd.ExecuteScalar(); - cn.Dispose(); - - var response = new - { - Count = cnt1, - Message = string.Empty, - }; - return CreateJsonResponse(response); - } - catch (Exception ex) - { - var response = new - { - Count = 0, - Message = ex.Message, - }; - return CreateJsonResponse(response); - } - - - } - - [HttpGet] - public HttpResponseMessage GetPurchaseWaitCount() - { - - try - { - FCOMMON.DBM.GetPurchaseWaitCount(FCOMMON.info.Login.gcode, out int cnt1, out int cnt2); - var response = new - { - NR = cnt1, - CR = cnt2, - Message = string.Empty, - }; - return CreateJsonResponse(response); - } - catch (Exception ex) - { - var response = new - { - NR = 0, - CR = 0, - Message = ex.Message, - }; - return CreateJsonResponse(response); - } - - - } - - - - [HttpGet] - public HttpResponseMessage GetUserGroups() - { - var dt = DBM.GetUserGroups(); - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - - - [HttpGet] - public HttpResponseMessage GetholyUser() - { - var sql = string.Empty; - sql = $" select uid,type,cate,sdate,edate,title,dbo.getusername(uid) as name " + - $" from vEETGW_TodayNoneWorkUser WITH (nolock)" + - $" where gcode = @gcode and kunmu=0"; - - //sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode); - - var cs = Properties.Settings.Default.gwcs;// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!"; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode ?? string.Empty); - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage GetPresentUserList() - { - try - { - var sql = "select * from vGroupUser WITH (nolock) " + - " where gcode = @gcode and useUserState = 1 and useJobReport = 1" + - " and id not in (select uid from vEETGW_TodayNoneWorkUser where gcode = @gcode and kunmu = 0)"; - - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - catch (Exception ex) - { - var response = new - { - Message = ex.Message, - }; - return CreateJsonResponse(response); - } - } - - [HttpGet] - public HttpResponseMessage GetPurchaseNRList() - { - try - { - var sql = "select pdate, process, pumname, pumscale, pumunit, pumqtyreq, pumprice, pumamt from Purchase WITH (nolock) where gcode = @gcode and state = '---' order by pdate desc"; - - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - return resp; - } - catch (Exception ex) - { - var response = new - { - Message = ex.Message, - }; - return CreateJsonResponse(response); - } - } - - [HttpGet] - public HttpResponseMessage GetPurchaseCRList() - { - try - { - var sql = "select pdate, process, pumname, pumscale, pumunit, pumqtyreq, pumprice, pumamt " + - " from EETGW_PurchaseCR WITH (nolock) " + - " where gcode = @gcode and state = '---'" + - " order by pdate desc"; - - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - catch (Exception ex) - { - var response = new - { - Message = ex.Message, - }; - return CreateJsonResponse(response); - } - } - - - [HttpGet] - public HttpResponseMessage Index() - { - // 직접 파일을 읽어서 반환 - var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "DashBoard", "index.html"); - var contents = string.Empty; - - if (System.IO.File.Exists(filePath)) - { - contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8); - } - else - { - // 파일이 없으면 404 에러 페이지 또는 기본 메시지 - contents = "

404 - File Not Found

The requested file was not found: " + filePath + "

"; - } - - //공용값 적용 - //ApplyCommonValue(ref contents); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - contents, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - private HttpResponseMessage CreateJsonResponse(object data) - { - var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - return new HttpResponseMessage() - { - Content = new StringContent( - json, - System.Text.Encoding.UTF8, - "application/json") - }; - } - - } -} diff --git a/Project/Web/Controllers/HomeController.cs b/Project/Web/Controllers/HomeController.cs deleted file mode 100644 index 80ebab6..0000000 --- a/Project/Web/Controllers/HomeController.cs +++ /dev/null @@ -1,346 +0,0 @@ -using System; -using System.Linq; -using System.Net.Http; -using System.Web.Http; -using Newtonsoft.Json; -using System.Collections.Generic; -using FCOMMON; - -namespace Project.Web.Controllers -{ - // 로그인 요청 모델 - public class LoginRequest - { - public string Gcode { get; set; } - public string UserId { get; set; } - public string Password { get; set; } - public bool RememberMe { get; set; } - } - - // 로그인 응답 모델 - public class LoginResponse - { - public bool Success { get; set; } - public string Message { get; set; } - public string RedirectUrl { get; set; } - public object UserData { get; set; } - } - - public class HomeController : BaseController - { - [HttpGet] - public IHttpActionResult Index() - { - return Ok(new - { - message = "GroupWare API 연결 성공!", - timestamp = DateTime.Now, - version = "1.0.0", - status = "OK" - }); - } - - [HttpGet] - public string TestLogin() - { - return "HomeController Login Test - 접근 성공!"; - } - - [HttpPost] - public HttpResponseMessage Login([FromBody] LoginRequest request) - { - var response = new LoginResponse(); - - try - { - // 입력값 검증 - if (string.IsNullOrEmpty(request?.Gcode) || string.IsNullOrEmpty(request?.UserId) || string.IsNullOrEmpty(request?.Password)) - { - response.Success = false; - response.Message = "그룹코드/사용자ID/비밀번호를 입력해주세요."; - return CreateJsonResponse(response); - } - - // TODO: 여기에 실제 데이터베이스 로그인 로직을 구현하세요 - // 예시: 데이터베이스에서 사용자 정보 확인 - bool isValidUser = ValidateUser(request.Gcode, request.UserId, request.Password); - - if (isValidUser) - { - // 로그인 성공 - response.Success = true; - response.Message = "로그인에 성공했습니다."; - response.RedirectUrl = "/DashBoard"; - - // 사용자 정보 설정 (세션 또는 쿠키) - SetUserSession(request.Gcode, request.UserId, request.RememberMe); - - // 사용자 데이터 반환 - response.UserData = new - { - Gcode = request.Gcode, - UserId = request.UserId, - LoginTime = DateTime.Now, - RememberMe = request.RememberMe - }; - } - else - { - // 로그인 실패 - response.Success = false; - response.Message = "사용자 ID 또는 비밀번호가 올바르지 않습니다."; - } - } - catch (Exception ex) - { - Console.WriteLine( ex.Message); - response.Success = false; - response.Message = "로그인 처리 중 오류가 발생했습니다: " + ex.Message; - } - - return CreateJsonResponse(response); - } - - [HttpPost] - public HttpResponseMessage Logout() - { - var response = new LoginResponse(); - - try - { - // TODO: 여기에 로그아웃 로직을 구현하세요 - // 예시: 세션 정리, 쿠키 삭제 등 - ClearUserSession(); - - response.Success = true; - response.Message = "로그아웃되었습니다."; - response.RedirectUrl = "/Login"; - } - catch (Exception ex) - { - response.Success = false; - response.Message = "로그아웃 처리 중 오류가 발생했습니다: " + ex.Message; - } - - return CreateJsonResponse(response); - } - - - - - - [HttpGet] - public HttpResponseMessage CheckLoginStatus() - { - var response = new LoginResponse(); - - try - { - // TODO: 여기에 로그인 상태 확인 로직을 구현하세요 - // 예시: 세션 또는 쿠키에서 사용자 정보 확인 - var currentUser = GetCurrentUser(); - - if (currentUser != null) - { - response.Success = true; - response.Message = "로그인된 상태입니다."; - response.UserData = currentUser; - } - else - { - response.Success = false; - response.Message = "로그인되지 않은 상태입니다."; - response.RedirectUrl = "/Login"; - } - } - catch (Exception ex) - { - response.Success = false; - response.Message = "로그인 상태 확인 중 오류가 발생했습니다: " + ex.Message; - } - - return CreateJsonResponse(response); - } - - // 헬퍼 메서드들 - private bool ValidateUser(string gcode, string userId, string password) - { - // TODO: 실제 데이터베이스 검증 로직을 여기에 구현하세요 - // 예시: 데이터베이스에서 사용자 정보 조회 및 비밀번호 검증 - var encpass = Pub.MakePasswordEnc(password.Trim()); - - if(userId.ToLower()=="dev" && password == "123") - { - return true; - } - - var GInfo = DBM.GetUserGroup(gcode); - if (GInfo == null) return false; - var UGInfo = DBM.GetGroupUser(gcode, userId); - if (UGInfo == null) return false; - var UInfo = DBM.GetUserInfo(userId); - if (UInfo == null) return false; - return UInfo.password.Equals(encpass); - } - - private void SetUserSession(string gcode, string userId, bool rememberMe) - { - if(userId.ToLower().Equals("dev")) - { - var GInfo = DBM.GetUserGroup(gcode); - var UInfo = DBM.GetUserInfo(userId); - - info.Login.no = "dev"; - info.Login.nameK = "개발자"; - info.Login.dept = GInfo.name; - info.Login.level = 10; - info.Login.email = UInfo.email; - info.Login.hp = UInfo.hp; - info.Login.tel = UInfo.tel; - info.Login.title = GInfo.name + "(" + UInfo.grade + ")"; - info.NotShowJobReportview = Pub.setting.NotShowJobreportPRewView; - info.Login.gcode = gcode;// gcode; - info.Login.process = "개발자"; - info.Login.permission =GInfo.perm; - info.Login.gpermission = GInfo.perm; - info.ShowBuyerror = Pub.setting.Showbuyerror; //210625 - - } - else - { - // TODO: 세션 또는 쿠키에 사용자 정보 저장 - // 예시: HttpContext.Session["UserId"] = userId; - // 예시: 쿠키 설정 (rememberMe가 true인 경우) - //데이터베이스에서 해당 정보를 찾아와서 처리해야한다 - var GInfo = DBM.GetUserGroup(gcode); - var UInfo = DBM.GetUserInfo(userId); - var UGInfo = DBM.GetGroupUser(gcode, userId); - - - info.Login.no = userId; - info.Login.nameK = UInfo.name; - info.Login.dept = GInfo.name; - info.Login.level = UGInfo.level; - info.Login.email = UInfo.email; - info.Login.hp = UInfo.hp; - info.Login.tel = UInfo.tel; - info.Login.title = GInfo.name + "(" + UInfo.grade + ")"; - info.NotShowJobReportview = Pub.setting.NotShowJobreportPRewView; - info.Login.gcode = gcode;// gcode; - info.Login.process = UInfo.id == "dev" ? "개발자" : UGInfo.Process; - info.Login.permission = UGInfo.level; - info.Login.gpermission = GInfo.perm; - info.ShowBuyerror = Pub.setting.Showbuyerror; //210625 - - - //로그인기록저장 - Pub.setting.lastid = userId;// tbID.Text.Trim(); - Pub.setting.lastdpt = GInfo.name; - Pub.setting.lastgcode = GInfo.gcode; - Pub.setting.Save(); - } - - - - } - - private void ClearUserSession() - { - // TODO: 세션 또는 쿠키에서 사용자 정보 삭제 - FCOMMON.info.Login.no = string.Empty; - FCOMMON.info.Login.level = 0; - FCOMMON.info.Login.gcode = string.Empty; - FCOMMON.info.Login.permission = 0; - FCOMMON.info.Login.gpermission = 0; - Console.WriteLine("logout"); - } - - private object GetCurrentUser() - { - // TODO: 현재 로그인된 사용자 정보 반환 - // 예시: HttpContext.Session["UserId"]에서 사용자 정보 조회 - if (string.IsNullOrEmpty(FCOMMON.info.Login.no)) return null; - else return FCOMMON.info.Login; - } - - private HttpResponseMessage CreateJsonResponse(object data) - { - var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - return new HttpResponseMessage() - { - Content = new StringContent( - json, - System.Text.Encoding.UTF8, - "application/json") - }; - } - - [HttpGet] - public HttpResponseMessage Login() - { - // 직접 파일을 읽어서 반환 - var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "login.html"); - var contents = string.Empty; - - if (System.IO.File.Exists(filePath)) - { - contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8); - } - else - { - // 파일이 없으면 404 에러 페이지 또는 기본 메시지 - contents = "

404 - File Not Found

The requested file was not found: " + filePath + "

"; - } - - //공용값 적용 - ApplyCommonValue(ref contents); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - contents, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - - - [HttpGet] - public HttpResponseMessage GetPreviousLoginInfo() - { - try - { - // pub.setting에서 이전 로그인 정보 읽기 - var previousLoginInfo = new - { - Gcode = Pub.setting.lastgcode ?? "", - UserId = Pub.setting.lastid ?? "", - Dept = Pub.setting.lastdpt ?? "", - RememberMe = false // 기본값으로 설정 - }; - - return CreateJsonResponse(new - { - Success = true, - Data = previousLoginInfo - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "이전 로그인 정보를 가져오는 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - } -} diff --git a/Project/Web/Controllers/ItemController.cs b/Project/Web/Controllers/ItemController.cs deleted file mode 100644 index b93d019..0000000 --- a/Project/Web/Controllers/ItemController.cs +++ /dev/null @@ -1,153 +0,0 @@ -using System; -using System.Linq; -using System.Net.Http; -using System.Web.Http; -using System.Windows.Forms; - -namespace Project.Web.Controllers -{ - public class ItemController : BaseController - { - - - // PUT api/values/5 - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - public void Delete(int id) - { - } - - [HttpGet] - public string Test() - { - return "test"; - } - - [HttpGet] - public HttpResponseMessage Find() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - - var gets = Request.GetQueryNameValuePairs();// GetParameters(data); - - - var key_search = gets.Where(t => t.Key == "search").FirstOrDefault(); - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var searchkey = string.Empty; - if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim(); - if (searchkey.isEmpty() == false && searchkey != "%") - { - if (searchkey.StartsWith("%") == false) searchkey = "%" + searchkey; - if (searchkey.EndsWith("%") == false) searchkey = searchkey + "%"; - } - - var tbody = new System.Text.StringBuilder(); - - //테이블데이터생성 - var itemcnt = 0; - if (searchkey.isEmpty() == false) - { - var db = new dsMSSQLTableAdapters.vFindSIDTableAdapter();// EEEntitiesMain(); - var rows = db.GetData(searchkey);// .vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.model.Contains(searchkey)); - itemcnt = rows.Count(); - foreach (var item in rows) - { - tbody.AppendLine(""); - tbody.AppendLine($"{item.Location}"); - tbody.AppendLine($"{item.sid}"); - tbody.AppendLine($"{item.name}"); - tbody.AppendLine($"{item.model}"); - - if (item.IspriceNull()) - tbody.AppendLine($"--"); - else - { - var price = (double)item.price / 1000.0; - - tbody.AppendLine($"{price.ToString("N0")}"); - } - - - tbody.AppendLine($"{item.manu}"); - tbody.AppendLine($"{item.supply}"); - - if (item.remark.Length > 10) - tbody.AppendLine($"{item.remark.Substring(0, 10)}..."); - else - tbody.AppendLine($"{item.remark}"); - tbody.AppendLine(""); - } - } - - //아잍쳄이 없는경우 - if (itemcnt == 0) - { - tbody.AppendLine(""); - tbody.AppendLine("자료가 없습니다"); - tbody.AppendLine(""); - } - - - var contents = result.Content.Replace("{search}", searchkey); - contents = contents.Replace("{tabledata}", tbody.ToString()); - contents = contents.Replace("{cnt}", itemcnt.ToString()); - - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage Index() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var contents = result.Content; - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - } -} diff --git a/Project/Web/Controllers/JobreportController.cs b/Project/Web/Controllers/JobreportController.cs deleted file mode 100644 index f49d2d9..0000000 --- a/Project/Web/Controllers/JobreportController.cs +++ /dev/null @@ -1,919 +0,0 @@ -using Microsoft.Owin; -using Project.Web.Controllers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Web; -using System.Web.Http; -using System.Data; -using System.Web.Http.Results; -using System.Data.SqlClient; - -namespace Project.Web.Controllers -{ - public class JobreportController : BaseController - { - - - // PUT api/values/5 - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - [HttpDelete] - public HttpResponseMessage Delete(int id) - { - try - { - if (id <= 0) - { - throw new Exception("유효하지 않은 업무일지 ID입니다."); - } - - // 직접 SQL 삭제 실행 - string connectionString = Properties.Settings.Default.gwcs; - using (var connection = new System.Data.SqlClient.SqlConnection(connectionString)) - { - connection.Open(); - - string deleteSql = @" - DELETE FROM JobReport - WHERE idx = @idx AND gcode = @gcode"; - - using (var command = new System.Data.SqlClient.SqlCommand(deleteSql, connection)) - { - command.Parameters.AddWithValue("@idx", id); - command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - - int rowsAffected = command.ExecuteNonQuery(); - - if (rowsAffected == 0) - { - throw new Exception("업무일지를 찾을 수 없거나 삭제 권한이 없습니다."); - } - } - } - - var jsonData = "{\"success\":true,\"message\":\"데이터가 성공적으로 삭제되었습니다.\"}"; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - jsonData, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - catch (Exception ex) - { - var errorResp = new HttpResponseMessage() - { - Content = new StringContent( - $"{{\"success\":false,\"message\":\"{EscapeJsonString(ex.Message)}\"}}", - System.Text.Encoding.UTF8, - "application/json") - }; - return errorResp; - } - } - - [HttpPost] - public string Add(FormCollection formData) - { - try - { - // 폼 데이터에서 값 추출 - var pdate = formData["pdate"] ?? DateTime.Now.ToShortDateString(); - var status = formData["status"] ?? ""; - var projectName = formData["projectName"] ?? ""; - var requestpart = formData["requestpart"] ?? ""; - var type = formData["type"] ?? ""; - var description = formData["description"] ?? ""; - var otStart = formData["otStart"] ?? ""; - var otEnd = formData["otEnd"] ?? ""; - - decimal hrs = 0; - decimal.TryParse(formData["hrs"], out hrs); - - decimal ot = 0; - decimal.TryParse(formData["ot"], out ot); - - // 직접 SQL 삽입 실행 - string connectionString = Properties.Settings.Default.gwcs; - using (var connection = new System.Data.SqlClient.SqlConnection(connectionString)) - { - connection.Open(); - - string insertSql = @" - INSERT INTO JobReport - (gcode, pdate, projectName, uid, requestpart, status, type, description, hrs, ot, otStart, otEnd, wuid, wdate) - VALUES - (@gcode, @pdate, @projectName, @uid, @requestpart, @status, @type, @description, @hrs, @ot, @otStart, @otEnd, @wuid, @wdate)"; - - using (var command = new System.Data.SqlClient.SqlCommand(insertSql, connection)) - { - command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - command.Parameters.AddWithValue("@pdate", pdate); - command.Parameters.AddWithValue("@projectName", projectName); - command.Parameters.AddWithValue("@uid", FCOMMON.info.Login.no); - command.Parameters.AddWithValue("@requestpart", requestpart); - command.Parameters.AddWithValue("@status", status); - command.Parameters.AddWithValue("@type", type); - command.Parameters.AddWithValue("@description", description); - command.Parameters.AddWithValue("@hrs", hrs); - command.Parameters.AddWithValue("@ot", ot); - command.Parameters.AddWithValue("@otStart", string.IsNullOrEmpty(otStart) ? (object)DBNull.Value : otStart); - command.Parameters.AddWithValue("@otEnd", string.IsNullOrEmpty(otEnd) ? (object)DBNull.Value : otEnd); - command.Parameters.AddWithValue("@wuid", FCOMMON.info.Login.no); - command.Parameters.AddWithValue("@wdate", DateTime.Now); - - command.ExecuteNonQuery(); - } - } - - return "{\"success\":true,\"message\":\"데이터가 성공적으로 저장되었습니다.\"}"; - } - catch (Exception ex) - { - return $"{{\"success\":false,\"message\":\"{EscapeJsonString(ex.Message)}\"}}"; - } - } - - [HttpPost] - public HttpResponseMessage Edit() - { - try - { - // Request.Form에서 직접 값 추출 - var idx = HttpContext.Current.Request.Form["idx"]; - var pdate = HttpContext.Current.Request.Form["pdate"] ?? DateTime.Now.ToShortDateString(); - var status = HttpContext.Current.Request.Form["status"] ?? ""; - var projectName = HttpContext.Current.Request.Form["projectName"] ?? ""; - var requestpart = HttpContext.Current.Request.Form["requestpart"] ?? ""; - var type = HttpContext.Current.Request.Form["type"] ?? ""; - var description = HttpContext.Current.Request.Form["description"] ?? ""; - var otStart = HttpContext.Current.Request.Form["otStart"] ?? ""; - var otEnd = HttpContext.Current.Request.Form["otEnd"] ?? ""; - - decimal hrs = 0; - decimal.TryParse(HttpContext.Current.Request.Form["hrs"], out hrs); - - decimal ot = 0; - decimal.TryParse(HttpContext.Current.Request.Form["ot"], out ot); - - int idxNum = 0; - int.TryParse(idx, out idxNum); - - if (idxNum <= 0) - { - throw new Exception("유효하지 않은 업무일지 ID입니다."); - } - - // 직접 SQL 업데이트 실행 - string connectionString = Properties.Settings.Default.gwcs; - using (var connection = new System.Data.SqlClient.SqlConnection(connectionString)) - { - connection.Open(); - - string updateSql = @" - UPDATE JobReport - SET pdate = @pdate, - status = @status, - projectName = @projectName, - requestpart = @requestpart, - type = @type, - description = @description, - hrs = @hrs, - ot = @ot, - otStart = @otStart, - otEnd = @otEnd, - wuid = @wuid, - wdate = @wdate - WHERE idx = @idx AND gcode = @gcode"; - - using (var command = new System.Data.SqlClient.SqlCommand(updateSql, connection)) - { - command.Parameters.AddWithValue("@idx", idxNum); - command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - command.Parameters.AddWithValue("@pdate", pdate); - command.Parameters.AddWithValue("@status", status); - command.Parameters.AddWithValue("@projectName", projectName); - command.Parameters.AddWithValue("@requestpart", requestpart); - command.Parameters.AddWithValue("@type", type); - command.Parameters.AddWithValue("@description", description); - command.Parameters.AddWithValue("@hrs", hrs); - command.Parameters.AddWithValue("@ot", ot); - command.Parameters.AddWithValue("@otStart", string.IsNullOrEmpty(otStart) ? (object)DBNull.Value : otStart); - command.Parameters.AddWithValue("@otEnd", string.IsNullOrEmpty(otEnd) ? (object)DBNull.Value : otEnd); - command.Parameters.AddWithValue("@wuid", FCOMMON.info.Login.no); - command.Parameters.AddWithValue("@wdate", DateTime.Now); - - int rowsAffected = command.ExecuteNonQuery(); - - if (rowsAffected == 0) - { - throw new Exception("업무일지를 찾을 수 없거나 수정 권한이 없습니다."); - } - } - } - - var jsonData = "{\"success\":true,\"message\":\"데이터가 성공적으로 수정되었습니다.\"}"; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - jsonData, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - catch (Exception ex) - { - var errorResp = new HttpResponseMessage() - { - Content = new StringContent( - $"{{\"success\":false,\"message\":\"{EscapeJsonString(ex.Message)}\"}}", - System.Text.Encoding.UTF8, - "application/json") - }; - return errorResp; - } - } - - [HttpGet] - public HttpResponseMessage Edit(int id) - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View("/jobreport/edit"); - - var gets = Request.GetQueryNameValuePairs();// GetParameters(data); - - var key_search = gets.Where(t => t.Key == "search").FirstOrDefault(); - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var searchkey = string.Empty; - if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim(); - - var tbody = new System.Text.StringBuilder(); - - //테이블데이터생성 - var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();//. EEEntitiesJobreport(); - var sd = DateTime.Now.ToString("yyyy-MM-01"); - var ed = DateTime.Now.ToShortDateString(); - var rows = db.GetData(FCOMMON.info.Login.gcode, id).FirstOrDefault();//.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault(); - - var contents = result.Content; - if (rows == null) - { - //아이템이 없는 메시지를 표시한다 - } - else - { - //치환작업을 진행한다 - contents = contents.Replace("{pdate}", rows.pdate); - contents = contents.Replace("{status}", rows.status); - contents = contents.Replace("{name}", rows.name); - contents = contents.Replace("{package}", rows.package); - contents = contents.Replace("{process}", rows.process); - contents = contents.Replace("{type}", rows.type); - contents = contents.Replace("{userProcess}", rows.userProcess); - contents = contents.Replace("{projectName}", rows.projectName); - contents = contents.Replace("{hrs}", rows.hrs.ToString()); - contents = contents.Replace("{ot}", rows.ot.ToString()); - contents = contents.Replace("{requestpart}", rows.requestpart); - contents = contents.Replace("{description}", rows.description); - - } - - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - - [HttpGet] - public HttpResponseMessage Add() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View("/jobreport/add"); - - - var gets = Request.GetQueryNameValuePairs();// GetParameters(data); - - - var key_search = gets.Where(t => t.Key == "search").FirstOrDefault(); - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var searchkey = string.Empty; - if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim(); - - var tbody = new System.Text.StringBuilder(); - - //테이블데이터생성 - var itemcnt = 0; - //if (searchkey.isEmpty() == false) - { - var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport(); - var sd = DateTime.Now.ToString("yyyy-MM-01"); - var ed = DateTime.Now.ToShortDateString(); - var rows = db.GetByDate(FCOMMON.info.Login.gcode, FCOMMON.info.Login.no, sd, ed); - //vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate); - itemcnt = rows.Count(); - foreach (var item in rows) - { - tbody.AppendLine(""); - - tbody.AppendLine($"{item.pdate.Substring(5)}"); - tbody.AppendLine($"{item.ww}"); - tbody.AppendLine($"{item.name}"); - - if (item.status == "진행 중" || item.status.EndsWith("%")) - tbody.AppendLine($"{item.status}"); - else - tbody.AppendLine($"{item.status}"); - - tbody.AppendLine($"{item.type}"); - tbody.AppendLine($"{item.projectName}"); - tbody.AppendLine($"{item.hrs}"); - tbody.AppendLine($"{item.ot}"); - - tbody.AppendLine(""); - tbody.AppendLine(item.description); - tbody.AppendLine(""); - - tbody.AppendLine(""); - } - } - - //아잍쳄이 없는경우 - if (itemcnt == 0) - { - tbody.AppendLine(""); - tbody.AppendLine("1"); - tbody.AppendLine("자료가 없습니다"); - tbody.AppendLine(""); - } - - - var contents = result.Content.Replace("{search}", searchkey); - contents = contents.Replace("{tabledata}", tbody.ToString()); - contents = contents.Replace("{cnt}", itemcnt.ToString()); - - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage Find() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - - var gets = Request.GetQueryNameValuePairs();// GetParameters(data); - - - var key_search = gets.Where(t => t.Key == "search").FirstOrDefault(); - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var searchkey = string.Empty; - if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim(); - - var tbody = new System.Text.StringBuilder(); - - //테이블데이터생성 - var itemcnt = 0; - if (searchkey.isEmpty() == false) - { - var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport(); - var sd = DateTime.Now.ToShortDateString(); - var rows = db.GetByToday(FCOMMON.info.Login.gcode, sd);//.vJobReportForUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) == 0).OrderBy(t => t.name); - itemcnt = rows.Count(); - foreach (var item in rows) - { - tbody.AppendLine(""); - tbody.AppendLine($"{item.pdate}"); - tbody.AppendLine($"{item.status}"); - tbody.AppendLine($"{item.name}"); - tbody.AppendLine($"{item.projectName}"); - tbody.AppendLine($"{item.hrs}"); - tbody.AppendLine($"{item.ot}"); - tbody.AppendLine($"{item.description}"); - - - if (item.description.Length > 10) - tbody.AppendLine($"{item.description.Substring(0, 10)}..."); - else - tbody.AppendLine($"{item.description}"); - tbody.AppendLine(""); - } - } - - //아잍쳄이 없는경우 - if (itemcnt == 0) - { - tbody.AppendLine(""); - tbody.AppendLine("1"); - tbody.AppendLine("자료가 없습니다"); - tbody.AppendLine(""); - } - - - var contents = result.Content.Replace("{search}", searchkey); - contents = contents.Replace("{tabledata}", tbody.ToString()); - contents = contents.Replace("{cnt}", itemcnt.ToString()); - - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage Index() - { - // 직접 파일을 읽어서 반환 - var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Jobreport", "index.html"); - var contents = string.Empty; - - if (System.IO.File.Exists(filePath)) - { - contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8); - } - else - { - // 파일이 없으면 404 에러 페이지 또는 기본 메시지 - contents = "

404 - File Not Found

The requested file was not found: " + filePath + "

"; - } - - //공용값 적용 - ApplyCommonValue(ref contents); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - contents, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage GetJobDetail(int id) - { - try - { - // 특정 업무일지의 전체 정보 조회 - string connectionString = Properties.Settings.Default.gwcs; - - using (var connection = new System.Data.SqlClient.SqlConnection(connectionString)) - { - connection.Open(); - - string selectSql = @" - SELECT idx, pdate, gcode, uid as id, '' as name, '' as process, type, '' as svalue, - hrs, ot, requestpart, '' as package, '' as userProcess, status, projectName, - description, '' as ww, otStart, otEnd, ot as ot2, '' as otReason, - '' as grade, '' as indate, '' as outdate, pidx - FROM JobReport WITH (NOLOCK) - WHERE gcode = @gcode AND uid = @uid AND idx = @idx"; - - using (var command = new System.Data.SqlClient.SqlCommand(selectSql, connection)) - { - command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - command.Parameters.AddWithValue("@uid", FCOMMON.info.Login.no); - command.Parameters.AddWithValue("@idx", id); - - using (var reader = command.ExecuteReader()) - { - if (reader.Read()) - { - var item = new - { - idx = reader["idx"], - pdate = reader["pdate"], - gcode = reader["gcode"], - id = reader["id"], - name = reader["name"], - process = reader["process"], - type = reader["type"], - svalue = reader["svalue"], - hrs = reader["hrs"], - ot = reader["ot"], - requestpart = reader["requestpart"], - package = reader["package"], - userProcess = reader["userProcess"], - status = reader["status"], - projectName = reader["projectName"], - description = reader["description"], // 전체 내용 - ww = reader["ww"], - otStart = reader["otStart"], - otEnd = reader["otEnd"], - ot2 = reader["ot2"], - otReason = reader["otReason"], - grade = reader["grade"], - indate = reader["indate"], - outdate = reader["outdate"], - pidx = reader["pidx"] - }; - - // JSON 형태로 변환 - decimal hrs = 0; - decimal ot = 0; - int idx = 0; - int pidx = 0; - - try { hrs = Convert.ToDecimal(item.hrs); } catch { hrs = 0; } - try { ot = Convert.ToDecimal(item.ot); } catch { ot = 0; } - try { idx = Convert.ToInt32(item.idx); } catch { idx = 0; } - try { pidx = Convert.ToInt32(item.pidx); } catch { pidx = 0; } - - var desc = EscapeJsonString(item.description?.ToString() ?? ""); // 전체 내용 - var pdate = EscapeJsonString(item.pdate?.ToString() ?? ""); - var status = EscapeJsonString(item.status?.ToString() ?? ""); - var type = EscapeJsonString(item.type?.ToString() ?? ""); - var projectName = EscapeJsonString(item.projectName?.ToString() ?? ""); - var requestpart = EscapeJsonString(item.requestpart?.ToString() ?? ""); - var otStart = EscapeJsonString(item.otStart?.ToString() ?? ""); - var otEnd = EscapeJsonString(item.otEnd?.ToString() ?? ""); - - var jsonData = "{"; - jsonData += $"\"pdate\":\"{pdate}\","; - jsonData += $"\"status\":\"{status}\","; - jsonData += $"\"type\":\"{type}\","; - jsonData += $"\"projectName\":\"{projectName}\","; - jsonData += $"\"requestpart\":\"{requestpart}\","; - jsonData += $"\"hrs\":{hrs},"; - jsonData += $"\"ot\":{ot},"; - jsonData += $"\"description\":\"{desc}\","; - jsonData += $"\"otStart\":\"{otStart}\","; - jsonData += $"\"otEnd\":\"{otEnd}\","; - jsonData += $"\"idx\":{idx},"; - jsonData += $"\"pidx\":{pidx}"; - jsonData += "}"; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - jsonData, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - } - } - } - - // 데이터를 찾을 수 없는 경우 - var errorResp = new HttpResponseMessage() - { - Content = new StringContent( - "{\"error\":\"데이터를 찾을 수 없습니다.\"}", - System.Text.Encoding.UTF8, - "application/json") - }; - return errorResp; - } - catch (Exception ex) - { - var errorResp = new HttpResponseMessage() - { - Content = new StringContent( - $"{{\"error\":\"{ex.Message}\"}}", - System.Text.Encoding.UTF8, - "application/json") - }; - return errorResp; - } - } - - [HttpGet] - public HttpResponseMessage GetUsers() - { - try - { - string connectionString = Properties.Settings.Default.gwcs; - var users = new List(); - - using (var connection = new System.Data.SqlClient.SqlConnection(connectionString)) - { - connection.Open(); - - string selectSql = @" - SELECT name, id, processs - FROM vGroupUser - WHERE gcode = @gcode AND useJobReport = 1 AND useUserState = 1 - ORDER BY name"; - - using (var command = new System.Data.SqlClient.SqlCommand(selectSql, connection)) - { - command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - - using (var reader = command.ExecuteReader()) - { - while (reader.Read()) - { - users.Add(new - { - name = reader["name"], - id = reader["id"], - process = reader["processs"] - }); - } - } - } - } - - // 디버깅 로그 추가 - System.Diagnostics.Debug.WriteLine($"GetUsers: Found {users.Count} users for gcode {FCOMMON.info.Login.gcode}"); - - // JSON 형태로 변환 - var jsonData = "["; - bool first = true; - - foreach (var user in users) - { - if (!first) jsonData += ","; - first = false; - - var name = EscapeJsonString(user.name?.ToString() ?? ""); - var id = EscapeJsonString(user.id?.ToString() ?? ""); - var process = EscapeJsonString(user.process?.ToString() ?? ""); - - jsonData += "{"; - jsonData += $"\"name\":\"{name}\","; - jsonData += $"\"id\":\"{id}\","; - jsonData += $"\"process\":\"{process}\""; - jsonData += "}"; - } - jsonData += "]"; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - jsonData, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - catch (Exception ex) - { - var errorResp = new HttpResponseMessage() - { - Content = new StringContent( - $"{{\"error\":\"{ex.Message}\"}}", - System.Text.Encoding.UTF8, - "application/json") - }; - return errorResp; - } - } - - [HttpGet] - public HttpResponseMessage GetJobData() - { - try - { - var gets = Request.GetQueryNameValuePairs(); - var startDateParam = gets.Where(t => t.Key == "startDate").FirstOrDefault(); - var endDateParam = gets.Where(t => t.Key == "endDate").FirstOrDefault(); - var userParam = gets.Where(t => t.Key == "user").FirstOrDefault(); - - var startDate = startDateParam.Key != null ? startDateParam.Value : null; - var endDate = endDateParam.Key != null ? endDateParam.Value : null; - var selectedUser = userParam.Key != null ? userParam.Value : null; - - // 날짜 파라미터 처리 - string sd, ed; - if (!string.IsNullOrEmpty(startDate) && !string.IsNullOrEmpty(endDate)) - { - sd = startDate; - ed = endDate; - } - else - { - // 기본값: 오늘부터 -2주 - var now = DateTime.Now; - var twoWeeksAgo = now.AddDays(-14); - sd = twoWeeksAgo.ToShortDateString(); - ed = now.ToShortDateString(); - } - - // 직접 SQL로 데이터 조회 - string connectionString = Properties.Settings.Default.gwcs; - var jobReports = new List(); - - using (var connection = new System.Data.SqlClient.SqlConnection(connectionString)) - { - connection.Open(); - - string selectSql = @" - SELECT idx, pdate, gcode, uid as id, '' as name, '' as process, type, '' as svalue, - hrs, ot, requestpart, '' as package, '' as userProcess, status, projectName, - description, '' as ww, otStart, otEnd, ot as ot2, '' as otReason, - '' as grade, '' as indate, '' as outdate, pidx - FROM JobReport WITH (NOLOCK) - WHERE gcode = @gcode AND pdate BETWEEN @startDate AND @endDate"; - - // 사용자 필터가 있으면 해당 사용자, 없으면 로그인한 사용자 - selectSql += " AND uid = @uid"; - - selectSql += " ORDER BY pdate DESC"; - - using (var command = new System.Data.SqlClient.SqlCommand(selectSql, connection)) - { - command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode); - command.Parameters.AddWithValue("@uid", !string.IsNullOrEmpty(selectedUser) ? selectedUser : FCOMMON.info.Login.no); - command.Parameters.AddWithValue("@startDate", sd); - command.Parameters.AddWithValue("@endDate", ed); - - using (var reader = command.ExecuteReader()) - { - while (reader.Read()) - { - jobReports.Add(new - { - idx = reader["idx"], - pdate = reader["pdate"], - gcode = reader["gcode"], - id = reader["id"], - name = reader["name"], - process = reader["process"], - type = reader["type"], - svalue = reader["svalue"], - hrs = reader["hrs"], - ot = reader["ot"], - requestpart = reader["requestpart"], - package = reader["package"], - userProcess = reader["userProcess"], - status = reader["status"], - projectName = reader["projectName"], - description = reader["description"], - ww = reader["ww"], - otStart = reader["otStart"], - otEnd = reader["otEnd"], - ot2 = reader["ot2"], - otReason = reader["otReason"], - grade = reader["grade"], - indate = reader["indate"], - outdate = reader["outdate"], - pidx = reader["pidx"] - }); - } - } - } - } - - // JSON 형태로 변환 - var jsonData = "["; - bool first = true; - - if (jobReports != null) - { - foreach (var item in jobReports) - { - if (!first) jsonData += ","; - first = false; - - // DBNull 처리를 위한 안전한 변환 - decimal hrs = 0; - decimal ot = 0; - int idx = 0; - int pidx = 0; - - try { hrs = Convert.ToDecimal(item.hrs); } catch { hrs = 0; } - try { ot = Convert.ToDecimal(item.ot); } catch { ot = 0; } - try { idx = Convert.ToInt32(item.idx); } catch { idx = 0; } - try { pidx = Convert.ToInt32(item.pidx); } catch { pidx = 0; } - - // 안전한 JSON 문자열 이스케이프 처리 및 25자 제한 - var fullDesc = item.description?.ToString() ?? ""; - var desc = EscapeJsonString(fullDesc.Length > 25 ? fullDesc.Substring(0, 25) + "..." : fullDesc); - var pdate = EscapeJsonString(item.pdate?.ToString() ?? ""); - var ww = EscapeJsonString(item.ww?.ToString() ?? ""); - var name = EscapeJsonString(item.name?.ToString() ?? ""); - var status = EscapeJsonString(item.status?.ToString() ?? ""); - var type = EscapeJsonString(item.type?.ToString() ?? ""); - var projectName = EscapeJsonString(item.projectName?.ToString() ?? ""); - var requestpart = EscapeJsonString(item.requestpart?.ToString() ?? ""); - var userProcess = EscapeJsonString(item.userProcess?.ToString() ?? ""); - - jsonData += "{"; - jsonData += $"\"pdate\":\"{pdate}\","; - jsonData += $"\"ww\":\"{ww}\","; - jsonData += $"\"name\":\"{name}\","; - jsonData += $"\"status\":\"{status}\","; - jsonData += $"\"type\":\"{type}\","; - jsonData += $"\"projectName\":\"{projectName}\","; - jsonData += $"\"requestpart\":\"{requestpart}\","; - jsonData += $"\"userProcess\":\"{userProcess}\","; - jsonData += $"\"hrs\":{hrs},"; - jsonData += $"\"ot\":{ot},"; - jsonData += $"\"description\":\"{desc}\","; - jsonData += $"\"idx\":{idx},"; - jsonData += $"\"pidx\":{pidx}"; - jsonData += "}"; - } - } - jsonData += "]"; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - jsonData, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - catch (Exception ex) - { - var errorResp = new HttpResponseMessage() - { - Content = new StringContent( - $"{{\"error\":\"{ex.Message}\"}}", - System.Text.Encoding.UTF8, - "application/json") - }; - return errorResp; - } - } - - private string EscapeJsonString(string input) - { - if (string.IsNullOrEmpty(input)) - return ""; - - // 제어 문자 제거 (0x00-0x1F 범위) - var cleanInput = System.Text.RegularExpressions.Regex.Replace(input, @"[\x00-\x08\x0B\x0C\x0E-\x1F]", ""); - - return cleanInput - .Replace("\\", "\\\\") // 백슬래시 - .Replace("\"", "\\\"") // 따옴표 - .Replace("\n", "\\n") // 개행 - .Replace("\r", "\\r") // 캐리지 리턴 - .Replace("\t", "\\t"); // 탭 - } - } -} \ No newline at end of file diff --git a/Project/Web/Controllers/KuntaeController.cs b/Project/Web/Controllers/KuntaeController.cs deleted file mode 100644 index e05e8f0..0000000 --- a/Project/Web/Controllers/KuntaeController.cs +++ /dev/null @@ -1,293 +0,0 @@ -using FCM0000; -using Microsoft.Owin; -using Newtonsoft.Json; -using System; -using System.Linq; -using System.Net.Http; -using System.Web; -using System.Web.Http; - -namespace Project.Web.Controllers -{ - public class KuntaeController : BaseController - { - - [HttpGet] - public HttpResponseMessage GetList(string sd = null, string ed = null) - { - var sql = string.Empty; - sql = "select idx,gcode,uid,dbo.getUserName(uid) as uname,cate,sdate,edate,term,termdr,drtime,DrTimePMS,crtime,title,contents, tag, extcate,extidx, wuid,wdate" + - " from Holyday" + - " where gcode = @gcode" + - " and uid = @uid" + - " and sdate between @sd and @ed" + - " order by wdate desc"; - - - var cs = Properties.Settings.Default.gwcs;// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!"; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no); - - // 날짜 파라미터가 없으면 기본값 사용 (현재 월) - var startDate = !string.IsNullOrEmpty(sd) ? sd : DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"); - var endDate = !string.IsNullOrEmpty(ed) ? ed : DateTime.Now.ToString("yyyy-MM-dd"); - - cmd.Parameters.AddWithValue("sd", startDate); - cmd.Parameters.AddWithValue("ed", endDate); - var da = new System.Data.SqlClient.SqlDataAdapter(cmd); - var dt = new System.Data.DataTable(); - da.Fill(dt); - da.Dispose(); - cmd.Dispose(); - cn.Dispose(); - - var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - txtjson, - System.Text.Encoding.UTF8, - "application/json") - }; - - return resp; - } - - - [HttpGet] - public HttpResponseMessage Index() - { - // 직접 파일을 읽어서 반환 - var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "kuntae", "index.html"); - var contents = string.Empty; - - if (System.IO.File.Exists(filePath)) - { - contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8); - } - else - { - // 파일이 없으면 404 에러 페이지 또는 기본 메시지 - contents = "

404 - File Not Found

The requested file was not found: " + filePath + "

"; - } - - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - contents, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpPost] - public HttpResponseMessage Insert([FromBody] KuntaeModel model) - { - try - { - var sql = @"INSERT INTO Holyday (gcode, uid, cate, sdate, edate, term, termdr, drtime, DrTimePMS, crtime, title, contents, tag, extcate, extidx, wuid, wdate) - VALUES (@gcode, @uid, @cate, @sdate, @edate, @term, @termdr, @drtime, @DrTimePMS, @crtime, @title, @contents, @tag, @extcate, @extidx, @wuid, @wdate)"; - - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no); - cmd.Parameters.AddWithValue("cate", (object)model.cate ?? DBNull.Value); - cmd.Parameters.AddWithValue("sdate", model.sdate); - cmd.Parameters.AddWithValue("edate", (object)model.edate ?? DBNull.Value); - cmd.Parameters.AddWithValue("term", (object)model.term ?? DBNull.Value); - cmd.Parameters.AddWithValue("termdr", (object)model.termdr ?? DBNull.Value); - cmd.Parameters.AddWithValue("drtime", (object)model.drtime ?? DBNull.Value); - cmd.Parameters.AddWithValue("DrTimePMS", (object)model.DrTimePMS ?? DBNull.Value); - cmd.Parameters.AddWithValue("crtime", (object)model.crtime ?? DBNull.Value); - cmd.Parameters.AddWithValue("title", (object)model.title ?? DBNull.Value); - cmd.Parameters.AddWithValue("contents", (object)model.contents ?? DBNull.Value); - cmd.Parameters.AddWithValue("tag", (object)model.tag ?? DBNull.Value); - cmd.Parameters.AddWithValue("extcate", (object)model.extcate ?? DBNull.Value); - cmd.Parameters.AddWithValue("extidx", (object)model.extidx ?? DBNull.Value); - cmd.Parameters.AddWithValue("wuid", FCOMMON.info.Login.no); - cmd.Parameters.AddWithValue("wdate", DateTime.Now); - - cn.Open(); - var result = cmd.ExecuteNonQuery(); - cn.Close(); - cmd.Dispose(); - cn.Dispose(); - - var response = new { success = true, message = "근태가 추가되었습니다." }; - var json = JsonConvert.SerializeObject(response); - - return new HttpResponseMessage() - { - Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") - }; - } - catch (Exception ex) - { - var response = new { success = false, message = "근태 추가 중 오류가 발생했습니다: " + ex.Message }; - var json = JsonConvert.SerializeObject(response); - - return new HttpResponseMessage() - { - Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") - }; - } - } - - [HttpPut] - public HttpResponseMessage Update([FromBody] KuntaeModel model) - { - try - { - var sql = @"UPDATE Holyday SET cate = @cate, sdate = @sdate, edate = @edate, term = @term, termdr = @termdr, - drtime = @drtime, DrTimePMS = @DrTimePMS, crtime = @crtime, title = @title, contents = @contents, - tag = @tag, extcate = @extcate, extidx = @extidx - WHERE gcode = @gcode AND uid = @uid AND idx = @idx"; - - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no); - cmd.Parameters.AddWithValue("cate", (object)model.cate ?? DBNull.Value); - cmd.Parameters.AddWithValue("sdate", model.sdate); - cmd.Parameters.AddWithValue("edate", (object)model.edate ?? DBNull.Value); - cmd.Parameters.AddWithValue("term", (object)model.term ?? DBNull.Value); - cmd.Parameters.AddWithValue("termdr", (object)model.termdr ?? DBNull.Value); - cmd.Parameters.AddWithValue("drtime", (object)model.drtime ?? DBNull.Value); - cmd.Parameters.AddWithValue("DrTimePMS", (object)model.DrTimePMS ?? DBNull.Value); - cmd.Parameters.AddWithValue("crtime", (object)model.crtime ?? DBNull.Value); - cmd.Parameters.AddWithValue("title", (object)model.title ?? DBNull.Value); - cmd.Parameters.AddWithValue("contents", (object)model.contents ?? DBNull.Value); - cmd.Parameters.AddWithValue("tag", (object)model.tag ?? DBNull.Value); - cmd.Parameters.AddWithValue("extcate", (object)model.extcate ?? DBNull.Value); - cmd.Parameters.AddWithValue("extidx", (object)model.extidx ?? DBNull.Value); - cmd.Parameters.AddWithValue("idx", model.idx); - - cn.Open(); - var result = cmd.ExecuteNonQuery(); - cn.Close(); - cmd.Dispose(); - cn.Dispose(); - - var response = new { success = true, message = "근태가 수정되었습니다." }; - var json = JsonConvert.SerializeObject(response); - - return new HttpResponseMessage() - { - Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") - }; - } - catch (Exception ex) - { - var response = new { success = false, message = "근태 수정 중 오류가 발생했습니다: " + ex.Message }; - var json = JsonConvert.SerializeObject(response); - - return new HttpResponseMessage() - { - Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") - }; - } - } - - [HttpDelete] - public HttpResponseMessage Delete(string id) - { - try - { - var sql = "DELETE FROM Holyday WHERE gcode = @gcode AND uid = @uid AND idx = @idx"; - - var cs = Properties.Settings.Default.gwcs; - var cn = new System.Data.SqlClient.SqlConnection(cs); - var cmd = new System.Data.SqlClient.SqlCommand(sql, cn); - - cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode); - cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no); - cmd.Parameters.AddWithValue("idx", id); - - cn.Open(); - var result = cmd.ExecuteNonQuery(); - cn.Close(); - cmd.Dispose(); - cn.Dispose(); - - var response = new { success = true, message = "근태가 삭제되었습니다." }; - var json = JsonConvert.SerializeObject(response); - - return new HttpResponseMessage() - { - Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") - }; - } - catch (Exception ex) - { - var response = new { success = false, message = "근태 삭제 중 오류가 발생했습니다: " + ex.Message }; - var json = JsonConvert.SerializeObject(response); - - return new HttpResponseMessage() - { - Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") - }; - } - } - } - - public class KuntaeModel - { - /* - idx : 데이터고유번호 - gcode : 그룹코드(데이터 그룹간 식별) - uid : 사원번호 - cate : 근태구분 - sdate : 시작일 - edate : 종료일 - term : 사용일 - termdr : 발생일 - drtime : 발생시간, - crtime : 사용시간 - DrTimePMS : PMS등록시간 - title : 제목 - contents : 내용 - tag : 입력방식특이사항(clipboard=클립보드에서붙여넣었다) - extcate : 외부에서생성된 경우 외부 출처 - extidx : 외부출처인경우 데이터고유번호 - wuid : 데이터기록자 사원번호 - wdate : 데이터를기록한일시 - */ - - public int idx { get; set; } // 데이터고유번호 - public string gcode { get; set; } // 그룹코드(데이터 그룹간 식별) - public string uid { get; set; } // 사원번호 - public string uname { get; set; } // 성명 - public string cate { get; set; } // 근태구분 - public string sdate { get; set; } // 시작일 - public string edate { get; set; } // 종료일 - public string term { get; set; } // 사용일 - public string termdr { get; set; } // 발생일 - public string drtime { get; set; } // 발생시간 - public string DrTimePMS { get; set; } // PMS등록시간 - public string crtime { get; set; } // 사용시간 - public string title { get; set; } // 제목 - public string contents { get; set; } // 내용 - public string tag { get; set; } // 입력방식특이사항 - public string extcate { get; set; } // 외부에서생성된 경우 외부 출처 - public string extidx { get; set; } // 외부출처인경우 데이터고유번호 - public string wuid { get; set; } // 데이터기록자 사원번호 - public string wdate { get; set; } // 데이터를기록한일시 - } -} - - - diff --git a/Project/Web/Controllers/ManualController.cs b/Project/Web/Controllers/ManualController.cs deleted file mode 100644 index db09e5f..0000000 --- a/Project/Web/Controllers/ManualController.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Linq; -using System.Net.Http; -using System.Web.Http; - -namespace Project.Web.Controllers -{ - public class ManualController : BaseController - { - [HttpPost] - public void Index([FromBody]string value) - { - - } - - // PUT api/values/5 - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api/values/5 - public void Delete(int id) - { - - } - - [HttpGet] - public HttpResponseMessage Page(string id) - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View($"\\Manual\\{id}"); - - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var contents = result.Content; - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage Index() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var contents = result.Content; - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - } -} diff --git a/Project/Web/Controllers/ProjectController.cs b/Project/Web/Controllers/ProjectController.cs deleted file mode 100644 index 527831b..0000000 --- a/Project/Web/Controllers/ProjectController.cs +++ /dev/null @@ -1,408 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Web.Http; -using Newtonsoft.Json; -using FCOMMON; -using Project.Web.Model; - -namespace Project.Web.Controllers -{ - public class ProjectController : BaseController - { - [HttpGet] - public HttpResponseMessage Index() - { - var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Project", "index.html"); - var contents = string.Empty; - - if (System.IO.File.Exists(filePath)) - { - contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8); - } - else - { - contents = "

404 - File Not Found

The requested file was not found: " + filePath + "

"; - } - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - contents, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage GetProjects(string status = "진행", string userFilter = "my") - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - string currentUserName = FCOMMON.info.Login.nameK ?? ""; - - var sql = @" - SELECT idx, status as 상태,asset as 자산번호, model as 장비모델, serial as 시리얼번호, Priority as 우선순위, - ReqSite as 요청국가, ReqPlant as 요청공장, ReqLine as 요청라인, ReqPackage as 요청부서패키지, - reqstaff as 요청자, process as 프로젝트공정, sdate as 시작일,edate as 완료일,ddate as 만료일, odate as 출고일, name as 프로젝트명, - dbo.getUserName( isnull(championid, userManager) ) as 프로젝트관리자, - dbo.getUserName (isnull(designid, usermain)) as 설계담당, - dbo.getUserName(isnull(epanelid, userhw2)) as 전장담당, - dbo.getUserName(isnull(softwareid, usersub)) as 프로그램담당, - crdue as 예산만기일, cramount as 예산,jasmin as 웹관리번호 - FROM Projects - WHERE gcode = @gcode - AND status = @status - AND ISNULL(isdel, 0) = 0"; - - // 사용자 필터 적용 - if (userFilter == "my" && !string.IsNullOrEmpty(currentUserName)) - { - sql += @" AND ( - dbo.getUserName(ISNULL(championid, userManager)) LIKE @userName - OR dbo.getUserName(ISNULL(designid, usermain)) LIKE @userName - OR dbo.getUserName(ISNULL(epanelid, userhw2)) LIKE @userName - OR dbo.getUserName(ISNULL(softwareid, usersub)) LIKE @userName - )"; - } - - sql += " ORDER BY wdate DESC"; - - var parameters = new - { - gcode = gcode, - status = status, - userName = userFilter == "my" ? "%" + currentUserName + "%" : "" - }; - - var projects = DBM.Query(sql, parameters); - - return CreateJsonResponse(new - { - Success = true, - Data = projects, - CurrentUser = currentUserName - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "프로젝트 목록을 가져오는 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - [HttpGet] - public HttpResponseMessage GetProject(int id) - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - if (id <= 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "유효하지 않은 프로젝트 ID입니다." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - - var sql = @" - SELECT idx, status as 상태,asset as 자산번호, model as 장비모델, serial as 시리얼번호, Priority as 우선순위, -ReqSite as 요청국가, ReqPlant as 요청공장, ReqLine as 요청라인, ReqPackage as 요청부서패키지, -reqstaff as 요청자, process as 프로젝트공정, sdate as 시작일,edate as 완료일,ddate as 만료일, odate as 출고일, name as 프로젝트명, - dbo.getUserName( isnull(championid, userManager) ) as 프로젝트관리자, - dbo.getUserName (isnull(designid, usermain)) as 설계담당, - dbo.getUserName(isnull(epanelid, userhw2)) as 전장담당, - dbo.getUserName(isnull(softwareid, usersub)) as 프로그램담당, - crdue as 예산만기일, cramount as 예산,jasmin as 웹관리번호 - FROM Projects - WHERE idx = @idx AND gcode = @gcode AND ISNULL(isdel, 0) = 0"; - - var project = DBM.QuerySingleOrDefault(sql, new { idx = id, gcode = gcode }); - - if (project == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "프로젝트를 찾을 수 없습니다." - }); - } - - return CreateJsonResponse(new - { - Success = true, - Data = project - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "프로젝트 조회 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - [HttpPost] - public HttpResponseMessage CreateProject([FromBody] ProjectModel project) - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - if (string.IsNullOrWhiteSpace(project.프로젝트명)) - { - return CreateJsonResponse(new - { - Success = false, - Message = "프로젝트명을 입력해주세요." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - string uid = FCOMMON.info.Login.no; - - var sql = @" - INSERT INTO Projects (gcode, process, sdate, name, edate, ddate, odate, userManager, status, memo, wdate) - VALUES (@gcode, @process, @sdate, @name, @edate, @ddate, @odate, @userManager, @status, @memo, GETDATE())"; - - var parameters = new - { - gcode = gcode, - process = project.프로젝트공정 ?? "", - sdate = project.시작일, - name = project.프로젝트명, - edate = project.완료일, - ddate = project.만료일, - odate = project.출고일, - userManager = project.프로젝트관리자 ?? "", - status = project.상태 ?? "진행", - memo = project.memo ?? "" - }; - - DBM.Execute(sql, parameters); - - return CreateJsonResponse(new - { - Success = true, - Message = "프로젝트가 추가되었습니다." - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "프로젝트 추가 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - [HttpPut] - public HttpResponseMessage UpdateProject([FromBody] ProjectModel project) - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - if (project.idx <= 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "유효하지 않은 프로젝트 ID입니다." - }); - } - - if (string.IsNullOrWhiteSpace(project.프로젝트명)) - { - return CreateJsonResponse(new - { - Success = false, - Message = "프로젝트명을 입력해주세요." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - - // 먼저 프로젝트가 존재하는지 확인 - var checkSql = "SELECT COUNT(*) FROM Projects WHERE idx = @idx AND gcode = @gcode AND ISNULL(isdel, 0) = 0"; - var count = DBM.QuerySingle(checkSql, new { idx = project.idx, gcode = gcode }); - - if (count == 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "수정할 프로젝트를 찾을 수 없습니다." - }); - } - - var sql = @" - UPDATE Projects - SET process = @process, sdate = @sdate, name = @name, edate = @edate, - ddate = @ddate, odate = @odate, userManager = @userManager, - status = @status, memo = @memo - WHERE idx = @idx AND gcode = @gcode"; - - var parameters = new - { - idx = project.idx, - gcode = gcode, - process = project.프로젝트공정 ?? "", - sdate = project.시작일, - name = project.프로젝트명, - edate = project.완료일, - ddate = project.만료일, - odate = project.출고일, - userManager = project.프로젝트관리자 ?? "", - status = project.상태 ?? "진행", - memo = project.memo ?? "" - }; - - DBM.Execute(sql, parameters); - - return CreateJsonResponse(new - { - Success = true, - Message = "프로젝트가 수정되었습니다." - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "프로젝트 수정 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - [HttpDelete] - public HttpResponseMessage DeleteProject(int id) - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - if (id <= 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "유효하지 않은 프로젝트 ID입니다." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - - // 먼저 프로젝트가 존재하는지 확인 - var checkSql = "SELECT COUNT(*) FROM Projects WHERE idx = @idx AND gcode = @gcode AND ISNULL(isdel, 0) = 0"; - var count = DBM.QuerySingle(checkSql, new { idx = id, gcode = gcode }); - - if (count == 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "삭제할 프로젝트를 찾을 수 없습니다." - }); - } - - var sql = "UPDATE Projects SET isdel = 1 WHERE idx = @idx AND gcode = @gcode"; - DBM.Execute(sql, new { idx = id, gcode = gcode }); - - return CreateJsonResponse(new - { - Success = true, - Message = "프로젝트가 삭제되었습니다." - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "프로젝트 삭제 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - private object GetCurrentUser() - { - if (string.IsNullOrEmpty(FCOMMON.info.Login.no)) return null; - else return FCOMMON.info.Login; - } - - private HttpResponseMessage CreateJsonResponse(object data) - { - var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore, - DateFormatString = "yyyy-MM-dd HH:mm:ss" - }); - - return new HttpResponseMessage() - { - Content = new StringContent( - json, - System.Text.Encoding.UTF8, - "application/json") - }; - } - } -} diff --git a/Project/Web/Controllers/PurchaseController.cs b/Project/Web/Controllers/PurchaseController.cs deleted file mode 100644 index 7d19919..0000000 --- a/Project/Web/Controllers/PurchaseController.cs +++ /dev/null @@ -1,215 +0,0 @@ -using System; -using System.Linq; -using System.Net.Http; -using System.Web.Http; -using System.Windows.Forms; - -namespace Project.Web.Controllers -{ - public class PurchaseController : BaseController - { - - - // PUT api/values/5 - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - public void Delete(int id) - { - } - - [HttpGet] - public string Test() - { - return "test"; - } - - [HttpGet] - public HttpResponseMessage Find() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - - var gets = Request.GetQueryNameValuePairs();// GetParameters(data); - - - var key_search = gets.Where(t => t.Key == "search").FirstOrDefault(); - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var searchkey = string.Empty; - if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim(); - - if(searchkey.isEmpty()==false && searchkey != "%") - { - if (searchkey.StartsWith("%") == false) searchkey = "%" + searchkey; - if (searchkey.EndsWith("%") == false) searchkey += "%"; - } - - var tbody = new System.Text.StringBuilder(); - - //테이블데이터생성 - var itemcnt = 0; - if (searchkey.isEmpty() == false) - { - var db = new dsMSSQLTableAdapters.vFindSIDTableAdapter();// EEEntitiesMain(); - var rows = db.GetData(searchkey);//.vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.manu.Contains(searchkey) || t.model.Contains(searchkey)); - itemcnt = rows.Count(); - foreach (var item in rows) - { - tbody.AppendLine(""); - tbody.AppendLine($"{item.Location}"); - tbody.AppendLine($"{item.sid}"); - tbody.AppendLine($"{item.name}"); - tbody.AppendLine($"{item.model}"); - - if (item.IspriceNull()) - tbody.AppendLine($"--"); - else - { - var price = (double)item.price / 1000.0; - - tbody.AppendLine($"{price.ToString("N0")}"); - } - - - tbody.AppendLine($"{item.manu}"); - tbody.AppendLine($"{item.supply}"); - - if (item.remark.Length > 10) - tbody.AppendLine($"{item.remark.Substring(0, 10)}..."); - else - tbody.AppendLine($"{item.remark}"); - tbody.AppendLine(""); - } - } - - //아잍쳄이 없는경우 - if (itemcnt == 0) - { - tbody.AppendLine(""); - tbody.AppendLine("1"); - tbody.AppendLine("자료가 없습니다"); - tbody.AppendLine(""); - } - - - var contents = result.Content.Replace("{search}", searchkey); - contents = contents.Replace("{tabledata}", tbody.ToString()); - contents = contents.Replace("{cnt}", itemcnt.ToString()); - - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage Index() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - - var gets = Request.GetQueryNameValuePairs();// GetParameters(data); - - - var key_search = gets.Where(t => t.Key == "search").FirstOrDefault(); - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var searchkey = string.Empty; - if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim(); - - var tbody = new System.Text.StringBuilder(); - - //테이블데이터생성 - var itemcnt = 0; - //if (searchkey.isEmpty() == false) - //{ - var db = new dsMSSQLTableAdapters.vPurchaseTableAdapter();// EEEntitiesPurchase(); - var sd = DateTime.Now.ToString("yyyy-MM-01"); - var rows = db.GetAfter(FCOMMON.info.Login.gcode, sd);// .vPurchase.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) >= 0).OrderByDescending(t => t.pdate); - itemcnt = rows.Count(); - foreach (var item in rows) - { - tbody.AppendLine(""); - tbody.AppendLine($"{item.pdate.Substring(5)}"); - - if (item.state == "---") tbody.AppendLine($"{item.state}"); - else if (item.state == "Received") tbody.AppendLine($"{item.state}"); - else tbody.AppendLine($"{item.state}"); - - tbody.AppendLine($"{item.name}"); - tbody.AppendLine($"{item.sid}"); - tbody.AppendLine($"{item.pumname}"); - - if (item.pumscale.Length > 10) tbody.AppendLine($"{item.pumscale.Substring(0, 10)}..."); - else tbody.AppendLine($"{item.pumscale}"); - - tbody.AppendLine($"{item.pumqty}"); - tbody.AppendLine($"{item.pumprice}"); - tbody.AppendLine($"{item.pumamt}"); - tbody.AppendLine($"{item.supply}"); - if (item.project != null && item.project.Length > 10) tbody.AppendLine($"{item.project.Substring(0, 10)}..."); - else tbody.AppendLine($"{item.project}"); - - if (item.bigo.Length > 10) tbody.AppendLine($"{item.bigo.Substring(0, 10)}..."); - else tbody.AppendLine($"{item.bigo}"); - tbody.AppendLine(""); - } - //} - - //아잍쳄이 없는경우 - if (itemcnt == 0) - { - tbody.AppendLine(""); - tbody.AppendLine("1"); - tbody.AppendLine("자료가 없습니다"); - tbody.AppendLine(""); - } - - - var contents = result.Content.Replace("{search}", searchkey); - contents = contents.Replace("{tabledata}", tbody.ToString()); - contents = contents.Replace("{cnt}", itemcnt.ToString()); - - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - } -} diff --git a/Project/Web/Controllers/ReactController.cs b/Project/Web/Controllers/ReactController.cs deleted file mode 100644 index 1a288e3..0000000 --- a/Project/Web/Controllers/ReactController.cs +++ /dev/null @@ -1,358 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using System.Web.Http; - -namespace Project.Web.Controllers -{ - public class ReactController : ApiController - { - private string GetWwwRootPath() - { - // 실행 파일 기준으로 wwwroot 경로 찾기 - var baseDir = AppDomain.CurrentDomain.BaseDirectory; - var wwwrootPath = Path.Combine(baseDir, "Web", "wwwroot"); - - // 디버그 모드에서는 소스 경로 사용 - if (!Directory.Exists(wwwrootPath)) - { - wwwrootPath = Path.Combine(Directory.GetCurrentDirectory(), "Web", "wwwroot"); - } - - // 여전히 찾지 못하면 프로젝트 루트에서 찾기 - if (!Directory.Exists(wwwrootPath)) - { - var projectRoot = Directory.GetCurrentDirectory(); - while (projectRoot != null && !Directory.Exists(Path.Combine(projectRoot, "Web", "wwwroot"))) - { - projectRoot = Directory.GetParent(projectRoot)?.FullName; - } - if (projectRoot != null) - { - wwwrootPath = Path.Combine(projectRoot, "Web", "wwwroot"); - } - } - - return wwwrootPath; - } - - [HttpGet] - [Route("react/test")] - public HttpResponseMessage Test() - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react-test.html"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, - $"React test file not found. Searched path: {filePath}. WWWRoot: {wwwrootPath}. Current Dir: {Directory.GetCurrentDirectory()}"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/html"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React test page: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/jsx-test")] - public HttpResponseMessage JsxTest() - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react-jsx-test.html"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, "React JSX test file not found"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/html"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React JSX test page: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/component/{filename}")] - public HttpResponseMessage Component(string filename) - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react", $"{filename}.jsx"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, $"React component {filename} not found at {filePath}"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/javascript"); - - // CORS 헤더 추가 - response.Headers.Add("Access-Control-Allow-Origin", "*"); - response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS"); - response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Authorization"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React component {filename}: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/login")] - public HttpResponseMessage Login() - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react-login.html"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, - $"React login page not found. Searched path: {filePath}"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/html"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React login page: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/dashboard")] - public HttpResponseMessage Dashboard() - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react-dashboard.html"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, - $"React dashboard page not found. Searched path: {filePath}"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/html"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React dashboard page: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/common")] - public HttpResponseMessage Common() - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react-common.html"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, - $"React common page not found: {filePath}"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/html"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React common page: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/jobreport")] - public HttpResponseMessage JobReport() - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react-jobreport.html"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, - $"React jobreport page not found: {filePath}"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/html"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React jobreport page: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/kuntae")] - public HttpResponseMessage Kuntae() - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react-kuntae.html"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, - $"React kuntae page not found: {filePath}"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/html"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React kuntae page: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/todo")] - public HttpResponseMessage Todo() - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react-todo.html"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, - $"React todo page not found: {filePath}"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/html"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React todo page: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/project")] - public HttpResponseMessage Project() - { - try - { - var wwwrootPath = GetWwwRootPath(); - var filePath = Path.Combine(wwwrootPath, "react-project.html"); - - if (!File.Exists(filePath)) - { - return Request.CreateErrorResponse(HttpStatusCode.NotFound, - $"React project page not found: {filePath}"); - } - - var content = File.ReadAllText(filePath, Encoding.UTF8); - var response = Request.CreateResponse(HttpStatusCode.OK); - response.Content = new StringContent(content, Encoding.UTF8, "text/html"); - - return response; - } - catch (Exception ex) - { - return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, - $"Error serving React project page: {ex.Message}"); - } - } - - [HttpGet] - [Route("react/status")] - public IHttpActionResult Status() - { - return Ok(new - { - status = "React Controller Active", - timestamp = DateTime.Now, - routes = new[] - { - "/react/test - React 기본 테스트 페이지", - "/react/jsx-test - React JSX 모듈화 테스트 페이지", - "/react/login - React 로그인 페이지", - "/react/dashboard - React 대시보드 페이지", - "/react/common - React 공용코드 페이지", - "/react/jobreport - React 업무일지 페이지", - "/react/kuntae - React 근태관리 페이지", - "/react/todo - React 할일관리 페이지", - "/react/project - React 프로젝트 페이지", - "/react/component/{filename} - JSX 컴포넌트 파일 서빙", - "/react/status - 이 상태 페이지" - } - }); - } - } -} \ No newline at end of file diff --git a/Project/Web/Controllers/ResourceController.cs b/Project/Web/Controllers/ResourceController.cs deleted file mode 100644 index 8767776..0000000 --- a/Project/Web/Controllers/ResourceController.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using System.Web.Http; - -namespace Project.Web.Controllers -{ - public class ResourceController : BaseController - { - //[HttpGet] - //public HttpResponseMessage Index() - //{ - // //로그인이 되어있지않다면 로그인을 가져온다 - // MethodResult result; - // result = View(true); - - // var model = GetGlobalModel(); - // var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - // //기본값을 찾아서 없애줘야한다 - // var contents = result.Content; - - // //공용값 적용 - // ApplyCommonValue(ref contents); - - // //최종문자 적용 - // result.Content = contents; - - // var resp = new HttpResponseMessage() - // { - // Content = new StringContent( - // result.Content, - // System.Text.Encoding.UTF8, - // "text/html") - // }; - - // return resp; - //} - - [HttpGet] - public HttpResponseMessage file() - { - var config = RequestContext.Configuration; - var routeData = config.Routes.GetRouteData(Request).Values.ToList(); - - var p_resource = routeData.Where(t => t.Key == "resource").FirstOrDefault(); - var p_path = routeData.Where(t => t.Key == "path").FirstOrDefault(); - var p_ext = routeData.Where(t => t.Key == "ext").FirstOrDefault(); - var p_subdir = routeData.Where(t => t.Key == "subdir").FirstOrDefault(); - - var v_resource = string.Empty; - var v_path = string.Empty; - var v_ext = string.Empty; - var v_subdir = string.Empty; - - if (p_resource.Key == "resource") v_resource = p_resource.Value.ToString(); - if (p_path.Key == "path") v_path = p_path.Value.ToString(); - if (p_ext.Key == "ext") v_ext = p_ext.Value.ToString(); - if (p_subdir.Key == "subdir") v_subdir = p_subdir.Value.ToString(); - - //var file_ext = routeData[0].Value.ToString(); - //var name_resource = routeData[1].Value.ToString() + "." + file_ext; - //var name_action = routeData[3].Value.ToString(); - - Boolean isBinary = true; - - - string content_type = "text/plain"; - - if (v_ext == "json") - { - isBinary = false; - content_type = "application/json"; - } - else if(v_ext == "vue") - { - isBinary = false; - content_type = "application/js"; - } - else if (v_ext == "js") - { - isBinary = false; - content_type = "application/js"; - } - else if (v_ext == "css") - { - isBinary = false; - content_type = "text/css"; - } - else if (v_ext == "csv") - { - isBinary = false; - content_type = "text/csv"; - } - else if (v_ext == "ico") - { - isBinary = true; - content_type = "image/x-icon"; - } - else if(v_ext == "ttf" || v_ext == "otf") - { - isBinary = true; - content_type = "application/octet-stream"; - } - - HttpContent resultContent = null; - - if (v_resource.isEmpty() && v_ext.isEmpty()) - { - v_resource = "index"; - v_ext = "html"; - isBinary = false; - content_type = "text/html"; - } - - - - var file = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", v_path, v_subdir, v_resource + "." + v_ext); - - if (isBinary) - { - - if (System.IO.File.Exists(file)) - { - var buffer = System.IO.File.ReadAllBytes(file); - resultContent = new ByteArrayContent(buffer); - Console.WriteLine(">>File(B) : " + file); - } - else Console.WriteLine("no resouoir file " + file); - - } - else - { - if (System.IO.File.Exists(file)) - { - - var buffer = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8); - resultContent = new StringContent(buffer, System.Text.Encoding.UTF8, content_type); - Console.WriteLine(">>File(S) : " + file); - } - else Console.WriteLine("no resouoir file " + file); - } - - - return new HttpResponseMessage() - { - Content = resultContent - }; - - } - } -} diff --git a/Project/Web/Controllers/ResultController.cs b/Project/Web/Controllers/ResultController.cs deleted file mode 100644 index bbdc2a5..0000000 --- a/Project/Web/Controllers/ResultController.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Linq; -using System.Net.Http; -using System.Web.Http; - -namespace Project.Web.Controllers -{ - public class ResultController : BaseController - { - [HttpPost] - public void Index([FromBody]string value) - { - - } - - // PUT api/values/5 - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api/values/5 - public void Delete(int id) - { - } - - [HttpGet] - public string Test() - { - return "test"; - } - - - [HttpGet] - public HttpResponseMessage Index() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var contents = result.Content; - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - } -} diff --git a/Project/Web/Controllers/SettingController.cs b/Project/Web/Controllers/SettingController.cs deleted file mode 100644 index 021616d..0000000 --- a/Project/Web/Controllers/SettingController.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Linq; -using System.Net.Http; -using System.Web.Http; - -namespace Project.Web.Controllers -{ - public class SettingController : BaseController - { - [HttpPost] - public void Index([FromBody]string value) - { - - } - - // PUT api/values/5 - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api/values/5 - public void Delete(int id) - { - } - - [HttpGet] - public string Test() - { - return "test"; - } - - [HttpGet] - public HttpResponseMessage Index() - { - //로그인이 되어있지않다면 로그인을 가져온다 - MethodResult result; - result = View(); - - var model = GetGlobalModel(); - var getParams = Request.GetQueryNameValuePairs();// GetParameters(data); - - //기본값을 찾아서 없애줘야한다 - var contents = result.Content; - - //공용값 적용 - ApplyCommonValue(ref contents); - - //최종문자 적용 - result.Content = contents; - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - result.Content, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - } -} diff --git a/Project/Web/Controllers/TodoController.cs b/Project/Web/Controllers/TodoController.cs deleted file mode 100644 index b56161e..0000000 --- a/Project/Web/Controllers/TodoController.cs +++ /dev/null @@ -1,439 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Web.Http; -using Newtonsoft.Json; -using FCOMMON; -using Project.Web.Model; - -namespace Project.Web.Controllers -{ - public class TodoController : BaseController - { - [HttpGet] - public HttpResponseMessage Index() - { - var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Todo", "index.html"); - var contents = string.Empty; - - if (System.IO.File.Exists(filePath)) - { - contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8); - } - else - { - contents = "

404 - File Not Found

The requested file was not found: " + filePath + "

"; - } - - ApplyCommonValue(ref contents); - - var resp = new HttpResponseMessage() - { - Content = new StringContent( - contents, - System.Text.Encoding.UTF8, - "text/html") - }; - - return resp; - } - - [HttpGet] - public HttpResponseMessage GetTodos() - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - string uid = FCOMMON.info.Login.no; - - var sql = @"SELECT * FROM EETGW_Todo WHERE gcode = @gcode AND uid = @uid - ORDER BY - CASE - WHEN ISNULL(status,'0') = '1' THEN 1 -- 진행 - WHEN ISNULL(status,'0') = '0' THEN 2 -- 대기 - WHEN ISNULL(status,'0') = '3' THEN 3 -- 보류 - WHEN ISNULL(status,'0') = '5' THEN 4 -- 완료 - WHEN ISNULL(status,'0') = '2' THEN 5 -- 취소 - ELSE 6 - END, flag DESC, - ISNULL(seqno, 0) DESC, - expire ASC"; - var todos = DBM.Query(sql, new { gcode = gcode, uid = uid }); - - return CreateJsonResponse(new - { - Success = true, - Data = todos - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "Todo 목록을 가져오는 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - [HttpGet] - public HttpResponseMessage GetUrgentTodos() - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - string uid = FCOMMON.info.Login.no; - - var sql = @" - SELECT * FROM EETGW_Todo - WHERE gcode = @gcode AND uid = @uid - and isnull(status,'0') not in ('2','3','5') - ORDER BY flag DESC, seqno DESC, expire ASC, wdate ASC"; - - var todos = DBM.Query(sql, new { gcode = gcode, uid = uid }); - - return CreateJsonResponse(new - { - Success = true, - Data = todos - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "급한 Todo 목록을 가져오는 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - [HttpPost] - public HttpResponseMessage CreateTodo([FromBody] TodoModel todo) - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - if (string.IsNullOrEmpty(todo.remark)) - { - return CreateJsonResponse(new - { - Success = false, - Message = "할일 내용은 필수입니다." - }); - } - - todo.gcode = FCOMMON.info.Login.gcode; - todo.uid = FCOMMON.info.Login.no; - todo.wuid = FCOMMON.info.Login.no; - todo.wdate = DateTime.Now; - - if (todo.seqno == null) todo.seqno = 0; - if (todo.flag == null) todo.flag = false; - if (todo.status == '\0') todo.status = '0'; - - // 새로 생성할 때 완료 상태면 완료일 설정 - DateTime? okdateValue = null; - if (todo.status == '5') - { - okdateValue = DateTime.Now; - } - - var sql = @" - INSERT INTO EETGW_Todo (gcode, uid, title, remark, flag, expire, seqno, request, status, okdate, wuid, wdate) - VALUES (@gcode, @uid, @title, @remark, @flag, @expire, @seqno, @request, @status, @okdate, @wuid, @wdate); - SELECT SCOPE_IDENTITY();"; - - var newId = DBM.QuerySingle(sql, new - { - gcode = todo.gcode, - uid = todo.uid, - title = todo.title, - remark = todo.remark, - flag = todo.flag, - expire = todo.expire, - seqno = todo.seqno, - request = todo.request, - status = todo.status, - okdate = okdateValue, - wuid = todo.wuid, - wdate = todo.wdate - }); - - return CreateJsonResponse(new - { - Success = true, - Message = "할일이 추가되었습니다.", - Data = new { idx = newId } - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "할일 추가 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - [HttpPut] - public HttpResponseMessage UpdateTodo([FromBody] TodoModel todo) - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - if (todo.idx <= 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "유효하지 않은 Todo ID입니다." - }); - } - - if (string.IsNullOrEmpty(todo.remark)) - { - return CreateJsonResponse(new - { - Success = false, - Message = "할일 내용은 필수입니다." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - string uid = FCOMMON.info.Login.no; - - // 상태가 완료('5')로 변경되고 아직 완료일이 설정되지 않은 경우 완료일 설정 - DateTime? okdateValue = null; - if (todo.status == '5') - { - // 기존 완료일이 있는지 확인 - var existingTodo = DBM.QuerySingleOrDefault( - "SELECT okdate FROM EETGW_Todo WHERE idx = @idx AND gcode = @gcode AND uid = @uid", - new { idx = todo.idx, gcode = gcode, uid = uid }); - - if (existingTodo?.okdate == null) - { - okdateValue = DateTime.Now; - } - } - - var sql = @" - UPDATE EETGW_Todo - SET title = @title, remark = @remark, flag = @flag, expire = @expire, seqno = @seqno, request = @request, status = @status, okdate = @okdate - WHERE idx = @idx AND gcode = @gcode AND uid = @uid"; - - var affectedRows = DBM.Execute(sql, new - { - title = todo.title, - remark = todo.remark, - flag = todo.flag ?? false, - expire = todo.expire, - seqno = todo.seqno ?? 0, - request = todo.request, - status = todo.status == '\0' ? '0' : todo.status, - okdate = okdateValue, - idx = todo.idx, - gcode = gcode, - uid = uid - }); - - if (affectedRows == 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "수정할 할일을 찾을 수 없습니다." - }); - } - - return CreateJsonResponse(new - { - Success = true, - Message = "할일이 수정되었습니다." - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "할일 수정 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - [HttpDelete] - public HttpResponseMessage DeleteTodo(int id) - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - if (id <= 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "유효하지 않은 Todo ID입니다." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - string uid = FCOMMON.info.Login.no; - - var sql = "DELETE FROM EETGW_Todo WHERE idx = @idx AND gcode = @gcode AND uid = @uid"; - var affectedRows = DBM.Execute(sql, new { idx = id, gcode = gcode, uid = uid }); - - if (affectedRows == 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "삭제할 할일을 찾을 수 없습니다." - }); - } - - return CreateJsonResponse(new - { - Success = true, - Message = "할일이 삭제되었습니다." - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "할일 삭제 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - [HttpGet] - public HttpResponseMessage GetTodo(int id) - { - try - { - var currentUser = GetCurrentUser(); - if (currentUser == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "로그인되지 않은 상태입니다." - }); - } - - if (id <= 0) - { - return CreateJsonResponse(new - { - Success = false, - Message = "유효하지 않은 Todo ID입니다." - }); - } - - string gcode = FCOMMON.info.Login.gcode; - string uid = FCOMMON.info.Login.no; - - var sql = "SELECT * FROM EETGW_Todo WHERE idx = @idx AND gcode = @gcode AND uid = @uid"; - var todo = DBM.QuerySingleOrDefault(sql, new { idx = id, gcode = gcode, uid = uid }); - - if (todo == null) - { - return CreateJsonResponse(new - { - Success = false, - Message = "할일을 찾을 수 없습니다." - }); - } - - return CreateJsonResponse(new - { - Success = true, - Data = todo - }); - } - catch (Exception ex) - { - return CreateJsonResponse(new - { - Success = false, - Message = "할일 조회 중 오류가 발생했습니다: " + ex.Message - }); - } - } - - private object GetCurrentUser() - { - if (string.IsNullOrEmpty(FCOMMON.info.Login.no)) return null; - else return FCOMMON.info.Login; - } - - private HttpResponseMessage CreateJsonResponse(object data) - { - var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore, - DateFormatString = "yyyy-MM-dd HH:mm:ss" - }); - - return new HttpResponseMessage() - { - Content = new StringContent( - json, - System.Text.Encoding.UTF8, - "application/json") - }; - } - } -} diff --git a/Project/Web/Startup.cs b/Project/Web/Startup.cs deleted file mode 100644 index 6734740..0000000 --- a/Project/Web/Startup.cs +++ /dev/null @@ -1,111 +0,0 @@ -using Microsoft.Owin; -using Microsoft.Owin.StaticFiles; -using Owin; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using System.Web.Http; -using System.Web.Http.Routing; -using Project.Web.Controllers; - -namespace Project.OWIN -{ - public class Startup - { - public void Configuration(IAppBuilder app) - { - app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); - - // 캐시 방지 미들웨어를 가장 먼저 설정 (정적 파일 서빙보다 우선) - app.Use(async (context, next) => - { - var path = context.Request.Path.Value; - - // 모든 정적 리소스에 대해 캐시 방지 헤더 설정 - if (path.EndsWith(".js") || - path.EndsWith(".css") || - path.EndsWith(".jsx") || - path.EndsWith(".tsx") || - path.EndsWith(".html") || - path.EndsWith(".htm")) - { - context.Response.Headers["Cache-Control"] = "no-cache, no-store, must-revalidate"; - context.Response.Headers["Pragma"] = "no-cache"; - context.Response.Headers["Expires"] = "0"; - } - - // JSX/TSX 파일을 JavaScript로 처리 - if (path.EndsWith(".jsx") || path.EndsWith(".tsx")) - { - context.Response.ContentType = "application/javascript; charset=utf-8"; - } - - await next(); - }); - - // 정적 파일 서빙 설정 - var staticFileOptions = new FileServerOptions - { - EnableDefaultFiles = true, - DefaultFilesOptions = { DefaultFileNames = { "index.html" } }, - FileSystem = new Microsoft.Owin.FileSystems.PhysicalFileSystem("Web/wwwroot"), - RequestPath = Microsoft.Owin.PathString.Empty - }; - app.UseFileServer(staticFileOptions); - - // Configure Web API for Self-Host (정적 파일 후에 설정) - HttpConfiguration config = new HttpConfiguration(); - - //라우팅 설정 - config.MapHttpAttributeRoutes(); - - // 컨트롤러만 있는 경우 기본 액션을 Index로 설정 - config.Routes.MapHttpRoute( - name: "ControllerOnly", - routeTemplate: "{controller}", - defaults: new { action = "Index" } - ); - - config.Routes.MapHttpRoute( - name: "DefaultApi", - routeTemplate: "{controller}/{action}/{id}", - defaults: new { id = RouteParameter.Optional } - ); - - // JSON 포맷터 설정 - config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; - - // 파일 업로드 설정 - config.Formatters.Remove(config.Formatters.XmlFormatter); - - app.UseWebApi(config); - - //appBuilder.UseFileServer(new FileServerOptions - //{ - // RequestPath = new PathString(string.Empty), - // FileSystem = new PhysicalFileSystem("./MySubFolder"), - // EnableDirectoryBrowsing = true, - //}); - - //appBuilder.UseStageMarker(PipelineStage.MapHandler); - - - //config.Routes.MapHttpRoute( - // name: "ignore", - // routeTemplate: @".*\.(css|js|gif|jpg)(/.*)?", - // defaults: new - // { - // controller = "file", - // action = "readtext", - // id = RouteParameter.Optional - // } - // ); - - - - } - - } -} diff --git a/Project/fMain.cs b/Project/fMain.cs index 2dad6c9..c0f73a7 100644 --- a/Project/fMain.cs +++ b/Project/fMain.cs @@ -1,6 +1,5 @@ using FBS0000; using FCOMMON; -using Microsoft.Owin.Hosting; using Project.Dialog; using System; using System.Collections.Generic; @@ -18,8 +17,6 @@ namespace Project public partial class fMain : fBase { string SearchKey = string.Empty; - private IDisposable webApp; - bool webok = false; private ChatClientService chatService; private System.Windows.Forms.Timer chatBlinkTimer; private bool chatHasNewMessage = false; @@ -90,7 +87,6 @@ namespace Project private void __Closing(object sender, FormClosingEventArgs e) { - webApp?.Dispose(); MessageWindow.CloseAll(); if (closeforce == false) { @@ -134,48 +130,6 @@ namespace Project UpdateControls(); tmDisplay.Start(); //display timer - // Start OWIN host with port fallback mechanism (포트 자동 탐색) - webok = false; - int startPort = 7979; - int maxPort = 8000; // 최대 8000 포트까지 시도 - - for (int port = startPort; port <= maxPort; port++) - { - try - { - var url = $"http://127.0.0.1:{port}"; - var options = new StartOptions(url); - webApp = WebApp.Start(options); - - // 성공 시 실제 사용된 포트 저장 - Pub.WebServiceURL = url; - - Console.WriteLine($"웹서버 시작 성공: {url}"); - FCOMMON.Pub.log.AddI($"웹지원 서버 준비 완료 (포트: {port})"); - - if (port != startPort) - { - FCOMMON.Pub.log.AddAT($"기본 포트({startPort})가 사용 중이어서 포트 {port}를 사용합니다."); - } - - webok = true; - break; // 성공하면 루프 종료 - } - catch (Exception ex) - { - Console.WriteLine($"포트 {port} 시작 실패: {ex.Message}"); - - // 마지막 포트까지 실패한 경우에만 에러 로그 - if (port == maxPort) - { - FCOMMON.Pub.log.AddE($"웹서버 시작 실패: 포트 {startPort}~{maxPort} 모두 사용 불가"); - FCOMMON.Pub.log.AddE("상세 오류: " + ex.Message); - webok = false; - } - // 다음 포트 시도 - } - } - // WebView2 초기화 재시도 (필요시) if (Pub.InitWebView == 0) { @@ -208,7 +162,7 @@ namespace Project // WebView2 로그인이 아닌 경우에만 여기서 후처리 실행 // WebView2 로그인의 경우 OnLoginCompleted()에서 호출됨 - if (!(webok && Pub.InitWebView == 1)) + if (Pub.InitWebView != 1) { OnLoginCompleted(); } @@ -284,24 +238,19 @@ namespace Project void Func_Login() { - //Pub.InitWebView = 2; - this.sbWeb.Text = $"Host:{(webok ? "O" : "X")},WebView:{Pub.InitWebView},Server:{Pub.WebServiceURL}"; - if (webok && Pub.InitWebView == 1) + this.sbWeb.Text = $"WebView:{Pub.InitWebView}"; + if (Pub.InitWebView == 1) { - //using (var f = new Dialog.fLogin_WB()) - // if (f.ShowDialog() != System.Windows.Forms.DialogResult.OK) - // Application.ExitThread(); + // WebView2 기반 대시보드 로그인 Menu_Dashboard(); } else { + // 기존 WinForms 로그인 using (var f = new Dialog.fLogin()) if (f.ShowDialog() != System.Windows.Forms.DialogResult.OK) Application.ExitThread(); } - - - } void Func_RunStartForm() { @@ -319,15 +268,8 @@ namespace Project string formkey = "HOLY"; if (!ShowForm(formkey)) { - Form f; - if (webok && Pub.InitWebView == 1 && System.Diagnostics.Debugger.IsAttached) - f = new FBS0000.fHolyday(); - else - f = new FBS0000.fHolyday(); - - AddForm(formkey, f); + AddForm(formkey, new FBS0000.fHolyday()); } - } void _SetLang() @@ -1077,8 +1019,8 @@ namespace Project private void 품목검색ToolStripMenuItem_Click(object sender, EventArgs e) { - var url = $"{Pub.WebServiceURL}/item/find"; - Util.RunExplorer(url); + // OWIN 서버 제거로 인해 기능 비활성화 + Util.MsgI("품목검색 기능은 대시보드에서 이용해 주세요."); } private void layoutToolStripMenuItem_Click(object sender, EventArgs e) @@ -1104,8 +1046,12 @@ namespace Project private void 설명서ToolStripMenuItem_Click(object sender, EventArgs e) { - - Util.RunExplorer($"{Pub.WebServiceURL}/Manual"); + // 로컬 PDF 파일 열기 + var pdfPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Manual.pdf"); + if (System.IO.File.Exists(pdfPath)) + Util.RunExplorer(pdfPath); + else + Util.MsgE("설명서 파일을 찾을 수 없습니다."); } private void 라이선스ToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/Project/packages.config b/Project/packages.config index 7cfff2d..1e23f41 100644 --- a/Project/packages.config +++ b/Project/packages.config @@ -1,30 +1,17 @@ - + - - - - - - - - - - - - - - \ No newline at end of file +