휴가 신청 삭제시 로그파일에 기록되도록 함

This commit is contained in:
ChiKyun Kim
2025-10-29 10:43:28 +09:00
parent 6bd4f84192
commit 3f3a2834df
51 changed files with 1321 additions and 5365 deletions

View File

@@ -7,7 +7,9 @@
"Bash(copy \"C:\\Data\\Source\\(0014) GroupWare\\Source\\Project\\Web\\Controller\\BaseController.cs\" \"C:\\Data\\Source\\(0014) GroupWare\\Source\\EETGW.Shared\\Controllers\"\")",
"Bash(copy:*)",
"Bash(powershell:*)",
"Bash(git add:*)"
"Bash(git add:*)",
"Bash(git checkout:*)",
"Bash(dir \"C:\\Data\\Source\\(0014) GroupWare\\Source\\Project\\Web\\wwwroot\\lib\\js\")"
],
"deny": []
}

179
CLAUDE.md
View File

@@ -47,20 +47,6 @@ This is a Korean Enterprise GroupWare system built with C# .NET Framework 4.6 an
- **Reports**: Microsoft ReportViewer 15.0
- **Excel Processing**: libxl.net and CsvHelper 30.0.1
## Development Commands
### Building the Solution
```bash
# Build the entire solution
msbuild EETGW.sln /p:Configuration=Debug /p:Platform="Any CPU"
# Build for release
msbuild EETGW.sln /p:Configuration=Release /p:Platform="Any CPU"
# Build specific project
msbuild Project/EETGW.csproj /p:Configuration=Debug
```
### Running the Application
- **Debug Mode**: Run from Visual Studio or build and execute the output from `Project/bin/Debug/`
- **Web Server**: Automatically starts on port 7979 when the application launches
@@ -114,3 +100,168 @@ msbuild Project/EETGW.csproj /p:Configuration=Debug
- Multiple authentication methods including AD integration
- Supports both Korean and English localization
- Includes extensive reporting capabilities with RDLC files
## React Development Guidelines
### 파일 생성 및 프로젝트 등록 규칙
**❗ CRITICAL RULE**: 새로운 파일을 생성할 때마다 반드시 EETGW.csproj에 등록해야 합니다.
#### 자동 등록 필수사항
1. **새 파일 생성 시**: Write 도구 사용 후 즉시 프로젝트 파일에 등록
2. **등록 형식**:
```xml
<None Include="Web\wwwroot\[파일경로]">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
```
3. **빌드 작업**: 없음 (`<None>` 태그 사용)
4. **출력 디렉터리**: `PreserveNewest` (새 파일이면 복사)
#### 등록 대상 파일들
- `Web\wwwroot\react\*.jsx` - React 컴포넌트
- `Web\wwwroot\react-*.html` - React 페이지
- `Web\wwwroot\*.html` - HTML 파일
- `Web\wwwroot\*.js`, `Web\wwwroot\*.css` - 정적 자원
### React 아키텍처 패턴
#### 파일 구조
- **컴포넌트**: `/Web/wwwroot/react/[ComponentName].jsx`
- **페이지**: `/Web/wwwroot/react-[pagename].html`
- **라우팅**: `ReactController`에서 `/react/[pagename]` 경로로 서빙
#### React 컴포넌트 구조
```jsx
// React 컴포넌트 기본 구조
const { useState, useEffect, useRef } = React;
function ComponentName() {
// 상태 관리
const [data, setData] = useState({});
const [loading, setLoading] = useState(false);
// API 연동
const loadData = async () => {
try {
const response = await fetch('/Controller/Action');
const result = await response.json();
setData(result);
} catch (error) {
console.error('데이터 로드 실패:', error);
}
};
// 생명주기
useEffect(() => {
loadData();
}, []);
return (
<div>
{/* JSX 컨텐츠 */}
</div>
);
}
```
#### HTML 페이지 구조
```html
<!DOCTYPE html>
<html lang="ko">
<head>
<title>페이지명 (React)</title>
<script src="https://cdn.tailwindcss.com"></script>
<!-- Tailwind 설정 -->
<!-- 스타일 정의 -->
</head>
<body>
<div id="react-app-id">
<!-- 로딩 스켈레톤 UI -->
</div>
<!-- React CDN -->
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<!-- 컴포넌트 로드 -->
<script type="text/babel" src="/react/component/ComponentName"></script>
<!-- 앱 초기화 -->
<script type="text/babel">
const root = ReactDOM.createRoot(document.getElementById('react-app-id'));
root.render(<ComponentName />);
</script>
</body>
</html>
```
### ReactController 패턴
```csharp
[HttpGet]
[Route("react/pagename")]
public HttpResponseMessage PageName()
{
try
{
var wwwrootPath = GetWwwRootPath();
var filePath = Path.Combine(wwwrootPath, "react-pagename.html");
if (!File.Exists(filePath))
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound,
$"React 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 page: {ex.Message}");
}
}
```
### 개발 워크플로우
1. **컴포넌트 생성**: `/react/ComponentName.jsx` 파일 생성
2. **페이지 생성**: `/react-pagename.html` 파일 생성
3. **프로젝트 등록**: EETGW.csproj에 두 파일 모두 등록
4. **라우트 추가**: ReactController에 새 라우트 추가
5. **테스트**: 빌드 후 `/react/pagename`으로 접근 테스트
### API 연동 가이드라인
- **병렬 호출**: `Promise.all()` 사용으로 성능 최적화
- **에러 처리**: try-catch로 모든 API 호출 감싸기
- **로딩 상태**: 사용자 경험을 위한 로딩 인디케이터 필수
- **실시간 업데이트**: 중요한 데이터는 자동 새로고침 구현
### 디자인 시스템
- **CSS 프레임워크**: Tailwind CSS 사용
- **색상 팔레트**: primary, success, warning, danger 정의
- **글래스 효과**: `glass-effect` 클래스 활용
- **애니메이션**: `animate-fade-in`, `animate-slide-up` 등
- **반응형**: 모바일 퍼스트 접근법
### 품질 기준
- **접근성**: 키보드 네비게이션, 스크린 리더 지원
- **성능**: 30초 자동 새로고침, 로딩 최적화
- **에러 처리**: 사용자 친화적 오류 메시지
- **호환성**: 모든 주요 브라우저 지원
### 주의사항
- 기존 시스템과 병행 개발 (`/react/` 하위에서 개발)
- 기존 API 컨트롤러 최대한 재사용
- 동일한 디자인 언어 유지 (색상, 폰트, 레이아웃)
- 단계적 전환을 위한 라우팅 분리

View File

@@ -4,9 +4,9 @@
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="38" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<Shapes>
<Shape ID="DesignTable:MailForm" ZOrder="1" X="222" Y="158" Height="305" Width="200" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:MailForm" ZOrder="1" X="198" Y="160" Height="305" Width="200" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:MailData" ZOrder="2" X="456" Y="157" Height="305" Width="197" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:MailAuto" ZOrder="11" X="711" Y="160" Height="305" Width="199" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:vMailingProjectSchedule" ZOrder="10" X="204" Y="490" Height="305" Width="289" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />

View File

@@ -80,7 +80,7 @@ namespace Project.Dialog
webView21.CoreWebView2.WebMessageReceived += WebView2_WebMessageReceived;
// OWIN 서버의 Login 페이지로 연결
webView21.Source = new Uri($"{Pub.setting.WebServiceURL}/Home/Login");
webView21.Source = new Uri($"{Pub.setting.WebServiceURL}/home/login");
label1.Visible = false;
}
catch (Exception ex)

View File

@@ -283,22 +283,6 @@
<Compile Include="fSystemCheck.Designer.cs">
<DependentUpon>fSystemCheck.cs</DependentUpon>
</Compile>
<Compile Include="Web\Controller\BaseController.cs" />
<Compile Include="Web\Controller\APIController.cs" />
<Compile Include="Web\Controller\DashBoardController.cs" />
<Compile Include="Web\Controller\CommonController.cs" />
<Compile Include="Web\Controller\TodoController.cs" />
<Compile Include="Web\Controller\KuntaeController.cs" />
<Compile Include="Web\Controller\ManualController.cs" />
<Compile Include="Web\Controller\ProjectController.cs" />
<Compile Include="Web\Controller\JobreportController.cs" />
<Compile Include="Web\Controller\CustomerController.cs" />
<Compile Include="Web\Controller\PurchaseController.cs" />
<Compile Include="Web\Controller\ItemController.cs" />
<Compile Include="Web\Controller\HomeController.cs" />
<Compile Include="Web\Controller\ResourceController.cs" />
<Compile Include="Web\Controller\ResultController.cs" />
<Compile Include="Web\Controller\SettingController.cs" />
<Compile Include="CResult.cs" />
<Compile Include="DataSet1.Designer.cs">
<AutoGen>True</AutoGen>
@@ -419,6 +403,23 @@
<Compile Include="Manager\ModelManager.cs" />
<Compile Include="MessageWindow.cs" />
<Compile Include="MethodExtentions.cs" />
<Compile Include="Web\Controllers\APIController.cs" />
<Compile Include="Web\Controllers\BaseController.cs" />
<Compile Include="Web\Controllers\CommonController.cs" />
<Compile Include="Web\Controllers\CustomerController.cs" />
<Compile Include="Web\Controllers\DashBoardController.cs" />
<Compile Include="Web\Controllers\HomeController.cs" />
<Compile Include="Web\Controllers\ItemController.cs" />
<Compile Include="Web\Controllers\JobreportController.cs" />
<Compile Include="Web\Controllers\KuntaeController.cs" />
<Compile Include="Web\Controllers\ManualController.cs" />
<Compile Include="Web\Controllers\ProjectController.cs" />
<Compile Include="Web\Controllers\PurchaseController.cs" />
<Compile Include="Web\Controllers\ReactController.cs" />
<Compile Include="Web\Controllers\ResourceController.cs" />
<Compile Include="Web\Controllers\ResultController.cs" />
<Compile Include="Web\Controllers\SettingController.cs" />
<Compile Include="Web\Controllers\TodoController.cs" />
<Compile Include="Web\Model\PageModel.cs" />
<Compile Include="Web\Model\ProjectModel.cs" />
<Compile Include="Web\Model\TodoModel.cs" />
@@ -670,6 +671,21 @@
<Content Include="Web\wwwroot\Project\index.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Web\wwwroot\react\LoginApp.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\react\TestApp.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\react\DashboardApp.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\react\CommonNavigation.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\react\CommonCode.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\css\common.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -706,6 +722,36 @@
<None Include="Web\wwwroot\login.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\react\JobReport.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\react\Kuntae.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\react\Todo.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\react\Project.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\lib\js\react.development.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\lib\js\react-dom.development.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\lib\js\babel.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\lib\css\tailwind.min.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\lib\js\tailwind-config.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Web\wwwroot\react\DevWarning.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">

View File

@@ -52,13 +52,13 @@ namespace Project.Manager
int lineCount = 0;
string buffer = string.Empty;
Pub.log.Add("ModelData Load : " + model.ToString() + "fn=" + filename);
FCOMMON.Pub.log.Add("ModelData Load : " + model.ToString() + "fn=" + filename);
//read file
var fi = new FileInfo(filename);
if (fi.Exists == false)
{
Pub.log.AddE(string.Format("▣ No Data",model));
FCOMMON.Pub.log.AddE(string.Format("▣ No Data",model));
return;
}
@@ -70,7 +70,7 @@ namespace Project.Manager
catch (Exception ex)
{
buffer = string.Empty;
Pub.log.AddE(string.Format("ItemData Error File={0},Message={1}", filename, ex.Message));
FCOMMON.Pub.log.AddE(string.Format("ItemData Error File={0},Message={1}", filename, ex.Message));
return;
}
@@ -112,7 +112,7 @@ namespace Project.Manager
}
catch (Exception ex)
{
Pub.log.AddE("Item Load Error:" + ex.Message);
FCOMMON.Pub.log.AddE("Item Load Error:" + ex.Message);
}
}
@@ -127,7 +127,7 @@ namespace Project.Manager
}
catch (Exception ex)
{
Pub.log.AddE("Load Item file" + ex.Message);
FCOMMON.Pub.log.AddE("Load Item file" + ex.Message);
}
}
@@ -157,7 +157,7 @@ namespace Project.Manager
sb.AppendLine(dt.TableName + " : " + dt.Rows.Count.ToString() + "건");
}
Pub.log.AddI(sb.ToString());
FCOMMON.Pub.log.AddI(sb.ToString());
}
public void Save()
@@ -223,12 +223,12 @@ namespace Project.Manager
try
{
System.IO.File.WriteAllText(fn[(int)model], data.ToString(), System.Text.Encoding.Default);
Pub.log.AddAT("Save "+ model.ToString()+" Parameter - OK");
FCOMMON.Pub.log.AddAT("Save "+ model.ToString()+" Parameter - OK");
}
catch (Exception ex)
{
Util.MsgE("Save Error\r\n" + ex.Message);
Pub.log.AddE("Save Error :: " + ex.Message);
FCOMMON.Pub.log.AddE("Save Error :: " + ex.Message);
}
}

View File

@@ -103,8 +103,8 @@ namespace Project
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string emsg = "Fatal Error(UHE)\n\n" + e.ExceptionObject.ToString();
Pub.log.AddE(emsg);
Pub.log.Flush();
FCOMMON.Pub.log.AddE(emsg);
FCOMMON.Pub.log.Flush();
Util.SaveBugReport(emsg);
var f = new fErrorException(emsg);
f.ShowDialog();
@@ -114,8 +114,8 @@ namespace Project
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
string emsg = "Fatal Error(ATE)\n\n" + e.Exception.ToString();
Pub.log.AddE(emsg);
Pub.log.Flush();
FCOMMON.Pub.log.AddE(emsg);
FCOMMON.Pub.log.Flush();
Util.SaveBugReport(emsg);
var f = new fErrorException(emsg);
f.ShowDialog();

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("25.07.14.1050")]
[assembly: AssemblyFileVersion("25.07.14.1050")]
[assembly: AssemblyVersion("25.10.17.1600")]
[assembly: AssemblyFileVersion("25.10.17.1600")]

View File

@@ -24,7 +24,7 @@ namespace Project
public static UserSetting uSetting; //user setting
public static Setting setting; //global setting
public static arUtil.Log log; //global logging system
public static DateTime LastInputTime = DateTime.Now;
public static CResult Result = new CResult();
@@ -185,7 +185,7 @@ namespace Project
uSetting.Load();
//log
log = new arUtil.Log();
FCOMMON.Pub.log = new arUtil.Log();
//clear login info
FCOMMON.info.Login = new FCOMMON.info.sUserInfo();
@@ -234,7 +234,7 @@ namespace Project
InitWebView = 1;
}
catch(Exception ex)
catch (Exception ex)
{
Console.WriteLine(ex.Message);
InitWebView = 2;
@@ -375,7 +375,7 @@ namespace Project
}
catch (Exception ex)
{
Pub.log.AddE(ex.Message);
FCOMMON.Pub.log.AddE(ex.Message);
}
});

View File

@@ -409,7 +409,7 @@ namespace Project
var fi = new System.IO.FileInfo(file);
if (!fi.Exists)
{
Pub.log.AddE("Run Error : " + file);
FCOMMON.Pub.log.AddE("Run Error : " + file);
return false;
}
System.Diagnostics.Process prc = new System.Diagnostics.Process();

View File

@@ -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;
}
}
}

View File

@@ -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<MethodResult>
{
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) <br />" + 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) <br />" + 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_;
}
}
}
}

View File

@@ -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 = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
}
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; } // 데이터를기록한일시
}
}

View File

@@ -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("<tr>");
tbody.AppendLine($"<th scope='row'>{item.name}</th>");
tbody.AppendLine($"<td>{item.name2}</td>");
tbody.AppendLine($"<td>{item.name}</td>");
//tbody.AppendLine($"<td>{item.model}</td>");
//if (item.price == null)
// tbody.AppendLine($"<td>--</td>");
//else
//{
// var price = (double)item.price / 1000.0;
// tbody.AppendLine($"<td>{price.ToString("N0")}</td>");
//}
//tbody.AppendLine($"<td>{item.manu}</td>");
//tbody.AppendLine($"<td>{item.supply}</td>");
//if (item.remark.Length > 10)
// tbody.AppendLine($"<td>{item.remark.Substring(0, 10)}...</td>");
//else
// tbody.AppendLine($"<td>{item.remark}</td>");
tbody.AppendLine("</tr>");
}
}
//아잍쳄이 없는경우
if (itemcnt == 0)
{
tbody.AppendLine("<tr>");
tbody.AppendLine("<th scope='row'>1</th>");
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
tbody.AppendLine("</tr>");
}
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("<tr>");
tbody.AppendLine($"<th scope='row'>{item.grp}</th>");
tbody.AppendLine($"<td>{item.name}</td>");
tbody.AppendLine($"<td>{item.name2}</td>");
tbody.AppendLine($"<td>{item.tel}</td>");
tbody.AppendLine($"<td>{item.fax}</td>");
tbody.AppendLine($"<td>{item.email}</td>");
tbody.AppendLine($"<td>{item.address}</td>");
if (string.IsNullOrEmpty( item.memo)==false && item.memo.Length > 10) tbody.AppendLine($"<td>{item.memo.Substring(0, 10)}...</td>");
else tbody.AppendLine($"<td>{item.memo}</td>");
tbody.AppendLine("</tr>");
}
}
//아잍쳄이 없는경우
if (itemcnt == 0)
{
tbody.AppendLine("<tr>");
tbody.AppendLine("<th scope='row'>1</th>");
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
tbody.AppendLine("</tr>");
}
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;
}
}
}

View File

@@ -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);
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 = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
}
//공용값 적용
//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")
};
}
}
}

View File

@@ -1,334 +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 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 = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
}
//공용값 적용
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
});
}
}
}
}

View File

@@ -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("<tr>");
tbody.AppendLine($"<th scope='row'>{item.Location}</th>");
tbody.AppendLine($"<td>{item.sid}</td>");
tbody.AppendLine($"<td>{item.name}</td>");
tbody.AppendLine($"<td>{item.model}</td>");
if (item.IspriceNull())
tbody.AppendLine($"<td>--</td>");
else
{
var price = (double)item.price / 1000.0;
tbody.AppendLine($"<td>{price.ToString("N0")}</td>");
}
tbody.AppendLine($"<td>{item.manu}</td>");
tbody.AppendLine($"<td>{item.supply}</td>");
if (item.remark.Length > 10)
tbody.AppendLine($"<td>{item.remark.Substring(0, 10)}...</td>");
else
tbody.AppendLine($"<td>{item.remark}</td>");
tbody.AppendLine("</tr>");
}
}
//아잍쳄이 없는경우
if (itemcnt == 0)
{
tbody.AppendLine("<tr>");
tbody.AppendLine("<td colspan='8'>자료가 없습니다</td>");
tbody.AppendLine("</tr>");
}
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;
}
}
}

View File

@@ -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("<tr>");
tbody.AppendLine($"<th scope='row'>{item.pdate.Substring(5)}</th>");
tbody.AppendLine($"<td>{item.ww}</td>");
tbody.AppendLine($"<td>{item.name}</td>");
if (item.status == "진행 중" || item.status.EndsWith("%"))
tbody.AppendLine($"<td class='table-info text-center'>{item.status}</td>");
else
tbody.AppendLine($"<td class='text-center'>{item.status}</td>");
tbody.AppendLine($"<td>{item.type}</td>");
tbody.AppendLine($"<td>{item.projectName}</td>");
tbody.AppendLine($"<td>{item.hrs}</td>");
tbody.AppendLine($"<td>{item.ot}</td>");
tbody.AppendLine("<td><span class='d-inline-block text-truncate' style='max-width: 150px;'>");
tbody.AppendLine(item.description);
tbody.AppendLine("</span></td>");
tbody.AppendLine("</tr>");
}
}
//아잍쳄이 없는경우
if (itemcnt == 0)
{
tbody.AppendLine("<tr>");
tbody.AppendLine("<th scope='row'>1</th>");
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
tbody.AppendLine("</tr>");
}
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("<tr>");
tbody.AppendLine($"<th scope='row'>{item.pdate}</th>");
tbody.AppendLine($"<td>{item.status}</td>");
tbody.AppendLine($"<td>{item.name}</td>");
tbody.AppendLine($"<td>{item.projectName}</td>");
tbody.AppendLine($"<td>{item.hrs}</td>");
tbody.AppendLine($"<td>{item.ot}</td>");
tbody.AppendLine($"<td>{item.description}</td>");
if (item.description.Length > 10)
tbody.AppendLine($"<td>{item.description.Substring(0, 10)}...</td>");
else
tbody.AppendLine($"<td>{item.description}</td>");
tbody.AppendLine("</tr>");
}
}
//아잍쳄이 없는경우
if (itemcnt == 0)
{
tbody.AppendLine("<tr>");
tbody.AppendLine("<th scope='row'>1</th>");
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
tbody.AppendLine("</tr>");
}
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 = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
}
//공용값 적용
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<dynamic>();
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<dynamic>();
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"); // 탭
}
}
}

View File

@@ -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 = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
}
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; } // 데이터를기록한일시
}
}

View File

@@ -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;
}
}
}

View File

@@ -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 = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
}
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<ProjectModel>(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<ProjectModel>(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<int>(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<int>(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")
};
}
}
}

View File

@@ -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("<tr>");
tbody.AppendLine($"<th scope='row'>{item.Location}</th>");
tbody.AppendLine($"<td>{item.sid}</td>");
tbody.AppendLine($"<td>{item.name}</td>");
tbody.AppendLine($"<td>{item.model}</td>");
if (item.IspriceNull())
tbody.AppendLine($"<td>--</td>");
else
{
var price = (double)item.price / 1000.0;
tbody.AppendLine($"<td>{price.ToString("N0")}</td>");
}
tbody.AppendLine($"<td>{item.manu}</td>");
tbody.AppendLine($"<td>{item.supply}</td>");
if (item.remark.Length > 10)
tbody.AppendLine($"<td>{item.remark.Substring(0, 10)}...</td>");
else
tbody.AppendLine($"<td>{item.remark}</td>");
tbody.AppendLine("</tr>");
}
}
//아잍쳄이 없는경우
if (itemcnt == 0)
{
tbody.AppendLine("<tr>");
tbody.AppendLine("<th scope='row'>1</th>");
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
tbody.AppendLine("</tr>");
}
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("<tr>");
tbody.AppendLine($"<th scope='row'>{item.pdate.Substring(5)}</th>");
if (item.state == "---") tbody.AppendLine($"<td class='table-info'>{item.state}</td>");
else if (item.state == "Received") tbody.AppendLine($"<td class='table-success'>{item.state}</td>");
else tbody.AppendLine($"<td>{item.state}</td>");
tbody.AppendLine($"<td>{item.name}</td>");
tbody.AppendLine($"<td>{item.sid}</td>");
tbody.AppendLine($"<td>{item.pumname}</td>");
if (item.pumscale.Length > 10) tbody.AppendLine($"<td>{item.pumscale.Substring(0, 10)}...</td>");
else tbody.AppendLine($"<td>{item.pumscale}</td>");
tbody.AppendLine($"<td>{item.pumqty}</td>");
tbody.AppendLine($"<td>{item.pumprice}</td>");
tbody.AppendLine($"<td>{item.pumamt}</td>");
tbody.AppendLine($"<td>{item.supply}</td>");
if (item.project != null && item.project.Length > 10) tbody.AppendLine($"<td>{item.project.Substring(0, 10)}...</td>");
else tbody.AppendLine($"<td>{item.project}</td>");
if (item.bigo.Length > 10) tbody.AppendLine($"<td>{item.bigo.Substring(0, 10)}...</td>");
else tbody.AppendLine($"<td>{item.bigo}</td>");
tbody.AppendLine("</tr>");
}
//}
//아잍쳄이 없는경우
if (itemcnt == 0)
{
tbody.AppendLine("<tr>");
tbody.AppendLine("<th scope='row'>1</th>");
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
tbody.AppendLine("</tr>");
}
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;
}
}
}

View File

@@ -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
};
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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 = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
}
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<TodoModel>(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<TodoModel>(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<int>(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<TodoModel>(
"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<TodoModel>(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")
};
}
}
}

View File

@@ -16,7 +16,44 @@ namespace Project.OWIN
{
public void Configuration(IAppBuilder app)
{
// Configure Web API for Self-Host
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
// 정적 파일 서빙을 가장 먼저 설정 (다른 모든 미들웨어보다 우선)
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);
// 캐시 방지 미들웨어 (정적 파일이 처리되지 않은 경우에만 적용)
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"))
{
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";
}
await next();
});
// Configure Web API for Self-Host (정적 파일 후에 설정)
HttpConfiguration config = new HttpConfiguration();
//라우팅 설정
@@ -41,31 +78,8 @@ namespace Project.OWIN
// 파일 업로드 설정
config.Formatters.Remove(config.Formatters.XmlFormatter);
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
app.UseWebApi(config);
// 캐시 방지 미들웨어 추가 (정적 파일 서빙 전에 적용)
app.Use(async (context, next) =>
{
if (context.Request.Path.Value.EndsWith(".js") || context.Request.Path.Value.EndsWith(".css"))
{
context.Response.Headers["Cache-Control"] = "no-cache, no-store, must-revalidate";
context.Response.Headers["Pragma"] = "no-cache";
context.Response.Headers["Expires"] = "0";
}
await next();
});
// 정적 파일 서빙 설정
var options = new FileServerOptions
{
EnableDefaultFiles = true,
DefaultFilesOptions = { DefaultFileNames = { "index.html" } },
FileSystem = new Microsoft.Owin.FileSystems.PhysicalFileSystem("Web/wwwroot")
};
app.UseFileServer(options);
//appBuilder.UseFileServer(new FileServerOptions
//{
// RequestPath = new PathString(string.Empty),

View File

@@ -298,12 +298,11 @@
</div>
</div>
<!-- 공통 네비게이션 JS -->
<script src="/js/common-navigation.js"></script>
<script>
// 공통 네비게이션 컴포넌
class CommonNavigation {
constructor(currentPage = '') {
this.currentPage = currentPage;
this.menuItems = [];
// 공용코드 전용 스크립
this.init();
}

View File

@@ -675,158 +675,11 @@
</div>
</div>
<!-- 공통 네비게이션 JS -->
<script src="/js/common-navigation.js"></script>
<script>
// 공통 네비게이션 컴포넌
class CommonNavigation {
constructor(currentPage = '') {
this.currentPage = currentPage;
this.menuItems = [];
this.init();
}
async init() {
try {
await this.loadMenuItems();
this.createNavigation();
this.addEventListeners();
} catch (error) {
console.error('Navigation initialization failed:', error);
this.createFallbackNavigation();
}
}
async loadMenuItems() {
try {
const response = await fetch('/Common/GetNavigationMenu');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
if (data.Success && data.Data) {
this.menuItems = data.Data;
} else {
throw new Error(data.Message || 'Failed to load menu items');
}
} catch (error) {
console.error('Failed to load navigation menu:', error);
this.menuItems = this.getDefaultMenuItems();
}
}
getDefaultMenuItems() {
return [
{ 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 },
{ 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 },
{ 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 },
{ key: 'kuntae', title: '근태관리', url: '/Kuntae/', icon: 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z', isVisible: true, sortOrder: 4 },
{ 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 },
{ 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 },
];
}
createFallbackNavigation() {
this.createNavigation();
}
createNavigation() {
const nav = document.createElement('nav');
nav.className = 'glass-effect border-b border-white/10';
nav.innerHTML = this.getNavigationHTML();
// body의 첫 번째 자식으로 추가
document.body.insertBefore(nav, document.body.firstChild);
}
getNavigationHTML() {
const visibleItems = this.menuItems.filter(item => item.isVisible).sort((a, b) => a.sortOrder - b.sortOrder);
return `
<div class="container mx-auto px-4">
<div class="flex items-center justify-between h-16">
<div class="flex items-center space-x-8">
<div class="flex items-center space-x-2">
<svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="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"></path>
</svg>
<span class="text-xl font-bold text-white">GroupWare</span>
</div>
<nav class="hidden md:flex space-x-1">
${visibleItems.map(item => `
<a href="${item.url}" class="px-3 py-2 rounded-md text-sm font-medium transition-colors ${
this.currentPage === item.key
? 'bg-white/20 text-white'
: 'text-white/60 hover:text-white hover:bg-white/10'
}">
<svg class="w-4 h-4 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${item.icon}"></path>
</svg>
${item.title}
</a>
`).join('')}
</nav>
</div>
<div class="flex items-center space-x-4">
<div class="text-sm text-white/60">
<span id="currentUser">사용자</span>
</div>
</div>
</div>
</div>
`;
}
getMenuItemHTML(item) {
const isActive = this.currentPage === item.key;
const activeClass = isActive ? 'text-white bg-white/20' : 'text-white/80 hover:text-white hover:bg-white/10';
return `
<a href="${item.url}" class="${activeClass} transition-colors px-3 py-2 rounded-lg">
<svg class="w-4 h-4 inline mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${item.icon}"></path>
</svg>
${item.title}
</a>
`;
}
getMobileMenuItemHTML(item) {
const isActive = this.currentPage === item.key;
const activeClass = isActive ? 'text-white bg-white/20' : 'text-white/80 hover:text-white hover:bg-white/10';
return `
<a href="${item.url}" class="block ${activeClass} transition-colors px-3 py-2 rounded-lg mb-2">
<svg class="w-4 h-4 inline mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${item.icon}"></path>
</svg>
${item.title}
</a>
`;
}
addEventListeners() {
// 모바일 메뉴 토글
const mobileMenuButton = document.getElementById('mobile-menu-button');
const mobileMenu = document.getElementById('mobile-menu');
if (mobileMenuButton && mobileMenu) {
mobileMenuButton.addEventListener('click', function() {
mobileMenu.classList.toggle('hidden');
});
}
}
}
// 전역 함수로 내비게이션 초기화
function initNavigation(currentPage = '') {
// DOM이 로드된 후에 실행
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
new CommonNavigation(currentPage);
});
} else {
new CommonNavigation(currentPage);
}
}
// 대시보드 전용 스크립
// 휴가 인원 Ajax 업데이트
function updateLeaveCount() {

View File

@@ -39,6 +39,10 @@ class CommonNavigation {
${this.getMenuItemHTML('common', '/Common', '공용코드', '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')}
${this.getMenuItemHTML('jobreport', '/Jobreport/', '업무일지', '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')}
${this.getMenuItemHTML('kuntae', '/Kuntae/', '근태관리', 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z')}
${this.getMenuItemHTML('todo', '/Todo/', '할일관리', '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')}
${this.getMenuItemHTML('project', '/Project/', '프로젝트', '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')}
${this.getMenuItemHTML('purchase', '/Purchase/', '구매관리', 'M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z')}
${this.getMenuItemHTML('customer', '/Customer/', '고객관리', 'M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z')}
</div>
<!-- 모바일 메뉴 버튼 -->
@@ -57,6 +61,10 @@ class CommonNavigation {
${this.getMobileMenuItemHTML('common', '/Common', '공용코드', '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')}
${this.getMobileMenuItemHTML('jobreport', '/Jobreport/', '업무일지', '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')}
${this.getMobileMenuItemHTML('kuntae', '/Kuntae/', '근태관리', 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z')}
${this.getMobileMenuItemHTML('todo', '/Todo/', '할일관리', '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')}
${this.getMobileMenuItemHTML('project', '/Project/', '프로젝트', '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')}
${this.getMobileMenuItemHTML('purchase', '/Purchase/', '구매관리', 'M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z')}
${this.getMobileMenuItemHTML('customer', '/Customer/', '고객관리', 'M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z')}
</div>
</div>
`;

View File

@@ -121,7 +121,7 @@ namespace Project._Common
{
FCOMMON.Util.MsgE("견적서 폴더 업데이트 실패");
}
else Pub.log.AddI("견적서폴더 업뎅트 : " + tbKJPath.Text);
else FCOMMON.Pub.log.AddI("견적서폴더 업뎅트 : " + tbKJPath.Text);
}
}

158
Project/_add_to_project.py Normal file
View File

@@ -0,0 +1,158 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
C# 프로젝트 파일 자동 업데이트 도구
새로운 파일을 EETGW.csproj에 자동으로 등록합니다.
"""
import re
import os
import sys
from typing import List, Tuple, Optional
class ProjectFileUpdater:
def __init__(self, project_path: str = "EETGW.csproj"):
self.project_path = project_path
self.content = ""
self.load_project()
def load_project(self) -> bool:
"""프로젝트 파일 로드"""
try:
with open(self.project_path, 'r', encoding='utf-8') as f:
self.content = f.read()
return True
except Exception as e:
print(f"❌ 프로젝트 파일을 읽을 수 없습니다: {e}")
return False
def save_project(self) -> bool:
"""프로젝트 파일 저장"""
try:
with open(self.project_path, 'w', encoding='utf-8') as f:
f.write(self.content)
print("✅ 프로젝트 파일이 업데이트되었습니다.")
return True
except Exception as e:
print(f"❌ 프로젝트 파일 저장 실패: {e}")
return False
def is_file_registered(self, file_path: str) -> bool:
"""파일이 이미 등록되어 있는지 확인"""
# Windows 스타일 경로로 변환
windows_path = file_path.replace('/', '\\')
unix_path = file_path.replace('\\', '/')
patterns = [
f'Include="{windows_path}"',
f"Include='{windows_path}'",
f'Include="{unix_path}"',
f"Include='{unix_path}'"
]
return any(pattern in self.content for pattern in patterns)
def find_last_wwwroot_entry(self) -> Optional[Tuple[int, int]]:
"""마지막 wwwroot 관련 항목의 위치 찾기"""
pattern = r'<(?:Content|None) Include="Web\\wwwroot.*?</(?:Content|None)>'
matches = list(re.finditer(pattern, self.content, re.DOTALL))
if matches:
last_match = matches[-1]
return (last_match.start(), last_match.end())
return None
def add_file_to_project(self, file_path: str, file_type: str = "None") -> bool:
"""파일을 프로젝트에 추가"""
# Windows 스타일 경로로 변환
windows_path = file_path.replace('/', '\\')
# 이미 등록된 파일인지 확인
if self.is_file_registered(windows_path):
print(f"⚠️ 파일이 이미 등록되어 있습니다: {windows_path}")
return False
# 새로운 항목 생성
new_entry = f''' <{file_type} Include="{windows_path}">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</{file_type}>'''
# 마지막 wwwroot 항목 찾기
last_entry_pos = self.find_last_wwwroot_entry()
if last_entry_pos:
start_pos, end_pos = last_entry_pos
# 마지막 항목 다음에 새 항목 삽입
self.content = (
self.content[:end_pos] +
'\n' + new_entry +
self.content[end_pos:]
)
print(f"✅ 파일이 프로젝트에 추가되었습니다: {windows_path}")
return True
else:
print("❌ wwwroot 섹션을 찾을 수 없습니다.")
return False
def add_multiple_files(self, files: List[Tuple[str, str]]) -> int:
"""여러 파일을 한 번에 추가"""
added_count = 0
for file_path, file_type in files:
if self.add_file_to_project(file_path, file_type):
added_count += 1
return added_count
def add_react_component_files(component_name: str) -> bool:
"""React 컴포넌트 관련 파일들을 프로젝트에 추가"""
updater = ProjectFileUpdater()
files_to_add = [
(f"Web\\wwwroot\\react\\{component_name}.jsx", "None"),
(f"Web\\wwwroot\\react-{component_name.lower()}.html", "None")
]
added_count = updater.add_multiple_files(files_to_add)
if added_count > 0:
updater.save_project()
print(f"🎉 {component_name} 컴포넌트 관련 {added_count}개 파일이 등록되었습니다!")
return True
else:
print("추가된 파일이 없습니다.")
return False
def add_single_file(file_path: str, file_type: str = "None") -> bool:
"""단일 파일을 프로젝트에 추가"""
updater = ProjectFileUpdater()
if updater.add_file_to_project(file_path, file_type):
updater.save_project()
return True
return False
def main():
"""CLI 메인 함수"""
if len(sys.argv) < 2:
print("사용법:")
print(" python _add_to_project.py <파일경로> [파일타입]")
print(" python _add_to_project.py --react <컴포넌트명>")
print("")
print("예시:")
print(" python _add_to_project.py 'Web\\wwwroot\\react\\MyComponent.jsx'")
print(" python _add_to_project.py --react Dashboard")
sys.exit(1)
if sys.argv[1] == "--react" and len(sys.argv) >= 3:
component_name = sys.argv[2]
add_react_component_files(component_name)
else:
file_path = sys.argv[1]
file_type = sys.argv[2] if len(sys.argv) > 2 else "None"
add_single_file(file_path, file_type)
if __name__ == "__main__":
main()

177
Project/_project_updater.js Normal file
View File

@@ -0,0 +1,177 @@
// C# 프로젝트 파일 자동 업데이트 헬퍼
// 새로운 파일을 생성할 때 EETGW.csproj에 자동으로 등록하는 스크립트
const fs = require('fs');
const path = require('path');
class ProjectUpdater {
constructor(projectPath = 'EETGW.csproj') {
this.projectPath = projectPath;
this.projectContent = '';
this.loadProject();
}
loadProject() {
try {
this.projectContent = fs.readFileSync(this.projectPath, 'utf8');
} catch (error) {
console.error('프로젝트 파일을 읽을 수 없습니다:', error.message);
}
}
/**
* 새로운 파일을 프로젝트에 등록
* @param {string} filePath - Web/wwwroot로 시작하는 상대 경로
* @param {string} fileType - 'Content' 또는 'None' (기본값: 'None')
*/
addFile(filePath, fileType = 'None') {
// 파일 경로를 백슬래시로 변경 (Windows 형식)
const windowsPath = filePath.replace(/\//g, '\\');
// 이미 등록된 파일인지 확인
if (this.isFileAlreadyRegistered(windowsPath)) {
console.log(`파일이 이미 등록되어 있습니다: ${windowsPath}`);
return false;
}
// 새로운 항목 생성
const newEntry = ` <${fileType} Include="${windowsPath}">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</${fileType}>`;
// 마지막 wwwroot 관련 항목 찾기
const lastWwwrootMatch = this.findLastWwwrootEntry();
if (lastWwwrootMatch) {
// 마지막 wwwroot 항목 다음에 삽입
const insertPosition = lastWwwrootMatch.index + lastWwwrootMatch[0].length;
this.projectContent =
this.projectContent.slice(0, insertPosition) +
'\n' + newEntry +
this.projectContent.slice(insertPosition);
return true;
}
console.error('wwwroot 섹션을 찾을 수 없습니다.');
return false;
}
/**
* 파일이 이미 등록되어 있는지 확인
*/
isFileAlreadyRegistered(filePath) {
const patterns = [
`Include="${filePath}"`,
`Include='${filePath}'`,
filePath.replace(/\\/g, '/') // 슬래시 형태도 확인
];
return patterns.some(pattern => this.projectContent.includes(pattern));
}
/**
* 마지막 wwwroot 관련 항목 찾기
*/
findLastWwwrootEntry() {
const wwwrootPattern = /<(?:Content|None) Include="Web\\wwwroot.*?<\/(?:Content|None)>/gs;
let lastMatch = null;
let match;
while ((match = wwwrootPattern.exec(this.projectContent)) !== null) {
lastMatch = match;
}
return lastMatch;
}
/**
* 프로젝트 파일 저장
*/
saveProject() {
try {
fs.writeFileSync(this.projectPath, this.projectContent, 'utf8');
console.log('프로젝트 파일이 업데이트되었습니다.');
return true;
} catch (error) {
console.error('프로젝트 파일 저장 실패:', error.message);
return false;
}
}
/**
* 여러 파일을 한 번에 등록
*/
addFiles(files) {
let hasChanges = false;
files.forEach(({ path, type = 'None' }) => {
if (this.addFile(path, type)) {
hasChanges = true;
console.log(`추가됨: ${path}`);
}
});
return hasChanges;
}
/**
* React 관련 파일들 자동 등록
*/
addReactFiles(basePath) {
const reactFiles = [
{ path: `${basePath}.html`, type: 'None' },
{ path: `${basePath}.jsx`, type: 'None' }
];
return this.addFiles(reactFiles);
}
}
// 사용 예시
function addNewReactComponent(componentName) {
const updater = new ProjectUpdater();
const basePath = `Web\\wwwroot\\react\\${componentName}`;
const files = [
{ path: `${basePath}.jsx`, type: 'None' },
{ path: `Web\\wwwroot\\react-${componentName.toLowerCase()}.html`, type: 'None' }
];
if (updater.addFiles(files)) {
updater.saveProject();
console.log(`${componentName} 컴포넌트 파일들이 프로젝트에 등록되었습니다.`);
}
}
// 일반 파일 추가
function addNewFile(filePath, fileType = 'None') {
const updater = new ProjectUpdater();
if (updater.addFile(filePath, fileType)) {
updater.saveProject();
console.log(`✅ 파일이 프로젝트에 등록되었습니다: ${filePath}`);
}
}
module.exports = {
ProjectUpdater,
addNewReactComponent,
addNewFile
};
// CLI에서 직접 실행할 수 있도록
if (require.main === module) {
const args = process.argv.slice(2);
if (args.length === 0) {
console.log('사용법: node _project_updater.js <파일경로> [파일타입]');
console.log('예시: node _project_updater.js "Web\\wwwroot\\react\\NewComponent.jsx" None');
process.exit(1);
}
const filePath = args[0];
const fileType = args[1] || 'None';
addNewFile(filePath, fileType);
}

View File

@@ -15,7 +15,7 @@ namespace Project
public fLog()
{
InitializeComponent();
Pub.log.RaiseMsg += Log_RaiseMsg;
FCOMMON.Pub.log.RaiseMsg += Log_RaiseMsg;
this.FormClosed += FLog_FormClosed;
this.KeyDown += (s1, e1) => {
if (e1.KeyCode == Keys.Escape) this.Close();
@@ -24,7 +24,7 @@ namespace Project
private void FLog_FormClosed(object sender, FormClosedEventArgs e)
{
Pub.log.RaiseMsg -= Log_RaiseMsg;
FCOMMON.Pub.log.RaiseMsg -= Log_RaiseMsg;
}
@@ -41,7 +41,7 @@ namespace Project
private void button1_Click(object sender, EventArgs e)
{
this.logTextBox1.LoadFile(Pub.log.FileName, RichTextBoxStreamType.PlainText);
this.logTextBox1.LoadFile(FCOMMON.Pub.log.FileName, RichTextBoxStreamType.PlainText);
this.logTextBox1.ForeColor = Color.White;
}
}

View File

@@ -74,6 +74,7 @@ namespace Project
// }
//}
//catch { }
FCOMMON.Pub.FlushLog();
}
bool closeforce = false;
@@ -92,8 +93,8 @@ namespace Project
}
}
Pub.log.Add("Program Close");
Pub.log.Flush();
FCOMMON.Pub.log.Add("Program Close");
FCOMMON.Pub.log.Flush();
}
@@ -126,14 +127,14 @@ namespace Project
var options = new StartOptions(Pub.setting.WebServiceURL);
webApp = WebApp.Start<OWIN.Startup>(options);
Console.WriteLine("start webapp");
Pub.log.AddI("웹지원 서버 준비 완료");
FCOMMON.Pub.log.AddI("웹지원 서버 준비 완료");
webok = true;
}
catch (Exception ex)
{
//Util.MsgE("Web Interface Error\r\n" + ex.Message)/;
Console.WriteLine(ex.Message);
Pub.log.AddE("웹지원오류" + ex.Message);
FCOMMON.Pub.log.AddE("웹지원오류" + ex.Message);
webok = false;
}
@@ -237,7 +238,7 @@ namespace Project
FCOMMON.info.Login.tel,
FCOMMON.info.Login.dept,
FCOMMON.info.Login.gcode);
Pub.log.Add("Program Start");
FCOMMON.Pub.log.Add("Program Start");
sbLoginUseTime.Text = "접속시간:" + FCOMMON.info.Login.loginusetime.ToString("N1") + "ms";
@@ -285,7 +286,7 @@ namespace Project
return;
}
#endregion
Pub.log.Add("BCD", "Rx:" + e.StrValue);
FCOMMON.Pub.log.Add("BCD", "Rx:" + e.StrValue);
}
void Menu_Log()
@@ -303,8 +304,8 @@ namespace Project
FCOMMON.info.camIndex = Pub.setting.CamIndex;
FCOMMON.info.Disable_8hourover = Pub.setting.Disable8HourOver;
Pub.setting.Save();
Pub.log.AddI("Setting Save");
Pub.log.Add(Pub.setting.ToString());
FCOMMON.Pub.log.AddI("Setting Save");
FCOMMON.Pub.log.Add(Pub.setting.ToString());
UpdateControls();
setToolbar();
}

View File

@@ -281,13 +281,13 @@ namespace Project.Dialog
MessageBox.Show(warningMessage, "포트 충돌 경고", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}));
Pub.log.Add($"포트 7979가 이미 사용 중입니다. 웹서버 시작에 문제가 발생할 수 있습니다.");
FCOMMON.Pub.log.Add($"포트 7979가 이미 사용 중입니다. 웹서버 시작에 문제가 발생할 수 있습니다.");
}
}
catch (Exception ex)
{
// 포트 체크 중 오류가 발생해도 프로그램 실행은 계속
Pub.log.AddE($"포트 7979 체크 중 오류 발생: {ex.Message}");
FCOMMON.Pub.log.AddE($"포트 7979 체크 중 오류 발생: {ex.Message}");
Console.WriteLine($"Port check error: {ex.Message}");
}
}

Binary file not shown.

View File

@@ -33,6 +33,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ChilkatDotNet46">
<HintPath>.\ChilkatDotNet46.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceProcess" />

View File

@@ -12307,8 +12307,9 @@ WHERE (enable = 1) AND (ISNULL(fromlist, '') <> '') AND (ISNULL(tolist, '') <>
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT *\r\nFROM vMailingProjectSchedule\r\nWHERE (gcode = @gcode)\r\nORDER BY pd" +
"ate, idx, seq";
this._commandCollection[0].CommandText = "SELECT gcode, status, idx, pdate, name, userManager, seq, title, sw, ew, swa, pr" +
"ogress, ewa, ww, memo, sidx\r\nFROM vMailingProjectSchedule\r\nWHERE (gcode = @" +
"gcode) AND (pdate >= \'2024-01-01\')\r\nORDER BY pdate, idx, seq";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@gcode", global::System.Data.SqlDbType.VarChar, 10, global::System.Data.ParameterDirection.Input, 0, 0, "gcode", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}

View File

@@ -473,10 +473,10 @@ WHERE (enable = 1) AND (ISNULL(fromlist, '') &lt;&gt; '') AND (ISNULL(tolist, '
<MainSource>
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="EE.dbo.vMailingProjectSchedule" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT *
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT gcode, status, idx, pdate, name, userManager, seq, title, sw, ew, swa, progress, ewa, ww, memo, sidx
FROM vMailingProjectSchedule
WHERE (gcode = @gcode)
WHERE (gcode = @gcode) AND (pdate &gt;= '2024-01-01')
ORDER BY pdate, idx, seq</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="gcode" ColumnName="gcode" DataSourceName="EE.dbo.vMailingProjectSchedule" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@gcode" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="gcode" SourceColumnNullMapping="false" SourceVersion="Current" />

View File

@@ -7,13 +7,13 @@
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<Shapes>
<Shape ID="DesignTable:MailForm" ZOrder="5" X="24" Y="30" Height="305" Width="191" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:MailData" ZOrder="1" X="262" Y="96" Height="362" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:MailData" ZOrder="2" X="262" Y="96" Height="362" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:MailAuto" ZOrder="6" X="514" Y="130" Height="324" Width="225" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:vMailingProjectSchedule" ZOrder="4" X="95" Y="183" Height="305" Width="289" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:vMailingProjectSchedule" ZOrder="1" X="95" Y="183" Height="305" Width="289" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:ProjectsIngList" ZOrder="11" X="372" Y="176" Height="305" Width="191" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="237" />
<Shape ID="DesignTable:EETGW_ProjectsSchedule" ZOrder="2" X="643" Y="413" Height="96" Width="291" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="46" />
<Shape ID="DesignTable:EETGW_ProjectsSchedule" ZOrder="3" X="643" Y="413" Height="96" Width="291" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="46" />
<Shape ID="DesignTable:vJobReportForUser" ZOrder="8" X="815" Y="102" Height="229" Width="257" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
<Shape ID="DesignTable:JobReport" ZOrder="3" X="622" Y="57" Height="400" Width="318" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="332" />
<Shape ID="DesignTable:JobReport" ZOrder="4" X="622" Y="57" Height="400" Width="318" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="332" />
<Shape ID="DesignTable:HolidayLIst" ZOrder="10" X="813" Y="358" Height="191" Width="210" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
<Shape ID="DesignTable:vGroupUser" ZOrder="9" X="783" Y="300" Height="324" Width="230" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:JobReportDateList" ZOrder="7" X="89" Y="43" Height="96" Width="212" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="45" />

View File

@@ -65,9 +65,65 @@ namespace Console_SendMail
}
return list_to;
}
//static void Main(string[] args)
//{
// //var mc = new System.Net.Mail.SmtpClient("k5lexim01.kr.ds.amkor.com");
// //mc.Credentials = new System.Net.NetworkCredential("bookmanager", "BIDA19R=maga2#H9gY[JPx%~M^NyIG");
// //var msg = new System.Net.Mail.MailMessage("bookmanager@amkor.co.kr", "chikyun.kim@amkor.co.kr");
// //msg.Body = "test";
// //msg.Subject = "test mail";
// //try
// //{
// // mc.Send(msg);
// // Console.WriteLine( "ok");
// // Console.ReadLine();
// // Console.ReadKey();
// //}catch ( Exception ex)
// //{
// // Console.WriteLine( ex.Message);
// //}
// Chilkat.MailMan mailman = new Chilkat.MailMan();
// bool success = mailman.UnlockComponent("GAMACM.CB8082024_Tz2XiNck4U5N");
// if(success ==false ) Console.WriteLine("license errr" );
// mailman.SmtpHost = "k5lexim01.kr.ds.amkor.com";
// mailman.SmtpPort = 25;
// mailman.SmtpUsername = "bookmanager";
// mailman.SmtpPassword = "BIDA19R=maga2#H9gY[JPx%~M^NyIG";
// Chilkat.Email email = new Chilkat.Email();
// email.Subject = "test";
// email.SetHtmlBody("test");
// email.From = "bookmanager@amkor.co.kr";
// email.AddTo("chikyun", "chikyun.kim@amkor.co.kr");
// success = mailman.SendEmail(email);
// if (success != true)
// {
// Console.WriteLine("메일 발송 실패");
// }
// else Console.WriteLine( "ok");
// success = mailman.CloseSmtpConnection();
//}
static void Main(string[] args)
{
//var mc = new System.Net.Mail.SmtpClient("k5lexim01.kr.ds.amkor.com");
//mc.Credentials = new System.Net.NetworkCredential("bookmanager", "BIDA19R=maga2#H9gY[JPx%~M^NyIG");
//var msg = new System.Net.Mail.MailMessage("chikyun.kim@amkor.co.kr", "chikyun.kim@amkor.co.kr");
//msg.Body = "test";
//msg.Subject = "test mail";
//mc.Send(msg);
// 명령행 인수 처리
if (args.Length > 0)
{

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("25.08.05.1130")]
[assembly: AssemblyFileVersion("25.08.05.1130")]
[assembly: AssemblyVersion("25.10.22.1450")]
[assembly: AssemblyFileVersion("25.10.22.1450")]

View File

@@ -7,6 +7,7 @@ using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Net.Mail;
using System.Text;
namespace Console_SendMail
@@ -32,9 +33,9 @@ namespace Console_SendMail
var basedate = DateTime.Now;
var sd = basedate.AddDays(-15);
var ed = basedate.AddDays(-1);
var str_sd = sd.ToShortDateString();
var str_ed = ed.ToShortDateString();
var str_dt = basedate.ToShortDateString();
var str_sd = sd.ToString("yyyy-MM-dd");//ToShortDateString();
var str_ed = ed.ToString("yyyy-MM-dd");//ToShortDateString();
var str_dt = basedate.ToString("yyyy-MM-dd");
var gcodelist = DatabaseManager.getGroupListWithoutGcode("gcode", "MailForm", "gcode is not null and gcode <> 'DEV'");
@@ -111,7 +112,7 @@ namespace Console_SendMail
Dictionary<DateTime, double?> WarnList = new Dictionary<DateTime, double?>();
foreach (var dt in days.OrderBy(t => t))
{
var dtstr = dt.ToShortDateString();
var dtstr = dt.ToString("yyyy-MM-dd");
var userdata = UserDatas.Where(t => t.pdate == dtstr); //해당날짜의 데이터를 확인한다.
var hrs = 0f;
if (userdata.Any()) hrs = (float)userdata.Sum(t => t.hrs);
@@ -150,7 +151,7 @@ namespace Console_SendMail
mail_content += "<br/><table border='1' cellspacing='1' cellpadding='1'><tr><td>날짜</td><td>요일</td><td>시간</td></tr>";
foreach (var warnitem in WarnList)
{
mail_content += $"<tr><td>{warnitem.Key.ToShortDateString()}</td><td>{warnitem.Key.DayOfWeek.ToString()}</td><td>{warnitem.Value:N1}</td></tr>";
mail_content += $"<tr><td>{warnitem.Key.ToString("yyyy-MM-dd")}</td><td>{warnitem.Key.DayOfWeek.ToString()}</td><td>{warnitem.Value:N1}</td></tr>";
}
mail_content += "</table>";
@@ -173,7 +174,7 @@ namespace Console_SendMail
newdr.tolist = MailSort(mail_to, MailForm.exceptmail);
newdr.bcc = mail_bcc;
newdr.cc = MailSort(mail_cc, MailForm.exceptmailcc);
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");//ToShortDateString();
newdr.body = mail_body.Replace("{내용}", mail_content);
newdr.wuid = "dev";
newdr.wdate = DateTime.Now;
@@ -210,7 +211,7 @@ namespace Console_SendMail
newdr.tolist = "chikyun.kim@amkor.co.kr";
newdr.bcc = string.Empty;
newdr.cc = string.Empty;
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");//ToShortDateString();
newdr.body = string.Join("<br/>", NoMailList.ToList());
newdr.wuid = "dev";
newdr.wdate = DateTime.Now;
@@ -257,9 +258,9 @@ namespace Console_SendMail
//기준일자는 오늘부터 -15일이다
var sd = DateTime.Now.AddDays(-15);
var ed = DateTime.Now.AddDays(-1);
var str_sd = sd.ToShortDateString();
var str_ed = ed.ToShortDateString();
var str_dt = DateTime.Now.ToShortDateString();
var str_sd = sd.ToString("yyyy-MM-dd");
var str_ed = ed.ToString("yyyy-MM-dd");//ToShortDateString();
var str_dt = DateTime.Now.ToString("yyyy-MM-dd");//ToShortDateString();
var gcodelist = DatabaseManager.getGroupListWithoutGcode("gcode", "MailForm", "gcode is not null and gcode <> 'DEV'");
foreach (var vGcode in gcodelist)
@@ -332,7 +333,7 @@ namespace Console_SendMail
Dictionary<DateTime, double?> WarnList = new Dictionary<DateTime, double?>();
foreach (var dt in days.OrderBy(t => t))
{
var dtstr = dt.ToShortDateString();
var dtstr = dt.ToString("yyyy-MM-dd");
var userdata = UserDatas.Where(t => t.pdate == dtstr); //해당날짜의 데이터를 확인한다.
var hrs = 0f;
if (userdata.Any()) hrs = (float)userdata.Sum(t => t.hrs);
@@ -365,7 +366,7 @@ namespace Console_SendMail
//메일본문을 생성해서 진행해야함
var vmail_body = "<p>담당자별 정보</p>";
vmail_body += "<br/>조회기간 : " + sd.ToShortDateString() + "~" + ed.ToShortDateString();
vmail_body += "<br/>조회기간 : " + sd.ToString("yyyy-MM-dd") + "~" + ed.ToString("yyyy-MM-dd");
////참고데이터를 추가한다
var usergrplist = totWarnList.OrderBy(t => t.uname).GroupBy(t => t.uid).ToList();
@@ -403,7 +404,7 @@ namespace Console_SendMail
newdr.tolist = mail_to;
newdr.bcc = mail_bcc;
newdr.cc = MailSort(mail_cc, MailForm.exceptmailcc);
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");
newdr.body = mail_body.Replace("{내용}", vmail_body);
newdr.wuid = "dev";
newdr.wdate = DateTime.Now;
@@ -447,9 +448,9 @@ namespace Console_SendMail
//기준일자는 오늘부터 -15일이다
var sd = DateTime.Now.AddDays(-15);
var ed = DateTime.Now;
var str_sd = sd.ToShortDateString();
var str_ed = ed.ToShortDateString();
var str_dt = DateTime.Now.ToShortDateString();
var str_sd = sd.ToString("yyyy-MM-dd");
var str_ed = ed.ToString("yyyy-MM-dd");//ToShortDateString();
var str_dt = DateTime.Now.ToString("yyyy-MM-dd");//ToShortDateString();
var gcodelist = DatabaseManager.getGroupListWithoutGcode("gcode", "MailForm", "gcode is not null and gcode <> 'DEV'");
foreach (var vGcode in gcodelist)
@@ -544,7 +545,7 @@ namespace Console_SendMail
newdr.tolist = mail_to;// MailSort(mail_to, MailForm.exceptmail);
newdr.bcc = mail_bcc;
newdr.cc = MailSort(mail_cc, MailForm.exceptmailcc);
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");
newdr.body = mail_content;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;
@@ -576,7 +577,7 @@ namespace Console_SendMail
newdr.tolist = "chikyun.kim@amkor.co.kr";
newdr.bcc = string.Empty;
newdr.cc = string.Empty;
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");
newdr.body = ex.Message;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;
@@ -613,9 +614,9 @@ namespace Console_SendMail
{
var sd = DateTime.Now.AddDays(-15);
var ed = DateTime.Now;
var str_sd = sd.ToShortDateString();
var str_ed = ed.ToShortDateString();
var str_dt = DateTime.Now.ToShortDateString();
var str_sd = sd.ToString("yyyy-MM-dd");
var str_ed = ed.ToString("yyyy-MM-dd");
var str_dt = DateTime.Now.ToString("yyyy-MM-dd");
var gcodelist = DatabaseManager.getGroupListWithoutGcode("gcode", "MailForm", "gcode is not null and gcode <> 'DEV'");
foreach (var vGcode in gcodelist)
@@ -727,7 +728,7 @@ namespace Console_SendMail
newdr.tolist = mail_to;// MailSort(mail_to, MailJD.exceptmail);
newdr.bcc = mail_bcc;
newdr.cc = MailSort(mail_cc, MailForm.exceptmailcc);
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");
newdr.body = mail_content;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;
@@ -759,7 +760,7 @@ namespace Console_SendMail
newdr.tolist = "chikyun.kim@amkor.co.kr";
newdr.bcc = string.Empty;
newdr.cc = string.Empty;
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");
newdr.body = ex.Message;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;
@@ -802,9 +803,9 @@ namespace Console_SendMail
//기준일자는 오늘부터 -15일이다
var sd = DateTime.Now.AddDays(-15);
var ed = DateTime.Now;
var str_sd = sd.ToShortDateString();
var str_ed = ed.ToShortDateString();
var str_dt = DateTime.Now.ToShortDateString();
var str_sd = sd.ToString("yyyy-MM-dd");
var str_ed = ed.ToString("yyyy-MM-dd");
var str_dt = DateTime.Now.ToString("yyyy-MM-dd");
//var gcodelist = db.MailForm.GroupBy(t => t.gcode).ToList();
@@ -913,7 +914,7 @@ namespace Console_SendMail
newdr.tolist = mail_to;// MailSort(mail_to, MailJD.exceptmail);
newdr.bcc = mail_bcc;
newdr.cc = MailSort(mail_cc, MailJD.exceptmailcc);
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");
newdr.body = mail_content;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;
@@ -946,7 +947,7 @@ namespace Console_SendMail
newdr.tolist = "chikyun.kim@amkor.co.kr";
newdr.bcc = string.Empty;
newdr.cc = string.Empty;
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");
newdr.body = ex.Message;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;
@@ -991,20 +992,20 @@ namespace Console_SendMail
var gcodelist = DatabaseManager.getGroupListWithoutGcode("gcode", "MailForm", "gcode is not null and gcode <> 'DEV'");
//var db = new EEEntities();
//기준일자는 오늘부터 -15일이다
//var sd = DateTime.Now.AddDays(-15);
//var ed = DateTime.Now;
//var str_sd = sd.ToShortDateString();
//var str_ed = ed.ToShortDateString();
var str_dt = DateTime.Now.ToShortDateString();
var str_dt = DateTime.Now.ToString("yyyy-MM-dd");
var sql = "select (select isnull(max(pdate),'') from ProjectsHistory where pidx = Projects.idx) as LastHistory," +
" idx,status,name,sdate,ddate,orderno as CR,crdue,dbo.getUserName(isnull(championid,usermanager)) as NameChampion," +
" dbo.getUserName(isnull(designid,usermain)) as NameDesign,dbo.getUserName(isnull(epanelid,userhw2)) as NameEPanel," +
" dbo.getUserName(isnull(softwareid,usersub)) as NameSoftware,championid as IdChampion,designid as IdDesign," +
" epanelid as IdEPanel,softwareid as IdSoftware " +
" from Projects where gcode = @gcode and status = '진행'" +
$" and pdate >= '{DateTime.Now.AddYears(-3).ToShortDateString()}'";
$" and pdate >= '{DateTime.Now.AddYears(-2).ToString("yyyy-MM-dd")}'";
var cs = Properties.Settings.Default.cs;
var cn = new System.Data.SqlClient.SqlConnection(cs);
var cmd = new SqlCommand(sql, cn);
@@ -1144,7 +1145,7 @@ namespace Console_SendMail
newdr.tolist = mail_to;// MailSort(mail_to, MailJD.exceptmail);
newdr.bcc = mail_bcc;
newdr.cc = MailSort(mail_cc, MailJD.exceptmailcc);
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");
newdr.body = mail_content;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;
@@ -1181,7 +1182,7 @@ namespace Console_SendMail
newdr.tolist = "chikyun.kim@amkor.co.kr";
newdr.bcc = string.Empty;
newdr.cc = string.Empty;
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");//.ToShortDateString();
newdr.body = ex.Message;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;
@@ -1235,6 +1236,7 @@ namespace Console_SendMail
var body = string.Empty;//getdbdata(dar["body"]).Trim();
var idx = -1;
var pdate = string.Empty;
var developer = string.Empty;
@@ -1249,6 +1251,7 @@ namespace Console_SendMail
subject = getdbdata(dar["subject"]).Trim();
body = getdbdata(dar["body"]).Trim();
idx = (int)dar["idx"];
developer = getdbdata(dar["developer"]);
}
dar.Close();
@@ -1306,26 +1309,98 @@ namespace Console_SendMail
else
{
//var body = getdbdata(dar["body"]);
if (String.IsNullOrEmpty(developer)) developer = "chikyun.kim@amkor.co.kr";
body +=
"<p>" +
"<br />이 메일은 EET 프로그램에서 자동 발신 되었습니다." +
"<br />메일이 잘못 전송 되었다면 [<a href='chikyun.kim@amkor.co.kr'>chikyun.kim@amkor.co.kr</a>] 로 문의 주시기 바랍니다" +
"</p>";
$"<p>" +
$"<br />이 메일은 EET 프로그램에서 자동 발신 되었습니다." +
$"<br />메일이 잘못 전송 되었다면 [<a href='{developer}'>{developer}</a>] 로 문의 주시기 바랍니다" +
$"</p>";
subject = subject.Replace("\r", "").Replace("\n", "");
body = body.Replace("\r", "").Replace("\n", "");
//전송을 해야 함
var mc = new System.Net.Mail.SmtpClient("10.101.5.150");
var msg = new System.Net.Mail.MailMessage
(list_from,
list_to,
subject,
body);
var tolist = list_to.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var bcclist = list_bcc.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var cclist = list_cc.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
var externalmail = false;
foreach (var item in tolist)
if (item.ToLower().EndsWith("amkor.co.kr") == false)
{
externalmail = true;
break;
}
foreach (var item in bcclist)
if (item.ToLower().EndsWith("amkor.co.kr") == false)
{
externalmail = true;
break;
}
foreach (var item in cclist)
if (item.ToLower().EndsWith("amkor.co.kr") == false)
{
externalmail = true;
break;
}
// ATK Exim 접속 정보
//ATK Exim Domain: k5lexim01.kr.ds.amkor.com
//ATK Exim IP : 10.101.2.70
//ATK Exim Port: 25, 465, 587
var sendsuccess = false;
//"10.101.5.150"
//전송을 해야 함vvmffh123123
Chilkat.MailMan mailman = null;
Chilkat.Email email = null;
SmtpClient mc = null;
MailMessage msg = null;
if (externalmail)
{
mailman = new Chilkat.MailMan();
bool success = mailman.UnlockComponent("GAMACM.CB8082024_Tz2XiNck4U5N");
if (success == false) Console.WriteLine("license errr");
mailman.SmtpHost = "k5lexim01.kr.ds.amkor.com";
mailman.SmtpPort = 25;
mailman.SmtpUsername = "bookmanager";
mailman.SmtpPassword = "BIDA19R=maga2#H9gY[JPx%~M^NyIG";
email = new Chilkat.Email();
email.Subject = subject;
email.SetHtmlBody(body);
email.From = list_from;
foreach (var item in tolist)
email.AddTo(item, item);
//bcc
foreach (var item in bcclist)
email.AddBcc(item, item);
//cc
foreach (var item in cclist)
email.AddCC(item, item);
}
else
{
mc = new System.Net.Mail.SmtpClient("10.101.5.150");
msg = new System.Net.Mail.MailMessage
(list_from,
list_to,
subject,
body);
if (list_bcc != "") msg.Bcc.Add(list_bcc);
if (list_cc != "") msg.CC.Add(list_cc);
msg.IsBodyHtml = true;
}
//success = mailman.SendEmail(email);
if (list_bcc != "") msg.Bcc.Add(list_bcc);
if (list_cc != "") msg.CC.Add(list_cc);
msg.IsBodyHtml = true;
bool msgupdate = false;
try
@@ -1342,8 +1417,26 @@ namespace Console_SendMail
var ucnt = cmd.ExecuteNonQuery();
if (ucnt == 1)
{
mc.Send(msg);
Console.WriteLine($"[{timestr}]-IDX:{idx} [{pdate}] send mail to [" + list_to + "],subject=" + getdbdata(subject));
if (mailman != null)
{
sendsuccess = mailman.SendEmail(email);
}
else
{
try
{
mc.Send(msg);
sendsuccess = true;
}
catch (Exception ex)
{
sendMsg = ex.Message;
msgupdate = true;
sendsuccess = false;
}
}
if (sendsuccess == false) Console.WriteLine("send error");
else Console.WriteLine($"[{timestr}]-IDX:{idx} [{pdate}] send mail to [" + list_to + "],subject=" + getdbdata(subject));
}
}
catch (Exception eX)
@@ -1367,7 +1460,7 @@ namespace Console_SendMail
var ucnt = cmd.ExecuteNonQuery();
}
}
catch(Exception ex)
catch (Exception ex)
{
//sendMsg = eX.Message;
//msgupdate = true;
@@ -1514,9 +1607,9 @@ namespace Console_SendMail
//기준일자는 오늘부터 -15일이다
var sd = DateTime.Now.AddDays(-15);
var ed = DateTime.Now;
var str_sd = sd.ToShortDateString();
var str_ed = ed.ToShortDateString();
var str_dt = DateTime.Now.ToShortDateString();
var str_sd = sd.ToString("yyyy-MM-dd");//ToShortDateString();
var str_ed = ed.ToString("yyyy-MM-dd");//ToShortDateString();
var str_dt = DateTime.Now.ToString("yyyy-MM-dd");// ToShortDateString();
//var gcodelist = db.MailForm.GroupBy(t => t.gcode).ToList();
var cn = DatabaseManager.getCn();
@@ -1628,7 +1721,7 @@ namespace Console_SendMail
newdr.tolist = mail_to;// MailSort(mail_to, MailJD.exceptmail);
newdr.bcc = mail_bcc;
newdr.cc = MailSort(mail_cc, MailJD.exceptmailcc);
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");
newdr.body = mail_content;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;
@@ -1665,7 +1758,7 @@ namespace Console_SendMail
newdr.tolist = "chikyun.kim@amkor.co.kr";
newdr.bcc = string.Empty;
newdr.cc = string.Empty;
newdr.pdate = DateTime.Now.ToShortDateString();
newdr.pdate = DateTime.Now.ToString("yyyy-MM-dd");//ToShortDateString();
newdr.body = ex.Message;
newdr.wuid = "dev";// "dev";
newdr.wdate = DateTime.Now;

View File

@@ -11,408 +11,440 @@ using System.Windows.Forms;
namespace FBS0000.Holiday
{
public partial class fErrorChk : fBase
{
public fErrorChk()
{
InitializeComponent();
Properties.Settings.Default["gwcs"] = FCOMMON.info.CS;
public partial class fErrorChk : fBase
{
public fErrorChk()
{
InitializeComponent();
Properties.Settings.Default["gwcs"] = FCOMMON.info.CS;
//dtSD.KeyDown += dtSD_KeyDown;
//dtED.KeyDown += dtSD_KeyDown;
}
private void fErrorChk_Load(object sender, EventArgs e)
{
//기본 이번달 설정한다
EnsureVisibleAndUsableSize();
button2.PerformClick();
}
//dtSD.KeyDown += dtSD_KeyDown;
//dtED.KeyDown += dtSD_KeyDown;
tbDate.Text = DateTime.Now.ToShortDateString();
}
private void fErrorChk_Load(object sender, EventArgs e)
{
//기본 이번달 설정한다
EnsureVisibleAndUsableSize();
button2.PerformClick();
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
{
}
private void button1_Click(object sender, EventArgs e)
{
//검사버튼
this.lvNG.CheckBoxes = true;
var sd = DateTime.Parse(dtSD.Text);
var ed = DateTime.Parse(dtED.Text);
var idx = 0;
}
private void button1_Click(object sender, EventArgs e)
{
//검사버튼
this.lvNG.CheckBoxes = true;
var sd = DateTime.Parse(dtSD.Text);
var ed = DateTime.Parse(dtED.Text);
var idx = 0;
var gcode = FCOMMON.info.Login.gcode;
var id = FCOMMON.info.Login.no;
var gcode = FCOMMON.info.Login.gcode;
var id = FCOMMON.info.Login.no;
var cn = FCOMMON.DBM.getCn();
cn.Open();
var cmd = new System.Data.SqlClient.SqlCommand("", cn);
cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = gcode;
cmd.Parameters.Add("uid", SqlDbType.VarChar).Value = id;
var cn = FCOMMON.DBM.getCn();
cn.Open();
var cmd = new System.Data.SqlClient.SqlCommand("", cn);
cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = gcode;
cmd.Parameters.Add("uid", SqlDbType.VarChar).Value = id;
lvOK.Items.Clear();
lvOK.FullRowSelect = true;
lvOK.CheckBoxes = false;
lvOK.Items.Clear();
lvOK.FullRowSelect = true;
lvOK.CheckBoxes = false;
lvNG.Items.Clear();
lvNG.FullRowSelect = true;
lvNG.CheckBoxes = true;
lvNG.Items.Clear();
lvNG.FullRowSelect = true;
lvNG.CheckBoxes = true;
while (true)
{
var CD = sd.AddDays(idx++);
if (CD > ed) break;
var pdate = CD.ToShortDateString();
tbDate.Text = pdate;
Application.DoEvents();
while (true)
{
var CD = sd.AddDays(idx++);
if (CD > ed) break;
var pdate = CD.ToShortDateString();
tbDate.Text = pdate;
Application.DoEvents();
//이날짜의 업무일지 발생데이터를 확인
cmd.CommandText = "select sum(isnull(ot2,0)) from jobreport where gcode = @gcode and pdate='{0}' and isnull(ot,0) >0 and isnull(ot2,0) > 0";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
//이날짜의 업무일지 발생데이터를 확인
cmd.CommandText = "select sum(isnull(ot2,0)) from jobreport where gcode = @gcode and pdate='{0}' and isnull(ot,0) >0 and isnull(ot2,0) > 0";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
var obj_jobreport = cmd.ExecuteScalar().ToString();
double val_jobreport = 0.0;
if (string.IsNullOrEmpty(obj_jobreport) == false) val_jobreport = double.Parse(obj_jobreport);
textBox2.Tag = val_jobreport;// db_jobreport.Sum(t => t.kisulamt);
textBox2.Text = textBox2.Tag.ToString();
var obj_jobreport = cmd.ExecuteScalar().ToString();
double val_jobreport = 0.0;
if (string.IsNullOrEmpty(obj_jobreport) == false) val_jobreport = double.Parse(obj_jobreport);
textBox2.Tag = val_jobreport;// db_jobreport.Sum(t => t.kisulamt);
textBox2.Text = textBox2.Tag.ToString();
//휴가신청확인
cmd.CommandText = "select cate,sum(HolyDays),sum(HolyTimes) from EETGW_HolydayRequest where gcode = @gcode and sdate = '{0}' and isnull(conf,0) = 1 group by cate";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
var dar = cmd.ExecuteReader();
double val_day = 0;
double val_time = 0;
Dictionary<string, double> catelistd = new Dictionary<string, double>();
Dictionary<string, double> catelistt = new Dictionary<string, double>();
while (dar.Read())
{
var str_cate = dar[0].ToString();
var str_day = dar[1].ToString();
var str_time = dar[2].ToString();
//휴가신청확인
cmd.CommandText = "select cate,sum(HolyDays),sum(HolyTimes) from EETGW_HolydayRequest where gcode = @gcode and sdate = '{0}' and isnull(conf,0) = 1 group by cate";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
var dar = cmd.ExecuteReader();
double val_day = 0;
double val_time = 0;
Dictionary<string, double> catelistd = new Dictionary<string, double>();
Dictionary<string, double> catelistt = new Dictionary<string, double>();
while (dar.Read())
{
var str_cate = dar[0].ToString();
var str_day = dar[1].ToString();
var str_time = dar[2].ToString();
var v_day = 0.0;
var v_time = 0.0;
var v_day = 0.0;
var v_time = 0.0;
v_day += double.Parse(str_day);
v_time += double.Parse(str_time);
v_day += double.Parse(str_day);
v_time += double.Parse(str_time);
val_day += v_day;
val_time += v_time;
val_day += v_day;
val_time += v_time;
if (v_day != 0.0 && catelistd.ContainsKey(str_cate))
catelistd[str_cate] = catelistd[str_cate] + v_day;
else
catelistd.Add(str_cate, v_day);
if (v_time != 0.0 && catelistt.ContainsKey(str_cate))
catelistt[str_cate] = catelistt[str_cate] + v_time;
else
catelistt.Add(str_cate, v_time);
}
textBox3.Tag = val_day;// db_jobreport.Sum(t => t.kisulamt);
textBox3.Text = textBox3.Tag.ToString();
textBox4.Tag = val_time;// db_jobreport.Sum(t => t.kisulamt);
textBox4.Text = textBox4.Tag.ToString();
dar.Close();
if (v_day != 0.0 && catelistd.ContainsKey(str_cate))
catelistd[str_cate] = catelistd[str_cate] + v_day;
else if(v_day != 0.0)
catelistd.Add(str_cate, v_day);
//근태입력자료확인
cmd.CommandText = "select cate,sum(term) ,sum(crtime),sum(termdr),sum(drtime)" +
" from Holyday " +
" where gcode = @gcode and sdate = '{0}' and isnull(extidx,-1) <> -1" +
" group by cate";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
dar = cmd.ExecuteReader();
val_day = 0;
val_time = 0;
double val_day_dr = 0;
double val_time_dr = 0;
Dictionary<string, double> d_drd = new Dictionary<string, double>();
Dictionary<string, double> d_drt = new Dictionary<string, double>();
Dictionary<string, double> d_crd = new Dictionary<string, double>();
Dictionary<string, double> d_crt = new Dictionary<string, double>();
double v_crd, v_crt, v_drd, v_drt;
System.Text.StringBuilder sbcate = new StringBuilder();
while (dar.Read())
{
v_crd = v_crt = v_drd = v_drt = 0.0;
var str_cate = dar[0].ToString();
var str_day_cr = dar[1].ToString();
var str_time_cr = dar[2].ToString();
var str_day_dr = dar[3].ToString();
var str_time_dr = dar[4].ToString();
if (string.IsNullOrEmpty(str_day_cr) == false) v_crd = double.Parse(str_day_cr);
if (string.IsNullOrEmpty(str_time_cr) == false) v_crt = double.Parse(str_time_cr);
if (string.IsNullOrEmpty(str_day_dr) == false) v_drd = double.Parse(str_day_dr);
if (string.IsNullOrEmpty(str_time_dr) == false) v_drt = double.Parse(str_time_dr);
if (d_crd.ContainsKey(str_cate))
d_crd[str_cate] = d_crd[str_cate] + v_crd;
else
d_crd.Add(str_cate, v_crd);
if (d_crt.ContainsKey(str_cate))
d_crt[str_cate] = d_crt[str_cate] + v_crt;
else
d_crt.Add(str_cate, v_crt);
if (d_drd.ContainsKey(str_cate))
d_drd[str_cate] = d_drd[str_cate] + v_drd;
else
d_drd.Add(str_cate, v_drd);
if (v_time != 0.0 && catelistt.ContainsKey(str_cate))
catelistt[str_cate] = catelistt[str_cate] + v_time;
else if(v_time != 0.0)
catelistt.Add(str_cate, v_time);
}
textBox3.Tag = val_day;// db_jobreport.Sum(t => t.kisulamt);
textBox3.Text = textBox3.Tag.ToString();
textBox4.Tag = val_time;// db_jobreport.Sum(t => t.kisulamt);
textBox4.Text = textBox4.Tag.ToString();
dar.Close();
if (d_drt.ContainsKey(str_cate))
d_drt[str_cate] = d_drt[str_cate] + v_drt;
else
d_drt.Add(str_cate, v_drt);
//근태입력자료확인
val_day += v_crd;// double.Parse(str_day_cr);
val_time += v_crt;// double.Parse(str_time_cr);
cmd.CommandText = "select cate,sum(term) ,sum(crtime),sum(termdr),sum(drtime),sum(drtimepms)" +
" from Holyday " +
" where gcode = @gcode and sdate = '{0}' and isnull(extidx,-1) <> -1" +
" group by cate";
val_day_dr += v_drd;// double.Parse(str_day_dr);
val_time_dr += v_drt;// double.Parse(str_time_dr);
}
dar.Close();
cmd.CommandText = string.Format(cmd.CommandText, pdate);
dar = cmd.ExecuteReader();
val_day = 0;
val_time = 0;
double val_day_dr = 0;
double val_time_dr = 0;
double val_time_drPMS = 0;
Dictionary<string, double> d_drd = new Dictionary<string, double>();
Dictionary<string, double> d_drt = new Dictionary<string, double>();
Dictionary<string, double> d_drtPMS = new Dictionary<string, double>();
Dictionary<string, double> d_crd = new Dictionary<string, double>();
Dictionary<string, double> d_crt = new Dictionary<string, double>();
double v_crd, v_crt, v_drd, v_drt, v_drtPMS;
System.Text.StringBuilder sbcate = new StringBuilder();
while (dar.Read())
{
v_crd = v_crt = v_drd = v_drt = v_drtPMS = 0.0;
var str_cate = dar[0].ToString();
var str_day_cr = dar[1].ToString();
var str_time_cr = dar[2].ToString();
var str_day_dr = dar[3].ToString();
var str_time_dr = dar[4].ToString();
var str_time_drPMS = dar[5].ToString();
//카테고리별데이터확인 (대변[CR]자료를 대상으로함)
bool cateerr = false;
foreach (var item in catelistd)
{
if (d_crd.ContainsKey(item.Key) == false)
{
sbcate.Append($"{item.Key}(X)");
cateerr = true;
break;
}
else
{
if (d_crd[item.Key] != item.Value)
{
sbcate.Append($"{item.Key}({d_crd[item.Key]}|{item.Value})");
cateerr = true;
break;
}
}
}
if (cateerr == false)
{
foreach (var item in catelistt)
{
if (d_crt.ContainsKey(item.Key) == false)
{
sbcate.Append($"{item.Key}(X)");
cateerr = true;
break;
}
else
{
if (d_crt[item.Key] != item.Value)
{
sbcate.Append($"{item.Key}({d_crt[item.Key]}|{item.Value})");
cateerr = true;
break;
}
}
}
}
if (cateerr == false)
{
foreach (var item in d_crd)
{
if (item.Key.Equals("대체")) continue;
if (catelistd.ContainsKey(item.Key) == false)
{
sbcate.Append($"{item.Key}(X)");
cateerr = true;
break;
}
else
{
if (catelistd[item.Key] != item.Value)
{
sbcate.Append($"{item.Key}({catelistd[item.Key]}|{item.Value})");
cateerr = true;
break;
}
}
}
}
if (cateerr == false)
{
foreach (var item in d_crt)
{
if (item.Key.Equals("대체")) continue;
if (catelistt.ContainsKey(item.Key) == false)
{
sbcate.Append($"{item.Key}(X)");
cateerr = true;
break;
}
else
{
if (catelistt[item.Key] != item.Value)
{
sbcate.Append($"{item.Key}({catelistt[item.Key]}|{item.Value})");
cateerr = true;
break;
}
}
}
}
textBox6.Tag = val_day;// db_jobreport.Sum(t => t.kisulamt);
textBox6.Text = textBox6.Tag.ToString();
textBox5.Tag = val_time;// db_jobreport.Sum(t => t.kisulamt);
textBox5.Text = textBox5.Tag.ToString();
if (string.IsNullOrEmpty(str_day_cr) == false) v_crd = double.Parse(str_day_cr);
if (string.IsNullOrEmpty(str_time_cr) == false) v_crt = double.Parse(str_time_cr);
textBox8.Tag = val_day_dr;// db_jobreport.Sum(t => t.kisulamt);
textBox8.Text = textBox8.Tag.ToString();
textBox7.Tag = val_time_dr;// db_jobreport.Sum(t => t.kisulamt);
textBox7.Text = textBox7.Tag.ToString();
if (string.IsNullOrEmpty(str_day_dr) == false) v_drd = double.Parse(str_day_dr);
if (string.IsNullOrEmpty(str_time_dr) == false) v_drt = double.Parse(str_time_dr);
if (string.IsNullOrEmpty(str_time_drPMS) == false) v_drtPMS = double.Parse(str_time_drPMS);
if(v_crd != 0.0)
{
if (d_crd.ContainsKey(str_cate))
d_crd[str_cate] = d_crd[str_cate] + v_crd;
else
d_crd.Add(str_cate, v_crd);
}
if(v_crt != 0.0)
{
if (d_crt.ContainsKey(str_cate))
d_crt[str_cate] = d_crt[str_cate] + v_crt;
else
d_crt.Add(str_cate, v_crt);
}
if(v_drd != 0.0)
{
if (d_drd.ContainsKey(str_cate))
d_drd[str_cate] = d_drd[str_cate] + v_drd;
else
d_drd.Add(str_cate, v_drd);
}
bool dataError = false;
if (textBox2.Text.Equals(textBox7.Text) == false) dataError = true;
if (textBox3.Text.Equals(textBox6.Text) == false) dataError = true;
if (textBox4.Text.Equals(textBox5.Text) == false) dataError = true;
if (cateerr) dataError = true;
if(v_drt != 0.0)
{
if (d_drt.ContainsKey(str_cate))
d_drt[str_cate] = d_drt[str_cate] + v_drt;
else
d_drt.Add(str_cate, v_drt);
}
ListViewItem lv = dataError ? this.lvNG.Items.Add(pdate) : this.lvOK.Items.Add(pdate);
lv.SubItems.Add("입력/생성");
lv.SubItems.Add($"--/{textBox8.Text}");
lv.SubItems.Add($"{textBox2.Text}/{textBox7.Text}");
lv.SubItems.Add($"{textBox3.Text}/{textBox6.Text}");
lv.SubItems.Add($"{textBox4.Text}/{textBox5.Text}");
lv.SubItems.Add(sbcate.ToString());
if (dataError)
{
//해당 월이 마감되었다면 청색으로 한다.
if (FCOMMON.DBM.GetMagamStatus(pdate.Substring(0, 7)))
{
lv.ForeColor = Color.Blue;
lv.Checked = false;
}
else
{
lv.ForeColor = Color.Tomato;
lv.Checked = true;
}
}
else lv.ForeColor = Color.Black;
//if (val_jobreport > 0) break;
}
cn.Dispose();
}
private void button2_Click(object sender, EventArgs e)
{
//오류수정버튼
if (lvNG.CheckedItems.Count < 1)
{
FCOMMON.Util.MsgE("정정할 자료가 선택되지 않았습니다");
return;
}
if (FCOMMON.Util.MsgQ("재 생성 할까요?") != DialogResult.Yes) return;
//검사버튼
var sd = DateTime.Parse(dtSD.Text);
var ed = DateTime.Parse(dtED.Text);
// var idx = 0;
var gcode = FCOMMON.info.Login.gcode;
var id = FCOMMON.info.Login.no;
var cn = FCOMMON.DBM.getCn();
cn.Open();
var cmd = new System.Data.SqlClient.SqlCommand("", cn);
cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = gcode;
cmd.Parameters.Add("uid", SqlDbType.VarChar).Value = id;
cmd.Parameters.Add("pdate", SqlDbType.VarChar).Value = "1982-11-23";
lvNG.FullRowSelect = true;
foreach (ListViewItem lv in lvNG.CheckedItems)
{
var CD = DateTime.Parse(lv.SubItems[0].Text);
//if (CD > ed) break;
var pdate = CD.ToShortDateString();
cmd.Parameters["pdate"].Value = pdate;
tbDate.Text = pdate;
Application.DoEvents();
if (FCOMMON.Util.MsgQ(pdate + "를 재생성 할까요?") != DialogResult.Yes) break;
//근태-업무일지자료삭제
cmd.CommandText = "delete from Holyday where gcode = @gcode and extcate = 'HO' and sdate=@pdate and isnull(extidx,-1) <> -1";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
var cnt1 = cmd.ExecuteNonQuery();
Console.WriteLine($"{cnt1}건의 근태자료가 삭제 되었습니다");
//근태-업무일지자료생성
cmd.CommandText = "insert into Holyday(gcode, cate, sdate, edate, term, crtime, termdr, DrTime, contents, [uid], wdate, wuid, extcate, extidx) ";
cmd.CommandText += "select gcode,'대체',pdate,pdate,0,0,0,isnull(ot2,0),projectname,uid,GETDATE(),@uid + '-ERR','HO',idx from jobreport where gcode = @gcode and pdate = @pdate and isnull(ot2,0) > 0 and isnull(ot,0) > 0";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
var cnt2 = cmd.ExecuteNonQuery();
Console.WriteLine($"{cnt2}건의 근태자료가 생성 되었습니다");
if(v_drtPMS != 0.0)
{
if (d_drtPMS.ContainsKey(str_cate))
d_drtPMS[str_cate] = d_drtPMS[str_cate] + v_drtPMS;
else
d_drtPMS.Add(str_cate, v_drtPMS);
}
//근태-휴가신청자료삭제
cmd.CommandText = "delete from Holyday where gcode = @gcode and extcate = '휴가' and sdate=@pdate and isnull(extidx,-1) <> -1";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
cnt1 = cmd.ExecuteNonQuery();
Console.WriteLine($"{cnt1}건의 근태자료가 삭제 되었습니다");
//근태-휴가신청자료생성(승인완료된자료대상)
cmd.CommandText = "insert into Holyday(gcode, cate, sdate, edate, term, crtime, termdr, DrTime, contents, [uid], wdate, wuid, extcate, extidx) ";
cmd.CommandText += "select gcode,cate,sdate,edate,isnull(holydays,0),isnull(holytimes,0),0,0,HolyReason,uid,GETDATE(),@uid + '-ERR','휴가',idx " +
" from EETGW_HolydayRequest " +
" where gcode = @gcode and sdate = @pdate and isnull(conf,0) = 1";
val_day += v_crd;// double.Parse(str_day_cr);
val_time += v_crt;// double.Parse(str_time_cr);
cmd.CommandText = string.Format(cmd.CommandText, pdate);
cnt2 = cmd.ExecuteNonQuery();
Console.WriteLine($"{cnt2}건의 근태자료가 생성 되었습니다");
val_day_dr += v_drd;// double.Parse(str_day_dr);
val_time_dr += v_drt;// double.Parse(str_time_dr);
val_time_drPMS += v_drtPMS;
}
dar.Close();
}
cn.Dispose();
//카테고리별데이터확인 (대변[CR]자료를 대상으로함)
bool cateerr = false;
foreach (var item in catelistd)
{
if (d_crd.ContainsKey(item.Key) == false)
{
sbcate.Append($"{item.Key}(X)");
cateerr = true;
break;
}
else
{
if (d_crd[item.Key] != item.Value)
{
sbcate.Append($"{item.Key}({d_crd[item.Key]}|{item.Value})");
cateerr = true;
break;
}
}
}
if (cateerr == false)
{
foreach (var item in catelistt)
{
if (d_crt.ContainsKey(item.Key) == false)
{
sbcate.Append($"{item.Key}(X)");
cateerr = true;
break;
}
else
{
if (d_crt[item.Key] != item.Value)
{
sbcate.Append($"{item.Key}({d_crt[item.Key]}|{item.Value})");
cateerr = true;
break;
}
}
}
}
if (cateerr == false)
{
foreach (var item in d_crd)
{
if (item.Key.Equals("대체")) continue;
if (catelistd.ContainsKey(item.Key) == false)
{
sbcate.Append($"{item.Key}(X)");
cateerr = true;
break;
}
else
{
if (catelistd[item.Key] != item.Value)
{
sbcate.Append($"{item.Key}({catelistd[item.Key]}|{item.Value})");
cateerr = true;
break;
}
}
}
}
if (cateerr == false)
{
foreach (var item in d_crt)
{
if (item.Key.Equals("대체")) continue;
if (catelistt.ContainsKey(item.Key) == false)
{
sbcate.Append($"{item.Key}(X)");
cateerr = true;
break;
}
else
{
if (catelistt[item.Key] != item.Value)
{
sbcate.Append($"{item.Key}({catelistt[item.Key]}|{item.Value})");
cateerr = true;
break;
}
}
}
}
textBox6.Tag = val_day;// db_jobreport.Sum(t => t.kisulamt);
textBox6.Text = textBox6.Tag.ToString();
textBox5.Tag = val_time;// db_jobreport.Sum(t => t.kisulamt);
textBox5.Text = textBox5.Tag.ToString();
}
textBox8.Tag = val_day_dr;// db_jobreport.Sum(t => t.kisulamt);
textBox8.Text = textBox8.Tag.ToString();
textBox7.Tag = val_time_dr;// db_jobreport.Sum(t => t.kisulamt);
textBox7.Text = textBox7.Tag.ToString();
private void button2_Click_1(object sender, EventArgs e)
{
dtSD.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01");
dtED.Value = dtSD.Value.AddMonths(1).AddDays(-1);
}
private void button3_Click(object sender, EventArgs e)
{
var = DateTime.Parse(dtSD.Value.ToString("yyyy-MM") + "-01");
dtSD.Value = .AddMonths(-1);
dtED.Value = dtSD.Value.AddMonths(1).AddDays(-1);
}
bool dataError = false;
if (textBox2.Text.Equals(textBox7.Text) == false) dataError = true;
if (textBox3.Text.Equals(textBox6.Text) == false) dataError = true;
if (textBox4.Text.Equals(textBox5.Text) == false) dataError = true;
if (cateerr) dataError = true;
private void button1_Click_1(object sender, EventArgs e)
{
var = DateTime.Parse(dtSD.Value.ToString("yyyy-MM") + "-01");
dtSD.Value = .AddMonths(1);
dtED.Value = dtSD.Value.AddMonths(1).AddDays(-1);
}
}
ListViewItem lv = dataError ? this.lvNG.Items.Add(pdate) : this.lvOK.Items.Add(pdate);
lv.SubItems.Add("입력/생성");
lv.SubItems.Add($"--/{textBox8.Text}");
lv.SubItems.Add($"{textBox2.Text}/{textBox7.Text}");
lv.SubItems.Add($"{textBox3.Text}/{textBox6.Text}");
lv.SubItems.Add($"{textBox4.Text}/{textBox5.Text}");
lv.SubItems.Add(sbcate.ToString());
if (dataError)
{
//해당 월이 마감되었다면 청색으로 한다.
if (FCOMMON.DBM.GetMagamStatus(pdate.Substring(0, 7)))
{
lv.ForeColor = Color.Blue;
lv.Checked = false;
}
else
{
lv.ForeColor = Color.Tomato;
lv.Checked = true;
}
}
else lv.ForeColor = Color.Black;
//if (val_jobreport > 0) break;
}
cn.Dispose();
}
private void button2_Click(object sender, EventArgs e)
{
//오류수정버튼
if (lvNG.CheckedItems.Count < 1)
{
FCOMMON.Util.MsgE("정정할 자료가 선택되지 않았습니다");
return;
}
if (FCOMMON.Util.MsgQ("재 생성 할까요?") != DialogResult.Yes) return;
//검사버튼
var sd = DateTime.Parse(dtSD.Text);
var ed = DateTime.Parse(dtED.Text);
// var idx = 0;
var gcode = FCOMMON.info.Login.gcode;
var id = FCOMMON.info.Login.no;
var cn = FCOMMON.DBM.getCn();
cn.Open();
var cmd = new System.Data.SqlClient.SqlCommand("", cn);
cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = gcode;
cmd.Parameters.Add("uid", SqlDbType.VarChar).Value = id;
cmd.Parameters.Add("pdate", SqlDbType.VarChar).Value = "1982-11-23";
lvNG.FullRowSelect = true;
foreach (ListViewItem lv in lvNG.CheckedItems)
{
var CD = DateTime.Parse(lv.SubItems[0].Text);
//if (CD > ed) break;
var pdate = CD.ToShortDateString();
cmd.Parameters["pdate"].Value = pdate;
tbDate.Text = pdate;
Application.DoEvents();
if (FCOMMON.Util.MsgQ(pdate + "를 재생성 할까요?") != DialogResult.Yes) break;
//근태-업무일지자료삭제
cmd.CommandText = "delete from Holyday where gcode = @gcode and extcate = 'HO' and sdate=@pdate and isnull(extidx,-1) <> -1";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
var cnt1 = cmd.ExecuteNonQuery();
Console.WriteLine($"{cnt1}건의 근태자료가 삭제 되었습니다");
//근태-업무일지자료생성
cmd.CommandText = "insert into Holyday(gcode, cate, sdate, edate, term, crtime, termdr, DrTime, contents, [uid], wdate, wuid, extcate, extidx) ";
cmd.CommandText += "select gcode,'대체',pdate,pdate,0,0,0,isnull(ot2,0),projectname,uid,GETDATE(),@uid + '-ERR','HO',idx from jobreport where gcode = @gcode and pdate = @pdate and isnull(ot2,0) > 0 and isnull(ot,0) > 0";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
var cnt2 = cmd.ExecuteNonQuery();
Console.WriteLine($"{cnt2}건의 근태자료가 생성 되었습니다");
//근태-휴가신청자료삭제
cmd.CommandText = "delete from Holyday where gcode = @gcode and extcate = '휴가' and sdate=@pdate and isnull(extidx,-1) <> -1";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
cnt1 = cmd.ExecuteNonQuery();
Console.WriteLine($"{cnt1}건의 근태자료가 삭제 되었습니다");
//근태-휴가신청자료생성(승인완료된자료대상)
cmd.CommandText = "insert into Holyday(gcode, cate, sdate, edate, term, crtime, termdr, DrTime, contents, [uid], wdate, wuid, extcate, extidx) ";
cmd.CommandText += "select gcode,cate,sdate,edate,isnull(holydays,0),isnull(holytimes,0),0,0,HolyReason,uid,GETDATE(),@uid + '-ERR','휴가',idx " +
" from EETGW_HolydayRequest " +
" where gcode = @gcode and sdate = @pdate and isnull(conf,0) = 1";
cmd.CommandText = string.Format(cmd.CommandText, pdate);
cnt2 = cmd.ExecuteNonQuery();
Console.WriteLine($"{cnt2}건의 근태자료가 생성 되었습니다");
}
cn.Dispose();
}
private void button2_Click_1(object sender, EventArgs e)
{
dtSD.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01");
dtED.Value = dtSD.Value.AddMonths(1).AddDays(-1);
}
private void button3_Click(object sender, EventArgs e)
{
var = DateTime.Parse(dtSD.Value.ToString("yyyy-MM") + "-01");
dtSD.Value = .AddMonths(-1);
dtED.Value = dtSD.Value.AddMonths(1).AddDays(-1);
}
private void button1_Click_1(object sender, EventArgs e)
{
var = DateTime.Parse(dtSD.Value.ToString("yyyy-MM") + "-01");
dtSD.Value = .AddMonths(1);
dtED.Value = dtSD.Value.AddMonths(1).AddDays(-1);
}
}
}

View File

@@ -3691,16 +3691,16 @@ SELECT idx, gcode, cate, title, tolist, bcc, cc, subject, tail, body, selfTo, se
this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[1].Connection = this.Connection;
this._commandCollection[1].CommandText = "SELECT bcc, body, cate, cc, exceptmail, exceptmailcc, gcode, idx, selfBCC, selfC" +
"C, selfTo, subject, tail, title, tolist, wdate, wuid\r\nFROM EETGW_MailForm WI" +
"TH (NOLOCK)\r\nWHERE (gcode = @gcode) AND (cate = @cate)\r\nORDER BY title";
"C, selfTo, subject, tail, title, tolist, wdate, wuid\r\nFROM MailForm WITH (NO" +
"LOCK)\r\nWHERE (gcode = @gcode) AND (cate = @cate)\r\nORDER BY title";
this._commandCollection[1].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@gcode", global::System.Data.SqlDbType.VarChar, 10, global::System.Data.ParameterDirection.Input, 0, 0, "gcode", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@cate", global::System.Data.SqlDbType.VarChar, 2, global::System.Data.ParameterDirection.Input, 0, 0, "cate", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[2].Connection = this.Connection;
this._commandCollection[2].CommandText = "SELECT bcc, body, cate, cc, exceptmail, exceptmailcc, gcode, idx, selfBCC, selfC" +
"C, selfTo, subject, tail, title, tolist, wdate, wuid\r\nFROM EETGW_MailForm WI" +
"TH (NOLOCK)\r\nWHERE (gcode = @gcode) AND (idx = @idx)\r\nORDER BY title";
"C, selfTo, subject, tail, title, tolist, wdate, wuid\r\nFROM MailForm WITH (NO" +
"LOCK)\r\nWHERE (gcode = @gcode) AND (idx = @idx)\r\nORDER BY title";
this._commandCollection[2].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@gcode", global::System.Data.SqlDbType.VarChar, 10, global::System.Data.ParameterDirection.Input, 0, 0, "gcode", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@idx", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "idx", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));

View File

@@ -131,12 +131,12 @@ SELECT idx, gcode, cate, title, tolist, bcc, cc, subject, tail, body, selfTo, se
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT bcc, body, cate, cc, exceptmail, exceptmailcc, gcode, idx, selfBCC, selfCC, selfTo, subject, tail, title, tolist, wdate, wuid
FROM EETGW_MailForm WITH (NOLOCK)
FROM MailForm WITH (NOLOCK)
WHERE (gcode = @gcode) AND (cate = @cate)
ORDER BY title</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="gcode" ColumnName="gcode" DataSourceName="EE.dbo.EETGW_MailForm" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@gcode" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="gcode" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="cate" ColumnName="cate" DataSourceName="EE.dbo.EETGW_MailForm" DataTypeServer="varchar(2)" DbType="AnsiString" Direction="Input" ParameterName="@cate" Precision="0" ProviderType="VarChar" Scale="0" Size="2" SourceColumn="cate" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="false" AutogeneratedName="gcode" ColumnName="gcode" DataSourceName="EE.dbo.MailForm" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@gcode" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="gcode" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="cate" ColumnName="cate" DataSourceName="EE.dbo.MailForm" DataTypeServer="varchar(2)" DbType="AnsiString" Direction="Input" ParameterName="@cate" Precision="0" ProviderType="VarChar" Scale="0" Size="2" SourceColumn="cate" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
@@ -145,12 +145,12 @@ ORDER BY title</CommandText>
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT bcc, body, cate, cc, exceptmail, exceptmailcc, gcode, idx, selfBCC, selfCC, selfTo, subject, tail, title, tolist, wdate, wuid
FROM EETGW_MailForm WITH (NOLOCK)
FROM MailForm WITH (NOLOCK)
WHERE (gcode = @gcode) AND (idx = @idx)
ORDER BY title</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="gcode" ColumnName="gcode" DataSourceName="EE.dbo.EETGW_MailForm" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@gcode" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="gcode" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="false" AutogeneratedName="idx" ColumnName="idx" DataSourceName="EE.dbo.EETGW_MailForm" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@idx" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="idx" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="false" AutogeneratedName="gcode" ColumnName="gcode" DataSourceName="EE.dbo.MailForm" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@gcode" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="gcode" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="false" AutogeneratedName="idx" ColumnName="idx" DataSourceName="EE.dbo.MailForm" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@idx" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="idx" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
@@ -628,22 +628,22 @@ SELECT idx, enable, fidx, gcode, fromlist, tolist, bcc, cc, sdate, edate, stime,
</xs:simpleType>
</xs:element>
<xs:element name="sdate" msprop:Generator_ColumnPropNameInTable="sdateColumn" msprop:Generator_ColumnPropNameInRow="sdate" msprop:Generator_UserColumnName="sdate" msprop:Generator_ColumnVarNameInTable="columnsdate" type="xs:dateTime" minOccurs="0" />
<xs:element name="SendOK2" msprop:Generator_ColumnPropNameInRow="SendOK2" msprop:Generator_ColumnPropNameInTable="SendOK2Column" msprop:Generator_ColumnVarNameInTable="columnSendOK2" msprop:Generator_UserColumnName="SendOK2" type="xs:boolean" minOccurs="0" />
<xs:element name="SendMsg2" msprop:Generator_ColumnPropNameInRow="SendMsg2" msprop:Generator_ColumnPropNameInTable="SendMsg2Column" msprop:Generator_ColumnVarNameInTable="columnSendMsg2" msprop:Generator_UserColumnName="SendMsg2" minOccurs="0">
<xs:element name="SendOK2" msprop:Generator_UserColumnName="SendOK2" msprop:Generator_ColumnPropNameInTable="SendOK2Column" msprop:Generator_ColumnPropNameInRow="SendOK2" msprop:Generator_ColumnVarNameInTable="columnSendOK2" type="xs:boolean" minOccurs="0" />
<xs:element name="SendMsg2" msprop:Generator_UserColumnName="SendMsg2" msprop:Generator_ColumnPropNameInTable="SendMsg2Column" msprop:Generator_ColumnPropNameInRow="SendMsg2" msprop:Generator_ColumnVarNameInTable="columnSendMsg2" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="suid2" msprop:Generator_ColumnPropNameInRow="suid2" msprop:Generator_ColumnPropNameInTable="suid2Column" msprop:Generator_ColumnVarNameInTable="columnsuid2" msprop:Generator_UserColumnName="suid2" minOccurs="0">
<xs:element name="suid2" msprop:Generator_UserColumnName="suid2" msprop:Generator_ColumnPropNameInTable="suid2Column" msprop:Generator_ColumnPropNameInRow="suid2" msprop:Generator_ColumnVarNameInTable="columnsuid2" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="sdate2" msprop:Generator_ColumnPropNameInRow="sdate2" msprop:Generator_ColumnPropNameInTable="sdate2Column" msprop:Generator_ColumnVarNameInTable="columnsdate2" msprop:Generator_UserColumnName="sdate2" type="xs:dateTime" minOccurs="0" />
<xs:element name="sdate2" msprop:Generator_UserColumnName="sdate2" msprop:Generator_ColumnPropNameInTable="sdate2Column" msprop:Generator_ColumnPropNameInRow="sdate2" msprop:Generator_ColumnVarNameInTable="columnsdate2" type="xs:dateTime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@@ -4,7 +4,7 @@
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="60" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<Shapes>
<Shape ID="DesignTable:MailForm" ZOrder="3" X="70" Y="70" Height="438" Width="253" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="332" />
<Shape ID="DesignTable:MailData" ZOrder="2" X="351" Y="24" Height="535" Width="260" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="467" />

View File

@@ -36,6 +36,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ArLog.Net4">
<HintPath>..\..\DLL\ArLog.Net4.dll</HintPath>
</Reference>
<Reference Include="ArSetting.Net4">
<HintPath>..\..\DLL\ArSetting.Net4.dll</HintPath>
</Reference>
@@ -182,6 +185,7 @@
<Compile Include="Models\UserGroupModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Info.cs" />
<Compile Include="Pub.cs" />
<Compile Include="Setting.cs" />
<Compile Include="Util_Form.cs" />
<Compile Include="Util.cs" />

45
SubProject/FCOMMON/Pub.cs Normal file
View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
using System.Threading.Tasks;
using System.Net.NetworkInformation;
using System.Net;
using System.Data.SqlClient;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace FCOMMON
{
public static class Pub
{
public static arUtil.Log log; //global logging system
public static void init()
{
//log
log = new arUtil.Log();
}
public static void AddLogE(string message)
{
log.AddE(message);
}
public static void AddLogI(string message)
{
log.AddI(message);
}
public static void AddLog(string message)
{
log.Add(message);
}
public static void FlushLog()
{
log.Flush();
}
}
}

View File

@@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Windows.Forms;
using util = FCOMMON.Util;
@@ -348,10 +349,12 @@ namespace FPJ0000
var dlg = FCOMMON.Util.MsgQ("삭제할까요?");
if (dlg != DialogResult.Yes) return;
var delinfo = $"{dr.uid}|{dr.name}|{dr.cate}|{dr.sdate}|{dr.edate}|{dr.HolyReason}|{dr.HolyLocation}";
bs.RemoveCurrent();
var cnt = ta.Update(this.dSKuntae.EETGW_HolydayRequest);
if (cnt == 0)
FCOMMON.Util.MsgQ("삭제가 완료되지 않았습니다");
else FCOMMON.Pub.AddLog($"[휴가신청데이터삭제] {delinfo}");
}
private void toolStripButton8_Click(object sender, EventArgs e)