프로젝트 관리 시스템 구현 및 UI 개선

- 새로운 프로젝트 관리 화면 추가 (ProjectController, ProjectModel)
- 로그인된 사용자 기반 필터링 기능 구현
- 프로젝트 CRUD 기능 완성 (생성, 조회, 수정, 삭제)
- 컬럼 표시/숨김 기능으로 사용자 정의 뷰 지원
- 상태별 프로젝트 현황 대시보드
- 엑셀 내보내기 기능
- 반응형 디자인 및 glass-effect UI 적용
- 할일관리/근태관리와 일관된 레이아웃 구조

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ChiKyun Kim
2025-08-04 15:20:58 +09:00
parent 5e0337a044
commit a11780f725
3 changed files with 1473 additions and 423 deletions

View File

@@ -1,264 +1,35 @@
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
{
// 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 EEEntitiesProject();
//var rows = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
//itemcnt = rows.Count();
//foreach (var item in rows)
//{
// tbody.AppendLine("<tr>");
// tbody.AppendLine($"<th scope='row'>{item.pdate}</th>");
// tbody.AppendLine($"<td>{item.name}</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 ScheduleConfirm(int? id)
{
//로그인이 되어있지않다면 로그인을 가져온다
MethodResult result;
result = View();
var project = (int)id;
//데이터를 조회해서 표시를 해준다.
var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
var prjinfo = db.GetData(FCOMMON.info.Login.gcode, project).FirstOrDefault();// db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == project).FirstOrDefault();
var taSch = new dsProjectsTableAdapters.EETGW_ProjectsScheduleTableAdapter();
var schrows = taSch.GetData(FCOMMON.info.Login.gcode, project);//. db.EETGW_ProjectsSchedule.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.project == project).OrderByDescending(t => t.project).OrderByDescending(t => t.no).OrderBy(t => t.seq);
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
System.Text.StringBuilder tinfo = new System.Text.StringBuilder();
//프로젝트정보를 표시합니다.
tinfo.AppendLine("<tr>");
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.idx));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.status));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.progress));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.name));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.reqstaff));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.userManager));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.orderno));
tinfo.AppendLine("</tr>");
var contents = result.Content.Replace("{search}", "");
contents = contents.Replace("{tableinfo}", tinfo.ToString());
tinfo.Clear();
foreach (var item in schrows)
{
tinfo.AppendLine("<tr>");
tinfo.AppendLine(string.Format("<td>{0}</td>", item.no));
tinfo.AppendLine(string.Format("<td>{0}</td>", item.seq));
tinfo.AppendLine(string.Format("<td>{0}</td>", item.title));
tinfo.AppendLine(string.Format("<td>{0}</td>", item.sw));
tinfo.AppendLine(string.Format("<td>{0}</td>", item.ew));
tinfo.AppendLine(string.Format("<td>{0}</td>", item.swa));
tinfo.AppendLine(string.Format("<td>{0}</td>", item.ewa));
tinfo.AppendLine(string.Format("<td>{0}</td>", item.progress));
tinfo.AppendLine(string.Format("<td>{0}</td>", item.uid));
tinfo.AppendLine(string.Format("<td>{0}</td>", item.memo));
tinfo.AppendLine("</tr>");
}
contents = contents.Replace("{scheinfo}", tinfo.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 filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Project", "index.html");
var contents = string.Empty;
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)
if (System.IO.File.Exists(filePath))
{
var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
var rows = db.GetNotCompleteTop50(FCOMMON.info.Login.gcode);//.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
itemcnt = rows.Count();
foreach (var item in rows)
{
tbody.AppendLine("<tr>");
tbody.AppendLine($"<th scope='row'>{item.idx}</th>");
tbody.AppendLine($"<td>{item.status}</td>");
tbody.AppendLine($"<td>{item.progress}</td>");
tbody.AppendLine($"<td>{item.name}</td>");
tbody.AppendLine($"<td>{item.reqstaff}</td>");
tbody.AppendLine($"<td>{item.userManager}</td>");
tbody.AppendLine($"<td>{item.cnt}</td>");
tbody.AppendLine($"<td>{item.costo}</td>");
tbody.AppendLine($"<td>{item.costn}</td>");
tbody.AppendLine($"<td>{item.costo - item.costn}</td>");
tbody.AppendLine($"<td>{item.orderno}</td>");
if (item.memo != null)
tbody.AppendLine($"<td>{item.memo}</td>");
contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
}
else
tbody.AppendLine($"<td>&nbsp;</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>");
contents = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
}
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,
contents,
System.Text.Encoding.UTF8,
"text/html")
};
@@ -267,205 +38,371 @@ namespace Project.Web.Controllers
}
[HttpGet]
public HttpResponseMessage detail(int id)
public HttpResponseMessage GetProjects(string status = "진행", string userFilter = "my")
{
//로그인이 되어있지않다면 로그인을 가져온다
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)
try
{
var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
var rows = db.GetNotCompleteTop50(FCOMMON.info.Login.gcode);// db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
itemcnt = rows.Count();
foreach (var item in rows)
var currentUser = GetCurrentUser();
if (currentUser == null)
{
tbody.AppendLine("<tr>");
tbody.AppendLine($"<th scope='row'>{item.idx}</th>");
tbody.AppendLine($"<td>{item.status}</td>");
tbody.AppendLine($"<td>{item.progress}</td>");
tbody.AppendLine($"<td>{item.name}</td>");
tbody.AppendLine($"<td>{item.reqstaff}</td>");
tbody.AppendLine($"<td>{item.userManager}</td>");
tbody.AppendLine($"<td>{item.cnt}</td>");
tbody.AppendLine($"<td>{item.costo}</td>");
tbody.AppendLine($"<td>{item.costn}</td>");
tbody.AppendLine($"<td>{item.costo - item.costn}</td>");
tbody.AppendLine($"<td>{item.orderno}</td>");
if (item.memo != null)
tbody.AppendLine($"<td>{item.memo}</td>");
else
tbody.AppendLine($"<td>&nbsp;</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>");
}
return CreateJsonResponse(new
{
Success = false,
Message = "로그인되지 않은 상태입니다."
});
}
//아잍쳄이 없는경우
if (itemcnt == 0)
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))
{
tbody.AppendLine("<tr>");
tbody.AppendLine("<th scope='row'>1</th>");
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
tbody.AppendLine("</tr>");
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 contents = result.Content.Replace("{search}", searchkey);
contents = contents.Replace("{tabledata}", tbody.ToString());
contents = contents.Replace("{cnt}", itemcnt.ToString());
contents = contents.Replace("{pidx}", id.ToString());
//공용값 적용
ApplyCommonValue(ref contents);
//최종문자 적용
result.Content = contents;
var resp = new HttpResponseMessage()
var parameters = new
{
Content = new StringContent(
result.Content,
System.Text.Encoding.UTF8,
"text/html")
gcode = gcode,
status = status,
userName = userFilter == "my" ? "%" + currentUserName + "%" : ""
};
return resp;
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 partlist(int id)
public HttpResponseMessage GetProject(int id)
{
//로그인이 되어있지않다면 로그인을 가져온다
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 contents = result.Content.Replace("{search}", searchkey);
//테이블데이터생성
var itemcnt = 0;
//if (searchkey.isEmpty() == false)
try
{
var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
var prjinfo = db.GetData(FCOMMON.info.Login.gcode, id).FirstOrDefault();// db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
System.Text.StringBuilder tinfo = new System.Text.StringBuilder();
//프로젝트정보를 표시합니다.
tinfo.AppendLine("<tr>");
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.idx));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.status));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.progress));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.name));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.reqstaff));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.userManager));
tinfo.AppendLine(string.Format("<td>{0}</td>", prjinfo.orderno));
tinfo.AppendLine("</tr>");
contents = contents.Replace("{tableinfo}", tinfo.ToString());
var taPart = new dsProjectsTableAdapters.ProjectsPartTableAdapter();
var rows = taPart.GetData(id);// db.ProjectsPart.Where(t => t.Project == id).OrderBy(t=>t.no);
itemcnt = rows.Count();
foreach (var item in rows)
var currentUser = GetCurrentUser();
if (currentUser == null)
{
tbody.AppendLine("<tr>");
tbody.AppendLine($"<th scope='row'>{item.no}</th>");
tbody.AppendLine($"<td>{item.ItemGroup}</td>");
tbody.AppendLine($"<td>{item.ItemModel}</td>");
tbody.AppendLine($"<td>{item.ItemUnit}</td>");
tbody.AppendLine($"<td>{item.ItemName}</td>");
tbody.AppendLine($"<td>{item.ItemSid}</td>");
tbody.AppendLine($"<td>{item.ItemManu}</td>");
tbody.AppendLine($"<td>{item.qty}</td>");
tbody.AppendLine($"<td>{item.qtyn}</td>");
tbody.AppendLine($"<td>{item.price}</td>");
tbody.AppendLine($"<td>{item.amt}</td>");
tbody.AppendLine($"<td>{item.amtn}</td>");
tbody.AppendLine($"<td>{item.remark}</td>");
tbody.AppendLine($"<td>{item.qtybuy}</td>");
tbody.AppendLine($"<td>{item.qtyin}</td>");
tbody.AppendLine($"<td>{item.bbuy}</td>");
tbody.AppendLine($"<td>{item.bconfirm}</td>");
tbody.AppendLine("</tr>");
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
});
}
}
//아잍쳄이 없는경우
if (itemcnt == 0)
[HttpPost]
public HttpResponseMessage CreateProject([FromBody] ProjectModel project)
{
tbody.AppendLine("<tr>");
tbody.AppendLine("<th scope='row'>1</th>");
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
tbody.AppendLine("</tr>");
try
{
var currentUser = GetCurrentUser();
if (currentUser == null)
{
return CreateJsonResponse(new
{
Success = false,
Message = "로그인되지 않은 상태입니다."
});
}
contents = contents.Replace("{tabledata}", tbody.ToString());
contents = contents.Replace("{cnt}", itemcnt.ToString());
contents = contents.Replace("{pidx}", id.ToString());
//공용값 적용
ApplyCommonValue(ref contents);
//최종문자 적용
result.Content = contents;
var resp = new HttpResponseMessage()
if (string.IsNullOrWhiteSpace(project.))
{
Content = new StringContent(
result.Content,
System.Text.Encoding.UTF8,
"text/html")
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 ?? ""
};
return resp;
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

@@ -0,0 +1,36 @@
using System;
namespace Project.Web.Model
{
public class ProjectModel
{
public int idx { get; set; } // 프로젝트 고유번호
public string gcode { get; set; } // 그룹코드
public string { get; set; } // 상태 (진행, 완료, 대기, 중단)
public string { get; set; } // 자산번호
public string { get; set; } // 장비모델
public string { get; set; } // 시리얼번호
public string { get; set; } // 우선순위
public string { get; set; } // 요청국가
public string { get; set; } // 요청공장
public string { get; set; } // 요청라인
public string { get; set; } // 요청부서패키지
public string { get; set; } // 요청자
public string { get; set; } // 프로젝트공정
public DateTime? { get; set; } // 시작일
public DateTime? { get; set; } // 완료일
public DateTime? { get; set; } // 만료일
public DateTime? { get; set; } // 출고일
public string { get; set; } // 프로젝트명
public string { get; set; } // 프로젝트관리자
public string { get; set; } // 설계담당
public string { get; set; } // 전장담당
public string { get; set; } // 프로그램담당
public DateTime? { get; set; } // 예산만기일
public string { get; set; } // 예산
public string { get; set; } // 웹관리번호
public string memo { get; set; } // 메모
public DateTime? wdate { get; set; } // 작성일
public int? isdel { get; set; } // 삭제여부 (0: 활성, 1: 삭제)
}
}

File diff suppressed because it is too large Load Diff