# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is a Korean Enterprise GroupWare system built with C# .NET Framework 4.6 and Windows Forms. The application serves as a comprehensive business management system that includes project management, purchasing, attendance tracking, reporting, and web-based functionality. The project runs on port 7979 (previously 9000) and includes both desktop and web components.

## Architecture

### Main Application (Project/EETGW.csproj)
- **Entry Point**: `Project/Program.cs` - Handles WebView2Runtime extraction and starts the main form
- **Main Form**: `Project/fMain.cs` - Primary application window
- **Web Server**: Integrated OWIN-based web server for HTTP API and static files
- **Database**: Microsoft SQL Server with Entity Framework 6.2.0
- **Target Framework**: .NET Framework 4.6

### Key Components

1. **Web Layer** (`Project/Web/`):
   - **Startup.cs**: OWIN configuration for HTTP API and static file serving
   - **Controllers**: API controllers for various business functions (Home, Project, Purchase, Item, etc.)
   - **wwwroot**: Static web assets (HTML, CSS, JS files)

2. **SubProjects**: Modular components with specific business functionality:
   - **FPJ0000**: Project management module
   - **FCM0000**: Customer management
   - **FEQ0000**: Equipment management  
   - **FBS0000**: Holiday/attendance management
   - **FCOMMON**: Shared common functionality
   - **WebServer**: Additional web services
   - **AmkorRestfulService**: REST API services

3. **Sub Components** (`Sub/`):
   - **arCtl**: Custom controls library
   - **arftp**: FTP functionality
   - **tcpservice**: TCP communication services
   - **YARTE**: HTML editor component
   - **StaffLayoutCtl**: Staff layout controls

### Technology Stack
- **UI Framework**: Windows Forms with custom controls (FarPoint Spread grids)
- **Web Framework**: OWIN with ASP.NET Web API 5.2.9
- **Database ORM**: Entity Framework 6.2.0
- **JSON Processing**: Newtonsoft.Json 13.0.3
- **Web Browser**: Microsoft WebView2 1.0.2210.55
- **Reports**: Microsoft ReportViewer 15.0
- **Excel Processing**: libxl.net and CsvHelper 30.0.1

### 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
- **Database**: Ensure SQL Server connection string is configured in app.config

### Package Management
- Uses NuGet packages defined in `packages.config` files throughout the solution
- Restore packages using: `nuget restore EETGW.sln`

## Configuration

### Database Connection
- Connection strings configured in individual `app.config` files
- Primary database connection in `Project/app.config`
- Uses Entity Framework with SQL Server

### Web Server Configuration
- **Port**: 7979 (configured in startup)
- **Static Files**: Served from `Project/Web/wwwroot/`
- **API Routes**: Configured in `Project/Web/Startup.cs`
- **CORS**: Enabled for all origins

### Build Configurations
- **Debug**: Outputs to `Project/bin/Debug/` with x86 platform target
- **Release**: Optimized build configuration
- Different output paths for various configurations (see EETGW.csproj)

## Key Conventions

### Code Organization
- Korean comments and variable names are common throughout the codebase
- Business logic separated into modular SubProjects
- Shared functionality centralized in FCOMMON project
- Custom controls and utilities in Sub/ directory

### File Structure
- Each SubProject has its own namespace and assembly
- Form files follow naming convention: `f[FormName].cs` with corresponding `.Designer.cs` and `.resx`
- Dataset files use `.xsd` schemas with generated code

### Dependencies
- Heavy use of FarPoint Spread controls for data grids
- Custom logging via ArLog.Net4.dll
- Settings management through ArSetting.Net4.dll
- Multiple third-party libraries for Excel, FTP, and web functionality

## Development Notes

- WebView2Runtime is automatically extracted on first run from WebView2Runtime.zip
- The application includes comprehensive error handling and logging
- 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 컨트롤러 최대한 재사용
- 동일한 디자인 언어 유지 (색상, 폰트, 레이아웃)
- 단계적 전환을 위한 라우팅 분리