diff --git a/Project/Web/Controller/ProjectController.cs b/Project/Web/Controller/ProjectController.cs
index 7ff6b62..527831b 100644
--- a/Project/Web/Controller/ProjectController.cs
+++ b/Project/Web/Controller/ProjectController.cs
@@ -1,471 +1,408 @@
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("
");
- // tbody.AppendLine($"| {item.pdate} | ");
- // tbody.AppendLine($"{item.name} | ");
-
-
- // //if (item.description.Length > 10)
- // // tbody.AppendLine($"{item.description.Substring(0, 10)}... | ");
- // //else
- // // tbody.AppendLine($"{item.description} | ");
- // tbody.AppendLine("
");
- //}
- }
-
- //아잍쳄이 없는경우
- if (itemcnt == 0)
- {
- tbody.AppendLine("");
- tbody.AppendLine("| 1 | ");
- tbody.AppendLine("자료가 없습니다 | ");
- tbody.AppendLine("
");
- }
-
-
- var contents = result.Content.Replace("{search}", searchkey);
- contents = contents.Replace("{tabledata}", tbody.ToString());
- contents = contents.Replace("{cnt}", itemcnt.ToString());
-
-
- //공용값 적용
- ApplyCommonValue(ref contents);
-
- //최종문자 적용
- result.Content = contents;
-
- var resp = new HttpResponseMessage()
- {
- Content = new StringContent(
- result.Content,
- System.Text.Encoding.UTF8,
- "text/html")
- };
-
- return resp;
- }
-
-
-
- [HttpGet]
- public HttpResponseMessage 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("");
- tinfo.AppendLine(string.Format("| {0} | ", prjinfo.idx));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.status));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.progress));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.name));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.reqstaff));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.userManager));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.orderno));
- tinfo.AppendLine("
");
-
-
- var contents = result.Content.Replace("{search}", "");
- contents = contents.Replace("{tableinfo}", tinfo.ToString());
-
- tinfo.Clear();
- foreach (var item in schrows)
- {
- tinfo.AppendLine("");
- tinfo.AppendLine(string.Format("| {0} | ", item.no));
- tinfo.AppendLine(string.Format("{0} | ", item.seq));
- tinfo.AppendLine(string.Format("{0} | ", item.title));
- tinfo.AppendLine(string.Format("{0} | ", item.sw));
- tinfo.AppendLine(string.Format("{0} | ", item.ew));
- tinfo.AppendLine(string.Format("{0} | ", item.swa));
- tinfo.AppendLine(string.Format("{0} | ", item.ewa));
- tinfo.AppendLine(string.Format("{0} | ", item.progress));
- tinfo.AppendLine(string.Format("{0} | ", item.uid));
- tinfo.AppendLine(string.Format("{0} | ", item.memo));
- tinfo.AppendLine("
");
- }
- 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("");
- tbody.AppendLine($"| {item.idx} | ");
- tbody.AppendLine($"{item.status} | ");
- tbody.AppendLine($"{item.progress} | ");
- tbody.AppendLine($"{item.name} | ");
- tbody.AppendLine($"{item.reqstaff} | ");
- tbody.AppendLine($"{item.userManager} | ");
- tbody.AppendLine($"{item.cnt} | ");
- tbody.AppendLine($"{item.costo} | ");
- tbody.AppendLine($"{item.costn} | ");
- tbody.AppendLine($"{item.costo - item.costn} | ");
- tbody.AppendLine($"{item.orderno} | ");
- if (item.memo != null)
- tbody.AppendLine($"{item.memo} | ");
- else
- tbody.AppendLine($" | ");
-
-
-
- //if (item.description.Length > 10)
- // tbody.AppendLine($"{item.description.Substring(0, 10)}... | ");
- //else
- // tbody.AppendLine($"{item.description} | ");
- tbody.AppendLine("
");
- }
+ contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
}
-
- //아잍쳄이 없는경우
- if (itemcnt == 0)
+ else
{
- tbody.AppendLine("");
- tbody.AppendLine("| 1 | ");
- tbody.AppendLine("자료가 없습니다 | ");
- tbody.AppendLine("
");
+ contents = "404 - File Not Found
The requested file was not found: " + filePath + "
";
}
-
- 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")
+ contents,
+ System.Text.Encoding.UTF8,
+ "text/html")
};
return resp;
}
[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("");
- tbody.AppendLine($"| {item.idx} | ");
- tbody.AppendLine($"{item.status} | ");
- tbody.AppendLine($"{item.progress} | ");
- tbody.AppendLine($"{item.name} | ");
- tbody.AppendLine($"{item.reqstaff} | ");
- tbody.AppendLine($"{item.userManager} | ");
- tbody.AppendLine($"{item.cnt} | ");
- tbody.AppendLine($"{item.costo} | ");
- tbody.AppendLine($"{item.costn} | ");
- tbody.AppendLine($"{item.costo - item.costn} | ");
- tbody.AppendLine($"{item.orderno} | ");
- if (item.memo != null)
- tbody.AppendLine($"{item.memo} | ");
- else
- tbody.AppendLine($" | ");
-
-
-
- //if (item.description.Length > 10)
- // tbody.AppendLine($"{item.description.Substring(0, 10)}... | ");
- //else
- // tbody.AppendLine($"{item.description} | ");
- tbody.AppendLine("
");
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "로그인되지 않은 상태입니다."
+ });
}
+
+ string gcode = FCOMMON.info.Login.gcode;
+ string currentUserName = FCOMMON.info.Login.nameK ?? "";
+
+ var sql = @"
+ SELECT idx, status as 상태,asset as 자산번호, model as 장비모델, serial as 시리얼번호, Priority as 우선순위,
+ ReqSite as 요청국가, ReqPlant as 요청공장, ReqLine as 요청라인, ReqPackage as 요청부서패키지,
+ reqstaff as 요청자, process as 프로젝트공정, sdate as 시작일,edate as 완료일,ddate as 만료일, odate as 출고일, name as 프로젝트명,
+ dbo.getUserName( isnull(championid, userManager) ) as 프로젝트관리자,
+ dbo.getUserName (isnull(designid, usermain)) as 설계담당,
+ dbo.getUserName(isnull(epanelid, userhw2)) as 전장담당,
+ dbo.getUserName(isnull(softwareid, usersub)) as 프로그램담당,
+ crdue as 예산만기일, cramount as 예산,jasmin as 웹관리번호
+ FROM Projects
+ WHERE gcode = @gcode
+ AND status = @status
+ AND ISNULL(isdel, 0) = 0";
+
+ // 사용자 필터 적용
+ if (userFilter == "my" && !string.IsNullOrEmpty(currentUserName))
+ {
+ sql += @" AND (
+ dbo.getUserName(ISNULL(championid, userManager)) LIKE @userName
+ OR dbo.getUserName(ISNULL(designid, usermain)) LIKE @userName
+ OR dbo.getUserName(ISNULL(epanelid, userhw2)) LIKE @userName
+ OR dbo.getUserName(ISNULL(softwareid, usersub)) LIKE @userName
+ )";
+ }
+
+ sql += " ORDER BY wdate DESC";
+
+ var parameters = new
+ {
+ gcode = gcode,
+ status = status,
+ userName = userFilter == "my" ? "%" + currentUserName + "%" : ""
+ };
+
+ var projects = DBM.Query(sql, parameters);
+
+ return CreateJsonResponse(new
+ {
+ Success = true,
+ Data = projects,
+ CurrentUser = currentUserName
+ });
}
-
- //아잍쳄이 없는경우
- if (itemcnt == 0)
+ catch (Exception ex)
{
- tbody.AppendLine("");
- tbody.AppendLine("| 1 | ");
- tbody.AppendLine("자료가 없습니다 | ");
- tbody.AppendLine("
");
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "프로젝트 목록을 가져오는 중 오류가 발생했습니다: " + ex.Message
+ });
}
-
-
- 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()
- {
- Content = new StringContent(
- result.Content,
- System.Text.Encoding.UTF8,
- "text/html")
- };
-
- return resp;
}
[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("");
- tinfo.AppendLine(string.Format("| {0} | ", prjinfo.idx));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.status));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.progress));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.name));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.reqstaff));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.userManager));
- tinfo.AppendLine(string.Format("{0} | ", prjinfo.orderno));
- tinfo.AppendLine("
");
-
- 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("");
- tbody.AppendLine($"| {item.no} | ");
- tbody.AppendLine($"{item.ItemGroup} | ");
- tbody.AppendLine($"{item.ItemModel} | ");
- tbody.AppendLine($"{item.ItemUnit} | ");
- tbody.AppendLine($"{item.ItemName} | ");
- tbody.AppendLine($"{item.ItemSid} | ");
- tbody.AppendLine($"{item.ItemManu} | ");
- tbody.AppendLine($"{item.qty} | ");
- tbody.AppendLine($"{item.qtyn} | ");
- tbody.AppendLine($"{item.price} | ");
- tbody.AppendLine($"{item.amt} | ");
- tbody.AppendLine($"{item.amtn} | ");
- tbody.AppendLine($"{item.remark} | ");
- tbody.AppendLine($"{item.qtybuy} | ");
- tbody.AppendLine($"{item.qtyin} | ");
- tbody.AppendLine($"{item.bbuy} | ");
- tbody.AppendLine($"{item.bconfirm} | ");
- tbody.AppendLine("
");
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "로그인되지 않은 상태입니다."
+ });
}
+
+ if (id <= 0)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "유효하지 않은 프로젝트 ID입니다."
+ });
+ }
+
+ string gcode = FCOMMON.info.Login.gcode;
+
+ var sql = @"
+ SELECT idx, status as 상태,asset as 자산번호, model as 장비모델, serial as 시리얼번호, Priority as 우선순위,
+ReqSite as 요청국가, ReqPlant as 요청공장, ReqLine as 요청라인, ReqPackage as 요청부서패키지,
+reqstaff as 요청자, process as 프로젝트공정, sdate as 시작일,edate as 완료일,ddate as 만료일, odate as 출고일, name as 프로젝트명,
+ dbo.getUserName( isnull(championid, userManager) ) as 프로젝트관리자,
+ dbo.getUserName (isnull(designid, usermain)) as 설계담당,
+ dbo.getUserName(isnull(epanelid, userhw2)) as 전장담당,
+ dbo.getUserName(isnull(softwareid, usersub)) as 프로그램담당,
+ crdue as 예산만기일, cramount as 예산,jasmin as 웹관리번호
+ FROM Projects
+ WHERE idx = @idx AND gcode = @gcode AND ISNULL(isdel, 0) = 0";
+
+ var project = DBM.QuerySingleOrDefault(sql, new { idx = id, gcode = gcode });
+
+ if (project == null)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "프로젝트를 찾을 수 없습니다."
+ });
+ }
+
+ return CreateJsonResponse(new
+ {
+ Success = true,
+ Data = project
+ });
}
-
- //아잍쳄이 없는경우
- if (itemcnt == 0)
+ catch (Exception ex)
{
- tbody.AppendLine("");
- tbody.AppendLine("| 1 | ");
- tbody.AppendLine("자료가 없습니다 | ");
- tbody.AppendLine("
");
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "프로젝트 조회 중 오류가 발생했습니다: " + ex.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()
- {
- Content = new StringContent(
- result.Content,
- System.Text.Encoding.UTF8,
- "text/html")
- };
-
- return resp;
}
+ [HttpPost]
+ public HttpResponseMessage CreateProject([FromBody] ProjectModel project)
+ {
+ try
+ {
+ var currentUser = GetCurrentUser();
+ if (currentUser == null)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "로그인되지 않은 상태입니다."
+ });
+ }
+
+ if (string.IsNullOrWhiteSpace(project.프로젝트명))
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "프로젝트명을 입력해주세요."
+ });
+ }
+
+ string gcode = FCOMMON.info.Login.gcode;
+ string uid = FCOMMON.info.Login.no;
+
+ var sql = @"
+ INSERT INTO Projects (gcode, process, sdate, name, edate, ddate, odate, userManager, status, memo, wdate)
+ VALUES (@gcode, @process, @sdate, @name, @edate, @ddate, @odate, @userManager, @status, @memo, GETDATE())";
+
+ var parameters = new
+ {
+ gcode = gcode,
+ process = project.프로젝트공정 ?? "",
+ sdate = project.시작일,
+ name = project.프로젝트명,
+ edate = project.완료일,
+ ddate = project.만료일,
+ odate = project.출고일,
+ userManager = project.프로젝트관리자 ?? "",
+ status = project.상태 ?? "진행",
+ memo = project.memo ?? ""
+ };
+
+ DBM.Execute(sql, parameters);
+
+ return CreateJsonResponse(new
+ {
+ Success = true,
+ Message = "프로젝트가 추가되었습니다."
+ });
+ }
+ catch (Exception ex)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "프로젝트 추가 중 오류가 발생했습니다: " + ex.Message
+ });
+ }
+ }
+
+ [HttpPut]
+ public HttpResponseMessage UpdateProject([FromBody] ProjectModel project)
+ {
+ try
+ {
+ var currentUser = GetCurrentUser();
+ if (currentUser == null)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "로그인되지 않은 상태입니다."
+ });
+ }
+
+ if (project.idx <= 0)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "유효하지 않은 프로젝트 ID입니다."
+ });
+ }
+
+ if (string.IsNullOrWhiteSpace(project.프로젝트명))
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "프로젝트명을 입력해주세요."
+ });
+ }
+
+ string gcode = FCOMMON.info.Login.gcode;
+
+ // 먼저 프로젝트가 존재하는지 확인
+ var checkSql = "SELECT COUNT(*) FROM Projects WHERE idx = @idx AND gcode = @gcode AND ISNULL(isdel, 0) = 0";
+ var count = DBM.QuerySingle(checkSql, new { idx = project.idx, gcode = gcode });
+
+ if (count == 0)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "수정할 프로젝트를 찾을 수 없습니다."
+ });
+ }
+
+ var sql = @"
+ UPDATE Projects
+ SET process = @process, sdate = @sdate, name = @name, edate = @edate,
+ ddate = @ddate, odate = @odate, userManager = @userManager,
+ status = @status, memo = @memo
+ WHERE idx = @idx AND gcode = @gcode";
+
+ var parameters = new
+ {
+ idx = project.idx,
+ gcode = gcode,
+ process = project.프로젝트공정 ?? "",
+ sdate = project.시작일,
+ name = project.프로젝트명,
+ edate = project.완료일,
+ ddate = project.만료일,
+ odate = project.출고일,
+ userManager = project.프로젝트관리자 ?? "",
+ status = project.상태 ?? "진행",
+ memo = project.memo ?? ""
+ };
+
+ DBM.Execute(sql, parameters);
+
+ return CreateJsonResponse(new
+ {
+ Success = true,
+ Message = "프로젝트가 수정되었습니다."
+ });
+ }
+ catch (Exception ex)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "프로젝트 수정 중 오류가 발생했습니다: " + ex.Message
+ });
+ }
+ }
+
+ [HttpDelete]
+ public HttpResponseMessage DeleteProject(int id)
+ {
+ try
+ {
+ var currentUser = GetCurrentUser();
+ if (currentUser == null)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "로그인되지 않은 상태입니다."
+ });
+ }
+
+ if (id <= 0)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "유효하지 않은 프로젝트 ID입니다."
+ });
+ }
+
+ string gcode = FCOMMON.info.Login.gcode;
+
+ // 먼저 프로젝트가 존재하는지 확인
+ var checkSql = "SELECT COUNT(*) FROM Projects WHERE idx = @idx AND gcode = @gcode AND ISNULL(isdel, 0) = 0";
+ var count = DBM.QuerySingle(checkSql, new { idx = id, gcode = gcode });
+
+ if (count == 0)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "삭제할 프로젝트를 찾을 수 없습니다."
+ });
+ }
+
+ var sql = "UPDATE Projects SET isdel = 1 WHERE idx = @idx AND gcode = @gcode";
+ DBM.Execute(sql, new { idx = id, gcode = gcode });
+
+ return CreateJsonResponse(new
+ {
+ Success = true,
+ Message = "프로젝트가 삭제되었습니다."
+ });
+ }
+ catch (Exception ex)
+ {
+ return CreateJsonResponse(new
+ {
+ Success = false,
+ Message = "프로젝트 삭제 중 오류가 발생했습니다: " + ex.Message
+ });
+ }
+ }
+
+ private object GetCurrentUser()
+ {
+ if (string.IsNullOrEmpty(FCOMMON.info.Login.no)) return null;
+ else return FCOMMON.info.Login;
+ }
+
+ private HttpResponseMessage CreateJsonResponse(object data)
+ {
+ var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore,
+ DateFormatString = "yyyy-MM-dd HH:mm:ss"
+ });
+
+ return new HttpResponseMessage()
+ {
+ Content = new StringContent(
+ json,
+ System.Text.Encoding.UTF8,
+ "application/json")
+ };
+ }
}
}
diff --git a/Project/Web/Model/ProjectModel.cs b/Project/Web/Model/ProjectModel.cs
new file mode 100644
index 0000000..2987bc7
--- /dev/null
+++ b/Project/Web/Model/ProjectModel.cs
@@ -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: 삭제)
+ }
+}
\ No newline at end of file
diff --git a/Project/Web/wwwroot/Project/index.html b/Project/Web/wwwroot/Project/index.html
new file mode 100644
index 0000000..913713b
--- /dev/null
+++ b/Project/Web/wwwroot/Project/index.html
@@ -0,0 +1,1077 @@
+
+
+
+
+
+ 프로젝트 관리
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
프로젝트 추가
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
삭제 확인
+
+
선택한 프로젝트를 삭제하시겠습니까?
이 작업은 되돌릴 수 없습니다.
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file