업무일지 메일 발송 로직에서. 휴일 체크 루틴 버그 수정
This commit is contained in:
199
SubProject/WebServer/Controller/CustomerController.cs
Normal file
199
SubProject/WebServer/Controller/CustomerController.cs
Normal file
@@ -0,0 +1,199 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebServer.OWIN
|
||||
|
||||
{
|
||||
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 EEEntities();
|
||||
var rows = 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 EEEntities();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var rows = db.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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
93
SubProject/WebServer/Controller/HomeController.cs
Normal file
93
SubProject/WebServer/Controller/HomeController.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebServer
|
||||
{
|
||||
public class HomeController : 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 Login()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
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;
|
||||
}
|
||||
|
||||
[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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
148
SubProject/WebServer/Controller/ItemController.cs
Normal file
148
SubProject/WebServer/Controller/ItemController.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebServer
|
||||
{
|
||||
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();
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntities();
|
||||
var rows = db.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.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 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
290
SubProject/WebServer/Controller/JobreportController.cs
Normal file
290
SubProject/WebServer/Controller/JobreportController.cs
Normal file
@@ -0,0 +1,290 @@
|
||||
using Microsoft.Owin;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebServer
|
||||
{
|
||||
public class JobreportController : BaseController
|
||||
{
|
||||
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string Add(FormCollection tbpdate)
|
||||
{
|
||||
var vals = Request.GetQueryNameValuePairs();
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
[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 EEEntities();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var ed = DateTime.Now.ToShortDateString();
|
||||
var rows = db.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 EEEntities();
|
||||
var sd = DateTime.Now.ToShortDateString();
|
||||
var rows = db.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()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
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 EEEntities();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var ed = DateTime.Now.ToShortDateString();
|
||||
var rows = db.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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
467
SubProject/WebServer/Controller/ProjectController.cs
Normal file
467
SubProject/WebServer/Controller/ProjectController.cs
Normal file
@@ -0,0 +1,467 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebServer
|
||||
{
|
||||
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 EEEntities();
|
||||
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 EEEntities();
|
||||
var prjinfo = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == project).FirstOrDefault();
|
||||
var schrows = 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 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 EEEntities();
|
||||
|
||||
|
||||
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.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> </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 detail(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 itemcnt = 0;
|
||||
//if (searchkey.isEmpty() == false)
|
||||
{
|
||||
|
||||
var db = new EEEntities();
|
||||
|
||||
|
||||
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.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> </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());
|
||||
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)
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
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)
|
||||
{
|
||||
|
||||
var db = new EEEntities();
|
||||
|
||||
var prjinfo = 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 rows = db.ProjectsPart.Where(t => t.Project == id).OrderBy(t=>t.no);
|
||||
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
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>");
|
||||
}
|
||||
}
|
||||
|
||||
//아잍쳄이 없는경우
|
||||
if (itemcnt == 0)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine("<th scope='row'>1</th>");
|
||||
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
208
SubProject/WebServer/Controller/PurchaseController.cs
Normal file
208
SubProject/WebServer/Controller/PurchaseController.cs
Normal file
@@ -0,0 +1,208 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebServer
|
||||
{
|
||||
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();
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntities();
|
||||
var rows = db.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.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 EEEntities();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var rows = db.vPurchase.AsNoTracking().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.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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
114
SubProject/WebServer/Controller/ResourceController.cs
Normal file
114
SubProject/WebServer/Controller/ResourceController.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
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 WebServer
|
||||
{
|
||||
public class ResourceController : BaseController
|
||||
{
|
||||
[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;
|
||||
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
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
64
SubProject/WebServer/Controller/ResultController.cs
Normal file
64
SubProject/WebServer/Controller/ResultController.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebServer
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
63
SubProject/WebServer/Controller/SettingController.cs
Normal file
63
SubProject/WebServer/Controller/SettingController.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebServer
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user