휴가 신청 삭제시 로그파일에 기록되도록 함
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="38" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:MailForm" ZOrder="1" X="222" Y="158" Height="305" Width="200" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailForm" ZOrder="1" X="198" Y="160" Height="305" Width="200" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailData" ZOrder="2" X="456" Y="157" Height="305" Width="197" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailAuto" ZOrder="11" X="711" Y="160" Height="305" Width="199" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:vMailingProjectSchedule" ZOrder="10" X="204" Y="490" Height="305" Width="289" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Project.Dialog
|
||||
webView21.CoreWebView2.WebMessageReceived += WebView2_WebMessageReceived;
|
||||
|
||||
// OWIN 서버의 Login 페이지로 연결
|
||||
webView21.Source = new Uri($"{Pub.setting.WebServiceURL}/Home/Login");
|
||||
webView21.Source = new Uri($"{Pub.setting.WebServiceURL}/home/login");
|
||||
label1.Visible = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -283,22 +283,6 @@
|
||||
<Compile Include="fSystemCheck.Designer.cs">
|
||||
<DependentUpon>fSystemCheck.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Web\Controller\BaseController.cs" />
|
||||
<Compile Include="Web\Controller\APIController.cs" />
|
||||
<Compile Include="Web\Controller\DashBoardController.cs" />
|
||||
<Compile Include="Web\Controller\CommonController.cs" />
|
||||
<Compile Include="Web\Controller\TodoController.cs" />
|
||||
<Compile Include="Web\Controller\KuntaeController.cs" />
|
||||
<Compile Include="Web\Controller\ManualController.cs" />
|
||||
<Compile Include="Web\Controller\ProjectController.cs" />
|
||||
<Compile Include="Web\Controller\JobreportController.cs" />
|
||||
<Compile Include="Web\Controller\CustomerController.cs" />
|
||||
<Compile Include="Web\Controller\PurchaseController.cs" />
|
||||
<Compile Include="Web\Controller\ItemController.cs" />
|
||||
<Compile Include="Web\Controller\HomeController.cs" />
|
||||
<Compile Include="Web\Controller\ResourceController.cs" />
|
||||
<Compile Include="Web\Controller\ResultController.cs" />
|
||||
<Compile Include="Web\Controller\SettingController.cs" />
|
||||
<Compile Include="CResult.cs" />
|
||||
<Compile Include="DataSet1.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -419,6 +403,23 @@
|
||||
<Compile Include="Manager\ModelManager.cs" />
|
||||
<Compile Include="MessageWindow.cs" />
|
||||
<Compile Include="MethodExtentions.cs" />
|
||||
<Compile Include="Web\Controllers\APIController.cs" />
|
||||
<Compile Include="Web\Controllers\BaseController.cs" />
|
||||
<Compile Include="Web\Controllers\CommonController.cs" />
|
||||
<Compile Include="Web\Controllers\CustomerController.cs" />
|
||||
<Compile Include="Web\Controllers\DashBoardController.cs" />
|
||||
<Compile Include="Web\Controllers\HomeController.cs" />
|
||||
<Compile Include="Web\Controllers\ItemController.cs" />
|
||||
<Compile Include="Web\Controllers\JobreportController.cs" />
|
||||
<Compile Include="Web\Controllers\KuntaeController.cs" />
|
||||
<Compile Include="Web\Controllers\ManualController.cs" />
|
||||
<Compile Include="Web\Controllers\ProjectController.cs" />
|
||||
<Compile Include="Web\Controllers\PurchaseController.cs" />
|
||||
<Compile Include="Web\Controllers\ReactController.cs" />
|
||||
<Compile Include="Web\Controllers\ResourceController.cs" />
|
||||
<Compile Include="Web\Controllers\ResultController.cs" />
|
||||
<Compile Include="Web\Controllers\SettingController.cs" />
|
||||
<Compile Include="Web\Controllers\TodoController.cs" />
|
||||
<Compile Include="Web\Model\PageModel.cs" />
|
||||
<Compile Include="Web\Model\ProjectModel.cs" />
|
||||
<Compile Include="Web\Model\TodoModel.cs" />
|
||||
@@ -670,6 +671,21 @@
|
||||
<Content Include="Web\wwwroot\Project\index.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Web\wwwroot\react\LoginApp.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\react\TestApp.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\react\DashboardApp.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\react\CommonNavigation.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\react\CommonCode.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\css\common.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -706,6 +722,36 @@
|
||||
<None Include="Web\wwwroot\login.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\react\JobReport.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\react\Kuntae.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\react\Todo.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\react\Project.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\lib\js\react.development.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\lib\js\react-dom.development.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\lib\js\babel.min.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\lib\css\tailwind.min.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\lib\js\tailwind-config.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Web\wwwroot\react\DevWarning.jsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
|
||||
|
||||
@@ -52,13 +52,13 @@ namespace Project.Manager
|
||||
int lineCount = 0;
|
||||
string buffer = string.Empty;
|
||||
|
||||
Pub.log.Add("ModelData Load : " + model.ToString() + "fn=" + filename);
|
||||
FCOMMON.Pub.log.Add("ModelData Load : " + model.ToString() + "fn=" + filename);
|
||||
|
||||
//read file
|
||||
var fi = new FileInfo(filename);
|
||||
if (fi.Exists == false)
|
||||
{
|
||||
Pub.log.AddE(string.Format("▣ No Data",model));
|
||||
FCOMMON.Pub.log.AddE(string.Format("▣ No Data",model));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Project.Manager
|
||||
catch (Exception ex)
|
||||
{
|
||||
buffer = string.Empty;
|
||||
Pub.log.AddE(string.Format("ItemData Error File={0},Message={1}", filename, ex.Message));
|
||||
FCOMMON.Pub.log.AddE(string.Format("ItemData Error File={0},Message={1}", filename, ex.Message));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Project.Manager
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Pub.log.AddE("Item Load Error:" + ex.Message);
|
||||
FCOMMON.Pub.log.AddE("Item Load Error:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Project.Manager
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Pub.log.AddE("Load Item file" + ex.Message);
|
||||
FCOMMON.Pub.log.AddE("Load Item file" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Project.Manager
|
||||
sb.AppendLine(dt.TableName + " : " + dt.Rows.Count.ToString() + "건");
|
||||
}
|
||||
|
||||
Pub.log.AddI(sb.ToString());
|
||||
FCOMMON.Pub.log.AddI(sb.ToString());
|
||||
}
|
||||
|
||||
public void Save()
|
||||
@@ -223,12 +223,12 @@ namespace Project.Manager
|
||||
try
|
||||
{
|
||||
System.IO.File.WriteAllText(fn[(int)model], data.ToString(), System.Text.Encoding.Default);
|
||||
Pub.log.AddAT("Save "+ model.ToString()+" Parameter - OK");
|
||||
FCOMMON.Pub.log.AddAT("Save "+ model.ToString()+" Parameter - OK");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.MsgE("Save Error\r\n" + ex.Message);
|
||||
Pub.log.AddE("Save Error :: " + ex.Message);
|
||||
FCOMMON.Pub.log.AddE("Save Error :: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,8 +103,8 @@ namespace Project
|
||||
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
string emsg = "Fatal Error(UHE)\n\n" + e.ExceptionObject.ToString();
|
||||
Pub.log.AddE(emsg);
|
||||
Pub.log.Flush();
|
||||
FCOMMON.Pub.log.AddE(emsg);
|
||||
FCOMMON.Pub.log.Flush();
|
||||
Util.SaveBugReport(emsg);
|
||||
var f = new fErrorException(emsg);
|
||||
f.ShowDialog();
|
||||
@@ -114,8 +114,8 @@ namespace Project
|
||||
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
||||
{
|
||||
string emsg = "Fatal Error(ATE)\n\n" + e.Exception.ToString();
|
||||
Pub.log.AddE(emsg);
|
||||
Pub.log.Flush();
|
||||
FCOMMON.Pub.log.AddE(emsg);
|
||||
FCOMMON.Pub.log.Flush();
|
||||
Util.SaveBugReport(emsg);
|
||||
var f = new fErrorException(emsg);
|
||||
f.ShowDialog();
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("25.07.14.1050")]
|
||||
[assembly: AssemblyFileVersion("25.07.14.1050")]
|
||||
[assembly: AssemblyVersion("25.10.17.1600")]
|
||||
[assembly: AssemblyFileVersion("25.10.17.1600")]
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Project
|
||||
public static UserSetting uSetting; //user setting
|
||||
public static Setting setting; //global setting
|
||||
|
||||
public static arUtil.Log log; //global logging system
|
||||
|
||||
|
||||
public static DateTime LastInputTime = DateTime.Now;
|
||||
public static CResult Result = new CResult();
|
||||
@@ -185,7 +185,7 @@ namespace Project
|
||||
uSetting.Load();
|
||||
|
||||
//log
|
||||
log = new arUtil.Log();
|
||||
FCOMMON.Pub.log = new arUtil.Log();
|
||||
|
||||
//clear login info
|
||||
FCOMMON.info.Login = new FCOMMON.info.sUserInfo();
|
||||
@@ -234,7 +234,7 @@ namespace Project
|
||||
|
||||
InitWebView = 1;
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
InitWebView = 2;
|
||||
@@ -375,7 +375,7 @@ namespace Project
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Pub.log.AddE(ex.Message);
|
||||
FCOMMON.Pub.log.AddE(ex.Message);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -409,7 +409,7 @@ namespace Project
|
||||
var fi = new System.IO.FileInfo(file);
|
||||
if (!fi.Exists)
|
||||
{
|
||||
Pub.log.AddE("Run Error : " + file);
|
||||
FCOMMON.Pub.log.AddE("Run Error : " + file);
|
||||
return false;
|
||||
}
|
||||
System.Diagnostics.Process prc = new System.Diagnostics.Process();
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class APIController : BaseController
|
||||
{
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Getdata()
|
||||
{
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
var sql = string.Empty;
|
||||
var p_sql = getParams.Where(t => t.Key == "sql").FirstOrDefault();
|
||||
if (p_sql.Key.isEmpty() == false) sql = p_sql.Value;
|
||||
else
|
||||
{
|
||||
var p_table = getParams.Where(t => t.Key == "table").FirstOrDefault();
|
||||
var p_gcode = getParams.Where(t => t.Key == "gcode").FirstOrDefault();
|
||||
var p_where = getParams.Where(t => t.Key == "w").FirstOrDefault();
|
||||
var p_order = getParams.Where(t => t.Key == "o").FirstOrDefault();
|
||||
sql = "select * from {0} where gcode = '{gcode}'";
|
||||
sql = string.Format(sql, p_table.Value, p_gcode.Value);
|
||||
if (p_where.Key != null) sql += " and " + p_where.Value;
|
||||
if (p_order.Key != null) sql += " order by " + p_order.Value;
|
||||
}
|
||||
|
||||
sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode);
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs; // "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!";
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Gettable()
|
||||
{
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
var sql = string.Empty;
|
||||
var p_sql = getParams.Where(t => t.Key == "sql").FirstOrDefault();
|
||||
if (p_sql.Key.isEmpty() == false) sql = p_sql.Value;
|
||||
else
|
||||
{
|
||||
var p_table = getParams.Where(t => t.Key == "table").FirstOrDefault();
|
||||
var p_gcode = getParams.Where(t => t.Key == "gcode").FirstOrDefault();
|
||||
var p_where = getParams.Where(t => t.Key == "w").FirstOrDefault();
|
||||
var p_order = getParams.Where(t => t.Key == "o").FirstOrDefault();
|
||||
sql = "select * from {0} where gcode = '{gcode}'";
|
||||
sql = string.Format(sql, p_table.Value, p_gcode.Value);
|
||||
if (p_where.Key != null) sql += " and " + p_where.Value;
|
||||
if (p_order.Key != null) sql += " order by " + p_order.Value;
|
||||
}
|
||||
|
||||
|
||||
sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode);
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!";
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var contents = result.Content;
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,267 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Project.Web.Model;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public struct MethodResult : IEquatable<MethodResult>
|
||||
{
|
||||
public string Content;
|
||||
public byte[] Contentb;
|
||||
public string Redirecturl;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is MethodResult))
|
||||
return false;
|
||||
|
||||
return Equals((MethodResult)obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (Contentb == null)
|
||||
return Content.GetHashCode() ^ Redirecturl.GetHashCode();
|
||||
else
|
||||
return Content.GetHashCode() ^ Redirecturl.GetHashCode() ^ Contentb.GetHexString().GetHashCode();
|
||||
|
||||
}
|
||||
|
||||
public bool Equals(MethodResult other)
|
||||
{
|
||||
if (Content != other.Content)
|
||||
return false;
|
||||
|
||||
if (Redirecturl != other.Redirecturl)
|
||||
return false;
|
||||
|
||||
return Contentb == other.Contentb;
|
||||
}
|
||||
|
||||
|
||||
public static bool operator ==(MethodResult point1, MethodResult point2)
|
||||
{
|
||||
return point1.Equals(point2);
|
||||
}
|
||||
|
||||
public static bool operator !=(MethodResult point1, MethodResult point2)
|
||||
{
|
||||
return !point1.Equals(point2);
|
||||
}
|
||||
}
|
||||
|
||||
sealed class PostRequest : Attribute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class BaseController : ApiController
|
||||
{
|
||||
public string QueryString { get; set; }
|
||||
public string PostData { get; set; }
|
||||
public string ParamData { get; set; }
|
||||
|
||||
protected string Trig_Ctrl { get; set; }
|
||||
protected string Trig_func { get; set; }
|
||||
|
||||
public PageModel GetGlobalModel()
|
||||
{
|
||||
var config = RequestContext.Configuration;
|
||||
var routeData = config.Routes.GetRouteData(Request).Values.ToList();
|
||||
var name_ctrl = routeData[0].Value.ToString();
|
||||
var name_action = routeData[1].Value.ToString();
|
||||
|
||||
|
||||
return new PageModel
|
||||
{
|
||||
RouteData = routeData,
|
||||
urlcontrol = name_ctrl,
|
||||
urlaction = name_action
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public MethodResult View(bool nosubdir=false)
|
||||
{
|
||||
var config = RequestContext.Configuration;
|
||||
if (config != null)
|
||||
{
|
||||
var routeData = config.Routes.GetRouteData(Request).Values.ToList();
|
||||
var name_ctrl = routeData[0].Value.ToString();
|
||||
if (nosubdir) name_ctrl = string.Empty;
|
||||
var name_action = routeData[1].Value.ToString();
|
||||
return View(name_ctrl, name_action);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Trig_Ctrl + "/" + Trig_func);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void ApplyCommonValue(ref string contents)
|
||||
{
|
||||
//메뉴 푸터 - 개발자 정보
|
||||
if (contents.Contains("{title}"))
|
||||
contents = contents.Replace("{title}", FCOMMON.info.Login.gcode + " Groupware");
|
||||
|
||||
}
|
||||
|
||||
public MethodResult View(string Controller, string Action, Boolean applydefaultview = true)
|
||||
{
|
||||
var retval = new MethodResult();
|
||||
|
||||
if (Action.IndexOf(".") == -1)
|
||||
Action += ".html"; //기본값 html 을 넣는다
|
||||
|
||||
var file = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", Controller, Action);
|
||||
|
||||
var contents = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(file) == false)
|
||||
{
|
||||
//error 폴더의 404.html 파일을 찾는다.
|
||||
var file404 = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", "Error", "404.html");
|
||||
if (System.IO.File.Exists(file404))
|
||||
{
|
||||
contents = System.IO.File.ReadAllText(file404, System.Text.Encoding.UTF8);
|
||||
contents = contents.Replace("{errorfilename}", file);
|
||||
}
|
||||
|
||||
else
|
||||
contents = "ERROR CODE - 404 (NOT FOUND) <br />" + file;
|
||||
|
||||
Console.WriteLine("view File not found : " + file);
|
||||
}
|
||||
else
|
||||
{
|
||||
//디폴트뷰의 내용을 가져온다 (있다면 적용한다)
|
||||
if (applydefaultview)
|
||||
{
|
||||
//뷰파일이 있다면 그것을 적용한다
|
||||
var laytoutfile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", "Layout", "default.html");
|
||||
if (System.IO.File.Exists(laytoutfile))
|
||||
contents = System.IO.File.ReadAllText(laytoutfile, System.Text.Encoding.UTF8);
|
||||
|
||||
var fileContents = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8);
|
||||
if (String.IsNullOrEmpty(contents)) contents = fileContents;
|
||||
else contents = contents.Replace("{contents}", fileContents);
|
||||
}
|
||||
else
|
||||
{
|
||||
//해당 뷰를 가져와서 반환한다
|
||||
contents = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//시스템변수 replace
|
||||
contents = contents.Replace("{param_control}", Trig_Ctrl);
|
||||
contents = contents.Replace("{param_function}", Trig_func);
|
||||
|
||||
retval.Content = contents;
|
||||
return retval;
|
||||
}
|
||||
public MethodResult View(string viewfilename, Boolean applydefaultview = true)
|
||||
{
|
||||
var retval = new MethodResult();
|
||||
|
||||
if (viewfilename.IndexOf(".") == -1)
|
||||
viewfilename += ".html"; //기본값 html 을 넣는다
|
||||
|
||||
var file = AppDomain.CurrentDomain.BaseDirectory + "View" + viewfilename.Replace("/", "\\");
|
||||
|
||||
var contents = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(file) == false)
|
||||
{
|
||||
//error 폴더의 404.html 파일을 찾는다.
|
||||
var file404 = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", "Error", "404.html");
|
||||
if (System.IO.File.Exists(file404))
|
||||
{
|
||||
contents = System.IO.File.ReadAllText(file404, System.Text.Encoding.UTF8);
|
||||
contents = contents.Replace("{errorfilename}", file);
|
||||
}
|
||||
|
||||
else
|
||||
contents = "ERROR CODE - 404 (NOT FOUND) <br />" + file;
|
||||
|
||||
Console.WriteLine("view File not found : " + file);
|
||||
}
|
||||
else
|
||||
{
|
||||
//디폴트뷰의 내용을 가져온다 (있다면 적용한다)
|
||||
if (applydefaultview)
|
||||
{
|
||||
//뷰파일이 있다면 그것을 적용한다
|
||||
var laytoutfile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", "Layout", "default.html");
|
||||
if (System.IO.File.Exists(laytoutfile))
|
||||
contents = System.IO.File.ReadAllText(laytoutfile, System.Text.Encoding.UTF8);
|
||||
|
||||
var fileContents = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8);
|
||||
if (String.IsNullOrEmpty(contents)) contents = fileContents;
|
||||
else contents = contents.Replace("{contents}", fileContents);
|
||||
}
|
||||
else
|
||||
{
|
||||
//해당 뷰를 가져와서 반환한다
|
||||
contents = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//콘텐츠내의 file 을 찾아서 처리한다. ; 정규식의 처리속도가 느릴듯하여, 그냥 처리해본다
|
||||
while (true)
|
||||
{
|
||||
var fileindexS = contents.IndexOf("{file:");
|
||||
if (fileindexS == -1) break;
|
||||
var fileindexE = contents.IndexOf("}", fileindexS);
|
||||
if (fileindexE == -1) break;
|
||||
if (fileindexE <= fileindexS + 5) break;
|
||||
var inlinestr = contents.Substring(fileindexS, fileindexE - fileindexS + 1);
|
||||
var filename = contents.Substring(fileindexS + 7, fileindexE - fileindexS - 8);
|
||||
var load_file = String.Concat(AppDomain.CurrentDomain.BaseDirectory, "View", "\\", filename.Replace("/", "\\"));
|
||||
load_file = load_file.Replace("\\\\", "\\");
|
||||
String fileContents;// = String.Empty;
|
||||
|
||||
Console.WriteLine("file impot : " + load_file);
|
||||
if (System.IO.File.Exists(load_file))
|
||||
{
|
||||
fileContents = System.IO.File.ReadAllText(load_file, System.Text.Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
fileContents = "{FileNotFound:" + filename + "}"; //파일이없다면 해당 부분은 오류 처리한다.
|
||||
}
|
||||
contents = contents.Replace(inlinestr, fileContents);
|
||||
}
|
||||
|
||||
//시스템변수 replace
|
||||
contents = contents.Replace("{param_control}", Trig_Ctrl);
|
||||
contents = contents.Replace("{param_function}", Trig_func);
|
||||
|
||||
retval.Content = contents;
|
||||
return retval;
|
||||
}
|
||||
protected class Parameter
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
public Parameter(string key_, string value_)
|
||||
{
|
||||
Key = key_;
|
||||
Value = value_;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,454 +0,0 @@
|
||||
using FCM0000;
|
||||
using Microsoft.Owin;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class CommonController : BaseController
|
||||
{
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetList(string grp=null)
|
||||
{
|
||||
var sql = string.Empty;
|
||||
|
||||
//코드그룹이 없다면 전체 목록을 조회할 수 있도록 99를 조회한다
|
||||
if (string.IsNullOrEmpty(grp)) grp = "99";
|
||||
|
||||
// 특정 그룹의 데이터만 가져옴
|
||||
sql = "select *" +
|
||||
" from common" +
|
||||
" where gcode = @gcode" +
|
||||
" and grp = @grp" +
|
||||
" order by code,svalue";
|
||||
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
|
||||
if (!string.IsNullOrEmpty(grp))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("grp", grp);
|
||||
}
|
||||
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
// 직접 파일을 읽어서 반환
|
||||
var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Common.html");
|
||||
var contents = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 파일이 없으면 404 에러 페이지 또는 기본 메시지
|
||||
contents = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
|
||||
}
|
||||
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
contents,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage Save([FromBody] CommonModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var sql = string.Empty;
|
||||
var cmd = new System.Data.SqlClient.SqlCommand();
|
||||
cmd.Connection = cn;
|
||||
|
||||
if (model.idx > 0)
|
||||
{
|
||||
// 업데이트
|
||||
sql = @"UPDATE common SET
|
||||
grp = @grp,
|
||||
code = @code,
|
||||
svalue = @svalue,
|
||||
ivalue = @ivalue,
|
||||
fvalue = @fvalue,
|
||||
svalue2 = @svalue2,
|
||||
memo = @memo,
|
||||
wuid = @wuid,
|
||||
wdate = GETDATE()
|
||||
WHERE idx = @idx AND gcode = @gcode";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 신규 추가
|
||||
sql = @"INSERT INTO common (gcode, grp, code, svalue, ivalue, fvalue, svalue2, memo, wuid, wdate)
|
||||
VALUES (@gcode, @grp, @code, @svalue, @ivalue, @fvalue, @svalue2, @memo, @wuid, GETDATE())";
|
||||
}
|
||||
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
cmd.Parameters.AddWithValue("@grp", model.grp ?? "");
|
||||
cmd.Parameters.AddWithValue("@code", model.code ?? "");
|
||||
cmd.Parameters.AddWithValue("@svalue", model.svalue ?? "");
|
||||
cmd.Parameters.AddWithValue("@ivalue", model.ivalue);
|
||||
cmd.Parameters.AddWithValue("@fvalue", model.fvalue);
|
||||
cmd.Parameters.AddWithValue("@svalue2", model.svalue2 ?? "");
|
||||
cmd.Parameters.AddWithValue("@memo", model.memo ?? "");
|
||||
cmd.Parameters.AddWithValue("@wuid", FCOMMON.info.Login.no);
|
||||
|
||||
if (model.idx > 0)
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@idx", model.idx);
|
||||
}
|
||||
|
||||
cn.Open();
|
||||
var result = cmd.ExecuteNonQuery();
|
||||
cn.Close();
|
||||
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var response = new
|
||||
{
|
||||
Success = result > 0,
|
||||
Message = result > 0 ? "저장되었습니다." : "저장에 실패했습니다."
|
||||
};
|
||||
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
Success = false,
|
||||
Message = "오류가 발생했습니다: " + ex.Message
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage Delete([FromBody] DeleteModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var sql = "DELETE FROM common WHERE idx = @idx AND gcode = @gcode";
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
|
||||
cmd.Parameters.AddWithValue("@idx", model.idx);
|
||||
cmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
|
||||
cn.Open();
|
||||
var result = cmd.ExecuteNonQuery();
|
||||
cn.Close();
|
||||
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var response = new
|
||||
{
|
||||
Success = result > 0,
|
||||
Message = result > 0 ? "삭제되었습니다." : "삭제에 실패했습니다."
|
||||
};
|
||||
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
Success = false,
|
||||
Message = "오류가 발생했습니다: " + ex.Message
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetGroups()
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = "select code, svalue, memo from common WITH (nolock) " +
|
||||
"where gcode = @gcode and grp = '99' " +
|
||||
"order by code";
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
Message = ex.Message,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage InitializeGroups()
|
||||
{
|
||||
try
|
||||
{
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
|
||||
// 기본 그룹코드들 정의
|
||||
var defaultGroups = new[]
|
||||
{
|
||||
new { code = "01", svalue = "부서코드" },
|
||||
new { code = "02", svalue = "직급코드" },
|
||||
new { code = "03", svalue = "공정코드" },
|
||||
new { code = "04", svalue = "품목분류" },
|
||||
new { code = "05", svalue = "업체분류" },
|
||||
new { code = "06", svalue = "제조공정" },
|
||||
new { code = "07", svalue = "장비제조" },
|
||||
new { code = "08", svalue = "장비모델" },
|
||||
new { code = "09", svalue = "장비기술" },
|
||||
new { code = "99", svalue = "기타" }
|
||||
};
|
||||
|
||||
cn.Open();
|
||||
|
||||
int insertedCount = 0;
|
||||
foreach (var group in defaultGroups)
|
||||
{
|
||||
// 이미 존재하는지 확인
|
||||
var checkSql = "SELECT COUNT(*) FROM common WHERE gcode = @gcode AND grp = '99' AND code = @code";
|
||||
var checkCmd = new System.Data.SqlClient.SqlCommand(checkSql, cn);
|
||||
checkCmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
checkCmd.Parameters.AddWithValue("@code", group.code);
|
||||
|
||||
var exists = (int)checkCmd.ExecuteScalar() > 0;
|
||||
checkCmd.Dispose();
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
// 새로 추가
|
||||
var insertSql = @"INSERT INTO common (gcode, grp, code, svalue, ivalue, fvalue, svalue2, memo, wuid, wdate)
|
||||
VALUES (@gcode, '99', @code, @svalue, 0, 0.0, '', '코드그룹 정의', @wuid, GETDATE())";
|
||||
var insertCmd = new System.Data.SqlClient.SqlCommand(insertSql, cn);
|
||||
insertCmd.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
insertCmd.Parameters.AddWithValue("@code", group.code);
|
||||
insertCmd.Parameters.AddWithValue("@svalue", group.svalue);
|
||||
insertCmd.Parameters.AddWithValue("@wuid", FCOMMON.info.Login.no);
|
||||
|
||||
insertCmd.ExecuteNonQuery();
|
||||
insertCmd.Dispose();
|
||||
insertedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
cn.Close();
|
||||
cn.Dispose();
|
||||
|
||||
var response = new
|
||||
{
|
||||
Success = true,
|
||||
Message = $"그룹코드 초기화 완료. {insertedCount}개 추가됨."
|
||||
};
|
||||
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
Success = false,
|
||||
Message = "오류가 발생했습니다: " + ex.Message
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetNavigationMenu()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 메뉴 정보를 하드코딩하거나 데이터베이스에서 가져올 수 있습니다.
|
||||
// 향후 사용자 권한에 따른 메뉴 표시/숨김 기능도 추가 가능합니다.
|
||||
var menuItems = new[]
|
||||
{
|
||||
new {
|
||||
key = "dashboard",
|
||||
title = "대시보드",
|
||||
url = "/Dashboard/",
|
||||
icon = "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z",
|
||||
isVisible = true,
|
||||
sortOrder = 1
|
||||
},
|
||||
new {
|
||||
key = "common",
|
||||
title = "공용코드",
|
||||
url = "/Common",
|
||||
icon = "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z",
|
||||
isVisible = true,
|
||||
sortOrder = 2
|
||||
},
|
||||
new {
|
||||
key = "jobreport",
|
||||
title = "업무일지",
|
||||
url = "/Jobreport/",
|
||||
icon = "M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2",
|
||||
isVisible = true,
|
||||
sortOrder = 3
|
||||
},
|
||||
new {
|
||||
key = "kuntae",
|
||||
title = "근태관리",
|
||||
url = "/Kuntae/",
|
||||
icon = "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z",
|
||||
isVisible = true,
|
||||
sortOrder = 4
|
||||
},
|
||||
new {
|
||||
key = "todo",
|
||||
title = "할일관리",
|
||||
url = "/Todo/",
|
||||
icon = "M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2M12 12l2 2 4-4",
|
||||
isVisible = true,
|
||||
sortOrder = 5
|
||||
},
|
||||
new {
|
||||
key = "project",
|
||||
title = "프로젝트",
|
||||
url = "/Project/",
|
||||
icon = "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10",
|
||||
isVisible = true,
|
||||
sortOrder = 6
|
||||
}
|
||||
};
|
||||
|
||||
// 사용자 권한에 따른 메뉴 필터링 로직을 여기에 추가할 수 있습니다.
|
||||
// 예: var userLevel = FCOMMON.info.Login.level;
|
||||
// if (userLevel < 5) { /* 특정 메뉴 숨김 */ }
|
||||
|
||||
var response = new
|
||||
{
|
||||
Success = true,
|
||||
Data = menuItems,
|
||||
Message = "메뉴 정보를 성공적으로 가져왔습니다."
|
||||
};
|
||||
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
Success = false,
|
||||
Data = (object)null,
|
||||
Message = "메뉴 정보를 가져오는 중 오류가 발생했습니다: " + ex.Message
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
private HttpResponseMessage CreateJsonResponse(object data)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
json,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class DeleteModel
|
||||
{
|
||||
public int idx { get; set; }
|
||||
}
|
||||
|
||||
public class CommonModel
|
||||
{
|
||||
|
||||
|
||||
public int idx { get; set; } // 데이터고유번호
|
||||
public string gcode { get; set; } // 그룹코드(데이터 그룹간 식별)
|
||||
public string grp { get; set; } // 코드그룹
|
||||
public string code { get; set; } // 코드
|
||||
public string svalue { get; set; } // 값(문자열)
|
||||
public int ivalue { get; set; } // 값(숫자)
|
||||
public float fvalue { get; set; } // 값(실수)
|
||||
public string memo { get; set; } // 비고
|
||||
public string svalue2 { get; set; } // 값2(문자열)
|
||||
public string wuid { get; set; } // 데이터기록자 사원번호
|
||||
public string wdate { get; set; } // 데이터를기록한일시
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class CustomerController : BaseController
|
||||
{
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string Test()
|
||||
{
|
||||
return "test";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Find()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
|
||||
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
|
||||
var key_search = gets.Where(t => t.Key == "search").FirstOrDefault();
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new dsMSSQLTableAdapters.CustomsTableAdapter();//.custrom EEEntitiesCommon();
|
||||
var rows = db.GetData(FCOMMON.info.Login.gcode);// db.Customs.Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t => t.name);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine($"<th scope='row'>{item.name}</th>");
|
||||
tbody.AppendLine($"<td>{item.name2}</td>");
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
//tbody.AppendLine($"<td>{item.model}</td>");
|
||||
|
||||
//if (item.price == null)
|
||||
// tbody.AppendLine($"<td>--</td>");
|
||||
//else
|
||||
//{
|
||||
// var price = (double)item.price / 1000.0;
|
||||
|
||||
// tbody.AppendLine($"<td>{price.ToString("N0")}</td>");
|
||||
//}
|
||||
|
||||
|
||||
//tbody.AppendLine($"<td>{item.manu}</td>");
|
||||
//tbody.AppendLine($"<td>{item.supply}</td>");
|
||||
|
||||
//if (item.remark.Length > 10)
|
||||
// tbody.AppendLine($"<td>{item.remark.Substring(0, 10)}...</td>");
|
||||
//else
|
||||
// tbody.AppendLine($"<td>{item.remark}</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
|
||||
//아잍쳄이 없는경우
|
||||
if (itemcnt == 0)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine("<th scope='row'>1</th>");
|
||||
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
|
||||
|
||||
var contents = result.Content.Replace("{search}", searchkey);
|
||||
contents = contents.Replace("{tabledata}", tbody.ToString());
|
||||
contents = contents.Replace("{cnt}", itemcnt.ToString());
|
||||
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
|
||||
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
|
||||
var key_search = gets.Where(t => t.Key == "search").FirstOrDefault();
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
//if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new dsMSSQLTableAdapters.CustomsTableAdapter();// EEEntitiesCommon();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var rows = db.GetData(FCOMMON.info.Login.gcode);// .Customs.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t=>t.name);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine($"<th scope='row'>{item.grp}</th>");
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
tbody.AppendLine($"<td>{item.name2}</td>");
|
||||
tbody.AppendLine($"<td>{item.tel}</td>");
|
||||
tbody.AppendLine($"<td>{item.fax}</td>");
|
||||
tbody.AppendLine($"<td>{item.email}</td>");
|
||||
tbody.AppendLine($"<td>{item.address}</td>");
|
||||
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty( item.memo)==false && item.memo.Length > 10) tbody.AppendLine($"<td>{item.memo.Substring(0, 10)}...</td>");
|
||||
else tbody.AppendLine($"<td>{item.memo}</td>");
|
||||
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
|
||||
//아잍쳄이 없는경우
|
||||
if (itemcnt == 0)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine("<th scope='row'>1</th>");
|
||||
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
|
||||
|
||||
var contents = result.Content.Replace("{search}", searchkey);
|
||||
contents = contents.Replace("{tabledata}", tbody.ToString());
|
||||
contents = contents.Replace("{cnt}", itemcnt.ToString());
|
||||
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,496 +0,0 @@
|
||||
using FCOMMON;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class DashBoardController : BaseController
|
||||
{
|
||||
[HttpPost]
|
||||
public void Index([FromBody] string value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//// PUT api/values/5
|
||||
//public void Put(int id, [FromBody] string value)
|
||||
//{
|
||||
//}
|
||||
|
||||
//// DELETE api/values/5
|
||||
//public void Delete(int id)
|
||||
//{
|
||||
//}
|
||||
|
||||
[HttpGet]
|
||||
public string TodayCountH()
|
||||
{
|
||||
|
||||
var sql = "select count(*) from EETGW_HolydayRequest WITH (nolock) " +
|
||||
" where gcode = @gcode and isnull(conf,0) = 1 " +
|
||||
" and sdate <= convert(varchar(10),GETDATE(),120) and edate >= convert(varchar(10),GETDATE(),120)";
|
||||
|
||||
var cn = DBM.getCn();
|
||||
cn.Open();
|
||||
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = FCOMMON.info.Login.gcode;
|
||||
var cnt1 = (int)cmd.ExecuteScalar();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
return cnt1.ToString();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetHolydayRequestCount()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var cn = DBM.getCn();
|
||||
|
||||
var sql = "select count(*) from EETGW_HolydayRequest WITH (nolock) " +
|
||||
" where gcode = @gcode" +
|
||||
" and isnull(conf,0) = 0";
|
||||
|
||||
cn.Open();
|
||||
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = FCOMMON.info.Login.gcode;
|
||||
var cnt1 = (int)cmd.ExecuteScalar();
|
||||
cn.Dispose();
|
||||
|
||||
var response = new
|
||||
{
|
||||
HOLY = cnt1,
|
||||
Message = string.Empty,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
HOLY = 0,
|
||||
Message = ex.Message,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetholyRequestUser()
|
||||
{
|
||||
var sql = string.Empty;
|
||||
sql = $" select uid,cate,sdate,edate,HolyReason,Users.name,holydays,holytimes,remark " +
|
||||
$" from EETGW_HolydayRequest WITH (nolock) INNER JOIN " +
|
||||
$" Users ON EETGW_HolydayRequest.uid = Users.id " +
|
||||
$" where EETGW_HolydayRequest.gcode = @gcode" +
|
||||
$" and isnull(conf,0) = 0 ";
|
||||
//" and sdate <= convert(varchar(10),GETDATE(),120) and edate >= convert(varchar(10),GETDATE(),120)";
|
||||
|
||||
//sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode);
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!";
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetJobData(string startDate = "", string endDate = "")
|
||||
{
|
||||
var sql = string.Empty;
|
||||
|
||||
// 기본값 설정 (이번 달)
|
||||
if (string.IsNullOrEmpty(startDate) || string.IsNullOrEmpty(endDate))
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
var firstDayOfMonth = new DateTime(now.Year, now.Month, 1);
|
||||
var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1);
|
||||
startDate = firstDayOfMonth.ToString("yyyy-MM-dd");
|
||||
endDate = lastDayOfMonth.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
sql = $" select idx,pdate,status,projectName, uid, requestpart, package,type,process,description," +
|
||||
" hrs,ot,otStart,otEnd" +
|
||||
" from JobReport WITH (nolock)" +
|
||||
" where gcode = @gcode and uid = @uid" +
|
||||
" and pdate between @startDate and @endDate" +
|
||||
" order by pdate desc, wdate desc";
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no);
|
||||
cmd.Parameters.AddWithValue("startDate", startDate);
|
||||
cmd.Parameters.AddWithValue("endDate", endDate);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetCurrentUserCount()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var cn = DBM.getCn();
|
||||
|
||||
|
||||
|
||||
var sql = "select count(*) from vGroupUser WITH (nolock) " +
|
||||
" where gcode = @gcode and useUserState = 1 and useJobReport = 1" +
|
||||
" and id not in (select uid from vEETGW_TodayNoneWorkUser where gcode = @gcode and kunmu = 0)";
|
||||
|
||||
|
||||
cn.Open();
|
||||
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.Add("gcode", SqlDbType.VarChar).Value = FCOMMON.info.Login.gcode;
|
||||
var cnt1 = (int)cmd.ExecuteScalar();
|
||||
cn.Dispose();
|
||||
|
||||
var response = new
|
||||
{
|
||||
Count = cnt1,
|
||||
Message = string.Empty,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
Count = 0,
|
||||
Message = ex.Message,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetPurchaseWaitCount()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
FCOMMON.DBM.GetPurchaseWaitCount(FCOMMON.info.Login.gcode, out int cnt1, out int cnt2);
|
||||
var response = new
|
||||
{
|
||||
NR = cnt1,
|
||||
CR = cnt2,
|
||||
Message = string.Empty,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
NR = 0,
|
||||
CR = 0,
|
||||
Message = ex.Message,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetUserGroups()
|
||||
{
|
||||
var dt = DBM.GetUserGroups();
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetholyUser()
|
||||
{
|
||||
var sql = string.Empty;
|
||||
sql = $" select uid,type,cate,sdate,edate,title,dbo.getusername(uid) as name " +
|
||||
$" from vEETGW_TodayNoneWorkUser WITH (nolock)" +
|
||||
$" where gcode = @gcode and kunmu=0";
|
||||
|
||||
//sql = sql.Replace("{gcode}", FCOMMON.info.Login.gcode);
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!";
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetPresentUserList()
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = "select * from vGroupUser WITH (nolock) " +
|
||||
" where gcode = @gcode and useUserState = 1 and useJobReport = 1" +
|
||||
" and id not in (select uid from vEETGW_TodayNoneWorkUser where gcode = @gcode and kunmu = 0)";
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
Message = ex.Message,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetPurchaseNRList()
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = "select pdate, process, pumname, pumscale, pumunit, pumqtyreq, pumprice, pumamt from Purchase WITH (nolock) where gcode = @gcode and state = '---' order by pdate desc";
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
return resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
Message = ex.Message,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetPurchaseCRList()
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = "select pdate, process, pumname, pumscale, pumunit, pumqtyreq, pumprice, pumamt " +
|
||||
" from EETGW_PurchaseCR WITH (nolock) " +
|
||||
" where gcode = @gcode and state = '---'" +
|
||||
" order by pdate desc";
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new
|
||||
{
|
||||
Message = ex.Message,
|
||||
};
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
// 직접 파일을 읽어서 반환
|
||||
var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "DashBoard", "index.html");
|
||||
var contents = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 파일이 없으면 404 에러 페이지 또는 기본 메시지
|
||||
contents = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
|
||||
}
|
||||
|
||||
//공용값 적용
|
||||
//ApplyCommonValue(ref contents);
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
contents,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
private HttpResponseMessage CreateJsonResponse(object data)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
json,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using FCOMMON;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
// 로그인 요청 모델
|
||||
public class LoginRequest
|
||||
{
|
||||
public string Gcode { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public string Password { get; set; }
|
||||
public bool RememberMe { get; set; }
|
||||
}
|
||||
|
||||
// 로그인 응답 모델
|
||||
public class LoginResponse
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string RedirectUrl { get; set; }
|
||||
public object UserData { get; set; }
|
||||
}
|
||||
|
||||
public class HomeController : BaseController
|
||||
{
|
||||
[HttpGet]
|
||||
public string TestLogin()
|
||||
{
|
||||
return "HomeController Login Test - 접근 성공!";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage Login([FromBody] LoginRequest request)
|
||||
{
|
||||
var response = new LoginResponse();
|
||||
|
||||
try
|
||||
{
|
||||
// 입력값 검증
|
||||
if (string.IsNullOrEmpty(request?.Gcode) || string.IsNullOrEmpty(request?.UserId) || string.IsNullOrEmpty(request?.Password))
|
||||
{
|
||||
response.Success = false;
|
||||
response.Message = "그룹코드/사용자ID/비밀번호를 입력해주세요.";
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
|
||||
// TODO: 여기에 실제 데이터베이스 로그인 로직을 구현하세요
|
||||
// 예시: 데이터베이스에서 사용자 정보 확인
|
||||
bool isValidUser = ValidateUser(request.Gcode, request.UserId, request.Password);
|
||||
|
||||
if (isValidUser)
|
||||
{
|
||||
// 로그인 성공
|
||||
response.Success = true;
|
||||
response.Message = "로그인에 성공했습니다.";
|
||||
response.RedirectUrl = "/DashBoard";
|
||||
|
||||
// 사용자 정보 설정 (세션 또는 쿠키)
|
||||
SetUserSession(request.Gcode, request.UserId, request.RememberMe);
|
||||
|
||||
// 사용자 데이터 반환
|
||||
response.UserData = new
|
||||
{
|
||||
Gcode = request.Gcode,
|
||||
UserId = request.UserId,
|
||||
LoginTime = DateTime.Now,
|
||||
RememberMe = request.RememberMe
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
// 로그인 실패
|
||||
response.Success = false;
|
||||
response.Message = "사용자 ID 또는 비밀번호가 올바르지 않습니다.";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine( ex.Message);
|
||||
response.Success = false;
|
||||
response.Message = "로그인 처리 중 오류가 발생했습니다: " + ex.Message;
|
||||
}
|
||||
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage Logout()
|
||||
{
|
||||
var response = new LoginResponse();
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: 여기에 로그아웃 로직을 구현하세요
|
||||
// 예시: 세션 정리, 쿠키 삭제 등
|
||||
ClearUserSession();
|
||||
|
||||
response.Success = true;
|
||||
response.Message = "로그아웃되었습니다.";
|
||||
response.RedirectUrl = "/Login";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Success = false;
|
||||
response.Message = "로그아웃 처리 중 오류가 발생했습니다: " + ex.Message;
|
||||
}
|
||||
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage CheckLoginStatus()
|
||||
{
|
||||
var response = new LoginResponse();
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: 여기에 로그인 상태 확인 로직을 구현하세요
|
||||
// 예시: 세션 또는 쿠키에서 사용자 정보 확인
|
||||
var currentUser = GetCurrentUser();
|
||||
|
||||
if (currentUser != null)
|
||||
{
|
||||
response.Success = true;
|
||||
response.Message = "로그인된 상태입니다.";
|
||||
response.UserData = currentUser;
|
||||
}
|
||||
else
|
||||
{
|
||||
response.Success = false;
|
||||
response.Message = "로그인되지 않은 상태입니다.";
|
||||
response.RedirectUrl = "/Login";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Success = false;
|
||||
response.Message = "로그인 상태 확인 중 오류가 발생했습니다: " + ex.Message;
|
||||
}
|
||||
|
||||
return CreateJsonResponse(response);
|
||||
}
|
||||
|
||||
// 헬퍼 메서드들
|
||||
private bool ValidateUser(string gcode, string userId, string password)
|
||||
{
|
||||
// TODO: 실제 데이터베이스 검증 로직을 여기에 구현하세요
|
||||
// 예시: 데이터베이스에서 사용자 정보 조회 및 비밀번호 검증
|
||||
var encpass = Pub.MakePasswordEnc(password.Trim());
|
||||
|
||||
if(userId.ToLower()=="dev" && password == "123")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var GInfo = DBM.GetUserGroup(gcode);
|
||||
if (GInfo == null) return false;
|
||||
var UGInfo = DBM.GetGroupUser(gcode, userId);
|
||||
if (UGInfo == null) return false;
|
||||
var UInfo = DBM.GetUserInfo(userId);
|
||||
if (UInfo == null) return false;
|
||||
return UInfo.password.Equals(encpass);
|
||||
}
|
||||
|
||||
private void SetUserSession(string gcode, string userId, bool rememberMe)
|
||||
{
|
||||
if(userId.ToLower().Equals("dev"))
|
||||
{
|
||||
var GInfo = DBM.GetUserGroup(gcode);
|
||||
var UInfo = DBM.GetUserInfo(userId);
|
||||
|
||||
info.Login.no = "dev";
|
||||
info.Login.nameK = "개발자";
|
||||
info.Login.dept = GInfo.name;
|
||||
info.Login.level = 10;
|
||||
info.Login.email = UInfo.email;
|
||||
info.Login.hp = UInfo.hp;
|
||||
info.Login.tel = UInfo.tel;
|
||||
info.Login.title = GInfo.name + "(" + UInfo.grade + ")";
|
||||
info.NotShowJobReportview = Pub.setting.NotShowJobreportPRewView;
|
||||
info.Login.gcode = gcode;// gcode;
|
||||
info.Login.process = "개발자";
|
||||
info.Login.permission =GInfo.perm;
|
||||
info.Login.gpermission = GInfo.perm;
|
||||
info.ShowBuyerror = Pub.setting.Showbuyerror; //210625
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: 세션 또는 쿠키에 사용자 정보 저장
|
||||
// 예시: HttpContext.Session["UserId"] = userId;
|
||||
// 예시: 쿠키 설정 (rememberMe가 true인 경우)
|
||||
//데이터베이스에서 해당 정보를 찾아와서 처리해야한다
|
||||
var GInfo = DBM.GetUserGroup(gcode);
|
||||
var UInfo = DBM.GetUserInfo(userId);
|
||||
var UGInfo = DBM.GetGroupUser(gcode, userId);
|
||||
|
||||
|
||||
info.Login.no = userId;
|
||||
info.Login.nameK = UInfo.name;
|
||||
info.Login.dept = GInfo.name;
|
||||
info.Login.level = UGInfo.level;
|
||||
info.Login.email = UInfo.email;
|
||||
info.Login.hp = UInfo.hp;
|
||||
info.Login.tel = UInfo.tel;
|
||||
info.Login.title = GInfo.name + "(" + UInfo.grade + ")";
|
||||
info.NotShowJobReportview = Pub.setting.NotShowJobreportPRewView;
|
||||
info.Login.gcode = gcode;// gcode;
|
||||
info.Login.process = UInfo.id == "dev" ? "개발자" : UGInfo.Process;
|
||||
info.Login.permission = UGInfo.level;
|
||||
info.Login.gpermission = GInfo.perm;
|
||||
info.ShowBuyerror = Pub.setting.Showbuyerror; //210625
|
||||
|
||||
|
||||
//로그인기록저장
|
||||
Pub.setting.lastid = userId;// tbID.Text.Trim();
|
||||
Pub.setting.lastdpt = GInfo.name;
|
||||
Pub.setting.lastgcode = GInfo.gcode;
|
||||
Pub.setting.Save();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ClearUserSession()
|
||||
{
|
||||
// TODO: 세션 또는 쿠키에서 사용자 정보 삭제
|
||||
FCOMMON.info.Login.no = string.Empty;
|
||||
FCOMMON.info.Login.level = 0;
|
||||
FCOMMON.info.Login.gcode = string.Empty;
|
||||
FCOMMON.info.Login.permission = 0;
|
||||
FCOMMON.info.Login.gpermission = 0;
|
||||
Console.WriteLine("logout");
|
||||
}
|
||||
|
||||
private object GetCurrentUser()
|
||||
{
|
||||
// TODO: 현재 로그인된 사용자 정보 반환
|
||||
// 예시: HttpContext.Session["UserId"]에서 사용자 정보 조회
|
||||
if (string.IsNullOrEmpty(FCOMMON.info.Login.no)) return null;
|
||||
else return FCOMMON.info.Login;
|
||||
}
|
||||
|
||||
private HttpResponseMessage CreateJsonResponse(object data)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
json,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Login()
|
||||
{
|
||||
// 직접 파일을 읽어서 반환
|
||||
var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "login.html");
|
||||
var contents = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 파일이 없으면 404 에러 페이지 또는 기본 메시지
|
||||
contents = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
|
||||
}
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
contents,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetPreviousLoginInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
// pub.setting에서 이전 로그인 정보 읽기
|
||||
var previousLoginInfo = new
|
||||
{
|
||||
Gcode = Pub.setting.lastgcode ?? "",
|
||||
UserId = Pub.setting.lastid ?? "",
|
||||
Dept = Pub.setting.lastdpt ?? "",
|
||||
RememberMe = false // 기본값으로 설정
|
||||
};
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Data = previousLoginInfo
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "이전 로그인 정보를 가져오는 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class ItemController : BaseController
|
||||
{
|
||||
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string Test()
|
||||
{
|
||||
return "test";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Find()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
|
||||
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
|
||||
var key_search = gets.Where(t => t.Key == "search").FirstOrDefault();
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
if (searchkey.isEmpty() == false && searchkey != "%")
|
||||
{
|
||||
if (searchkey.StartsWith("%") == false) searchkey = "%" + searchkey;
|
||||
if (searchkey.EndsWith("%") == false) searchkey = searchkey + "%";
|
||||
}
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new dsMSSQLTableAdapters.vFindSIDTableAdapter();// EEEntitiesMain();
|
||||
var rows = db.GetData(searchkey);// .vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.model.Contains(searchkey));
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine($"<th scope='row'>{item.Location}</th>");
|
||||
tbody.AppendLine($"<td>{item.sid}</td>");
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
tbody.AppendLine($"<td>{item.model}</td>");
|
||||
|
||||
if (item.IspriceNull())
|
||||
tbody.AppendLine($"<td>--</td>");
|
||||
else
|
||||
{
|
||||
var price = (double)item.price / 1000.0;
|
||||
|
||||
tbody.AppendLine($"<td>{price.ToString("N0")}</td>");
|
||||
}
|
||||
|
||||
|
||||
tbody.AppendLine($"<td>{item.manu}</td>");
|
||||
tbody.AppendLine($"<td>{item.supply}</td>");
|
||||
|
||||
if (item.remark.Length > 10)
|
||||
tbody.AppendLine($"<td>{item.remark.Substring(0, 10)}...</td>");
|
||||
else
|
||||
tbody.AppendLine($"<td>{item.remark}</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
|
||||
//아잍쳄이 없는경우
|
||||
if (itemcnt == 0)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine("<td colspan='8'>자료가 없습니다</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
|
||||
|
||||
var contents = result.Content.Replace("{search}", searchkey);
|
||||
contents = contents.Replace("{tabledata}", tbody.ToString());
|
||||
contents = contents.Replace("{cnt}", itemcnt.ToString());
|
||||
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var contents = result.Content;
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,919 +0,0 @@
|
||||
using Microsoft.Owin;
|
||||
using Project.Web.Controllers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Data;
|
||||
using System.Web.Http.Results;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class JobreportController : BaseController
|
||||
{
|
||||
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
[HttpDelete]
|
||||
public HttpResponseMessage Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (id <= 0)
|
||||
{
|
||||
throw new Exception("유효하지 않은 업무일지 ID입니다.");
|
||||
}
|
||||
|
||||
// 직접 SQL 삭제 실행
|
||||
string connectionString = Properties.Settings.Default.gwcs;
|
||||
using (var connection = new System.Data.SqlClient.SqlConnection(connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
string deleteSql = @"
|
||||
DELETE FROM JobReport
|
||||
WHERE idx = @idx AND gcode = @gcode";
|
||||
|
||||
using (var command = new System.Data.SqlClient.SqlCommand(deleteSql, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@idx", id);
|
||||
command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
|
||||
int rowsAffected = command.ExecuteNonQuery();
|
||||
|
||||
if (rowsAffected == 0)
|
||||
{
|
||||
throw new Exception("업무일지를 찾을 수 없거나 삭제 권한이 없습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var jsonData = "{\"success\":true,\"message\":\"데이터가 성공적으로 삭제되었습니다.\"}";
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
jsonData,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorResp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
$"{{\"success\":false,\"message\":\"{EscapeJsonString(ex.Message)}\"}}",
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
return errorResp;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string Add(FormCollection formData)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 폼 데이터에서 값 추출
|
||||
var pdate = formData["pdate"] ?? DateTime.Now.ToShortDateString();
|
||||
var status = formData["status"] ?? "";
|
||||
var projectName = formData["projectName"] ?? "";
|
||||
var requestpart = formData["requestpart"] ?? "";
|
||||
var type = formData["type"] ?? "";
|
||||
var description = formData["description"] ?? "";
|
||||
var otStart = formData["otStart"] ?? "";
|
||||
var otEnd = formData["otEnd"] ?? "";
|
||||
|
||||
decimal hrs = 0;
|
||||
decimal.TryParse(formData["hrs"], out hrs);
|
||||
|
||||
decimal ot = 0;
|
||||
decimal.TryParse(formData["ot"], out ot);
|
||||
|
||||
// 직접 SQL 삽입 실행
|
||||
string connectionString = Properties.Settings.Default.gwcs;
|
||||
using (var connection = new System.Data.SqlClient.SqlConnection(connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
string insertSql = @"
|
||||
INSERT INTO JobReport
|
||||
(gcode, pdate, projectName, uid, requestpart, status, type, description, hrs, ot, otStart, otEnd, wuid, wdate)
|
||||
VALUES
|
||||
(@gcode, @pdate, @projectName, @uid, @requestpart, @status, @type, @description, @hrs, @ot, @otStart, @otEnd, @wuid, @wdate)";
|
||||
|
||||
using (var command = new System.Data.SqlClient.SqlCommand(insertSql, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
command.Parameters.AddWithValue("@pdate", pdate);
|
||||
command.Parameters.AddWithValue("@projectName", projectName);
|
||||
command.Parameters.AddWithValue("@uid", FCOMMON.info.Login.no);
|
||||
command.Parameters.AddWithValue("@requestpart", requestpart);
|
||||
command.Parameters.AddWithValue("@status", status);
|
||||
command.Parameters.AddWithValue("@type", type);
|
||||
command.Parameters.AddWithValue("@description", description);
|
||||
command.Parameters.AddWithValue("@hrs", hrs);
|
||||
command.Parameters.AddWithValue("@ot", ot);
|
||||
command.Parameters.AddWithValue("@otStart", string.IsNullOrEmpty(otStart) ? (object)DBNull.Value : otStart);
|
||||
command.Parameters.AddWithValue("@otEnd", string.IsNullOrEmpty(otEnd) ? (object)DBNull.Value : otEnd);
|
||||
command.Parameters.AddWithValue("@wuid", FCOMMON.info.Login.no);
|
||||
command.Parameters.AddWithValue("@wdate", DateTime.Now);
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
return "{\"success\":true,\"message\":\"데이터가 성공적으로 저장되었습니다.\"}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"{{\"success\":false,\"message\":\"{EscapeJsonString(ex.Message)}\"}}";
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage Edit()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Request.Form에서 직접 값 추출
|
||||
var idx = HttpContext.Current.Request.Form["idx"];
|
||||
var pdate = HttpContext.Current.Request.Form["pdate"] ?? DateTime.Now.ToShortDateString();
|
||||
var status = HttpContext.Current.Request.Form["status"] ?? "";
|
||||
var projectName = HttpContext.Current.Request.Form["projectName"] ?? "";
|
||||
var requestpart = HttpContext.Current.Request.Form["requestpart"] ?? "";
|
||||
var type = HttpContext.Current.Request.Form["type"] ?? "";
|
||||
var description = HttpContext.Current.Request.Form["description"] ?? "";
|
||||
var otStart = HttpContext.Current.Request.Form["otStart"] ?? "";
|
||||
var otEnd = HttpContext.Current.Request.Form["otEnd"] ?? "";
|
||||
|
||||
decimal hrs = 0;
|
||||
decimal.TryParse(HttpContext.Current.Request.Form["hrs"], out hrs);
|
||||
|
||||
decimal ot = 0;
|
||||
decimal.TryParse(HttpContext.Current.Request.Form["ot"], out ot);
|
||||
|
||||
int idxNum = 0;
|
||||
int.TryParse(idx, out idxNum);
|
||||
|
||||
if (idxNum <= 0)
|
||||
{
|
||||
throw new Exception("유효하지 않은 업무일지 ID입니다.");
|
||||
}
|
||||
|
||||
// 직접 SQL 업데이트 실행
|
||||
string connectionString = Properties.Settings.Default.gwcs;
|
||||
using (var connection = new System.Data.SqlClient.SqlConnection(connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
string updateSql = @"
|
||||
UPDATE JobReport
|
||||
SET pdate = @pdate,
|
||||
status = @status,
|
||||
projectName = @projectName,
|
||||
requestpart = @requestpart,
|
||||
type = @type,
|
||||
description = @description,
|
||||
hrs = @hrs,
|
||||
ot = @ot,
|
||||
otStart = @otStart,
|
||||
otEnd = @otEnd,
|
||||
wuid = @wuid,
|
||||
wdate = @wdate
|
||||
WHERE idx = @idx AND gcode = @gcode";
|
||||
|
||||
using (var command = new System.Data.SqlClient.SqlCommand(updateSql, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@idx", idxNum);
|
||||
command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
command.Parameters.AddWithValue("@pdate", pdate);
|
||||
command.Parameters.AddWithValue("@status", status);
|
||||
command.Parameters.AddWithValue("@projectName", projectName);
|
||||
command.Parameters.AddWithValue("@requestpart", requestpart);
|
||||
command.Parameters.AddWithValue("@type", type);
|
||||
command.Parameters.AddWithValue("@description", description);
|
||||
command.Parameters.AddWithValue("@hrs", hrs);
|
||||
command.Parameters.AddWithValue("@ot", ot);
|
||||
command.Parameters.AddWithValue("@otStart", string.IsNullOrEmpty(otStart) ? (object)DBNull.Value : otStart);
|
||||
command.Parameters.AddWithValue("@otEnd", string.IsNullOrEmpty(otEnd) ? (object)DBNull.Value : otEnd);
|
||||
command.Parameters.AddWithValue("@wuid", FCOMMON.info.Login.no);
|
||||
command.Parameters.AddWithValue("@wdate", DateTime.Now);
|
||||
|
||||
int rowsAffected = command.ExecuteNonQuery();
|
||||
|
||||
if (rowsAffected == 0)
|
||||
{
|
||||
throw new Exception("업무일지를 찾을 수 없거나 수정 권한이 없습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var jsonData = "{\"success\":true,\"message\":\"데이터가 성공적으로 수정되었습니다.\"}";
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
jsonData,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorResp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
$"{{\"success\":false,\"message\":\"{EscapeJsonString(ex.Message)}\"}}",
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
return errorResp;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Edit(int id)
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View("/jobreport/edit");
|
||||
|
||||
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
var key_search = gets.Where(t => t.Key == "search").FirstOrDefault();
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();//. EEEntitiesJobreport();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var ed = DateTime.Now.ToShortDateString();
|
||||
var rows = db.GetData(FCOMMON.info.Login.gcode, id).FirstOrDefault();//.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
|
||||
|
||||
var contents = result.Content;
|
||||
if (rows == null)
|
||||
{
|
||||
//아이템이 없는 메시지를 표시한다
|
||||
}
|
||||
else
|
||||
{
|
||||
//치환작업을 진행한다
|
||||
contents = contents.Replace("{pdate}", rows.pdate);
|
||||
contents = contents.Replace("{status}", rows.status);
|
||||
contents = contents.Replace("{name}", rows.name);
|
||||
contents = contents.Replace("{package}", rows.package);
|
||||
contents = contents.Replace("{process}", rows.process);
|
||||
contents = contents.Replace("{type}", rows.type);
|
||||
contents = contents.Replace("{userProcess}", rows.userProcess);
|
||||
contents = contents.Replace("{projectName}", rows.projectName);
|
||||
contents = contents.Replace("{hrs}", rows.hrs.ToString());
|
||||
contents = contents.Replace("{ot}", rows.ot.ToString());
|
||||
contents = contents.Replace("{requestpart}", rows.requestpart);
|
||||
contents = contents.Replace("{description}", rows.description);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Add()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View("/jobreport/add");
|
||||
|
||||
|
||||
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
|
||||
var key_search = gets.Where(t => t.Key == "search").FirstOrDefault();
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
//if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var ed = DateTime.Now.ToShortDateString();
|
||||
var rows = db.GetByDate(FCOMMON.info.Login.gcode, FCOMMON.info.Login.no, sd, ed);
|
||||
//vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
|
||||
tbody.AppendLine($"<th scope='row'>{item.pdate.Substring(5)}</th>");
|
||||
tbody.AppendLine($"<td>{item.ww}</td>");
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
|
||||
if (item.status == "진행 중" || item.status.EndsWith("%"))
|
||||
tbody.AppendLine($"<td class='table-info text-center'>{item.status}</td>");
|
||||
else
|
||||
tbody.AppendLine($"<td class='text-center'>{item.status}</td>");
|
||||
|
||||
tbody.AppendLine($"<td>{item.type}</td>");
|
||||
tbody.AppendLine($"<td>{item.projectName}</td>");
|
||||
tbody.AppendLine($"<td>{item.hrs}</td>");
|
||||
tbody.AppendLine($"<td>{item.ot}</td>");
|
||||
|
||||
tbody.AppendLine("<td><span class='d-inline-block text-truncate' style='max-width: 150px;'>");
|
||||
tbody.AppendLine(item.description);
|
||||
tbody.AppendLine("</span></td>");
|
||||
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
|
||||
//아잍쳄이 없는경우
|
||||
if (itemcnt == 0)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine("<th scope='row'>1</th>");
|
||||
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
|
||||
|
||||
var contents = result.Content.Replace("{search}", searchkey);
|
||||
contents = contents.Replace("{tabledata}", tbody.ToString());
|
||||
contents = contents.Replace("{cnt}", itemcnt.ToString());
|
||||
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Find()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
|
||||
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
|
||||
var key_search = gets.Where(t => t.Key == "search").FirstOrDefault();
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport();
|
||||
var sd = DateTime.Now.ToShortDateString();
|
||||
var rows = db.GetByToday(FCOMMON.info.Login.gcode, sd);//.vJobReportForUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) == 0).OrderBy(t => t.name);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine($"<th scope='row'>{item.pdate}</th>");
|
||||
tbody.AppendLine($"<td>{item.status}</td>");
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
tbody.AppendLine($"<td>{item.projectName}</td>");
|
||||
tbody.AppendLine($"<td>{item.hrs}</td>");
|
||||
tbody.AppendLine($"<td>{item.ot}</td>");
|
||||
tbody.AppendLine($"<td>{item.description}</td>");
|
||||
|
||||
|
||||
if (item.description.Length > 10)
|
||||
tbody.AppendLine($"<td>{item.description.Substring(0, 10)}...</td>");
|
||||
else
|
||||
tbody.AppendLine($"<td>{item.description}</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
|
||||
//아잍쳄이 없는경우
|
||||
if (itemcnt == 0)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine("<th scope='row'>1</th>");
|
||||
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
|
||||
|
||||
var contents = result.Content.Replace("{search}", searchkey);
|
||||
contents = contents.Replace("{tabledata}", tbody.ToString());
|
||||
contents = contents.Replace("{cnt}", itemcnt.ToString());
|
||||
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
// 직접 파일을 읽어서 반환
|
||||
var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Jobreport", "index.html");
|
||||
var contents = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 파일이 없으면 404 에러 페이지 또는 기본 메시지
|
||||
contents = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
|
||||
}
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
contents,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetJobDetail(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 특정 업무일지의 전체 정보 조회
|
||||
string connectionString = Properties.Settings.Default.gwcs;
|
||||
|
||||
using (var connection = new System.Data.SqlClient.SqlConnection(connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
string selectSql = @"
|
||||
SELECT idx, pdate, gcode, uid as id, '' as name, '' as process, type, '' as svalue,
|
||||
hrs, ot, requestpart, '' as package, '' as userProcess, status, projectName,
|
||||
description, '' as ww, otStart, otEnd, ot as ot2, '' as otReason,
|
||||
'' as grade, '' as indate, '' as outdate, pidx
|
||||
FROM JobReport WITH (NOLOCK)
|
||||
WHERE gcode = @gcode AND uid = @uid AND idx = @idx";
|
||||
|
||||
using (var command = new System.Data.SqlClient.SqlCommand(selectSql, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
command.Parameters.AddWithValue("@uid", FCOMMON.info.Login.no);
|
||||
command.Parameters.AddWithValue("@idx", id);
|
||||
|
||||
using (var reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
var item = new
|
||||
{
|
||||
idx = reader["idx"],
|
||||
pdate = reader["pdate"],
|
||||
gcode = reader["gcode"],
|
||||
id = reader["id"],
|
||||
name = reader["name"],
|
||||
process = reader["process"],
|
||||
type = reader["type"],
|
||||
svalue = reader["svalue"],
|
||||
hrs = reader["hrs"],
|
||||
ot = reader["ot"],
|
||||
requestpart = reader["requestpart"],
|
||||
package = reader["package"],
|
||||
userProcess = reader["userProcess"],
|
||||
status = reader["status"],
|
||||
projectName = reader["projectName"],
|
||||
description = reader["description"], // 전체 내용
|
||||
ww = reader["ww"],
|
||||
otStart = reader["otStart"],
|
||||
otEnd = reader["otEnd"],
|
||||
ot2 = reader["ot2"],
|
||||
otReason = reader["otReason"],
|
||||
grade = reader["grade"],
|
||||
indate = reader["indate"],
|
||||
outdate = reader["outdate"],
|
||||
pidx = reader["pidx"]
|
||||
};
|
||||
|
||||
// JSON 형태로 변환
|
||||
decimal hrs = 0;
|
||||
decimal ot = 0;
|
||||
int idx = 0;
|
||||
int pidx = 0;
|
||||
|
||||
try { hrs = Convert.ToDecimal(item.hrs); } catch { hrs = 0; }
|
||||
try { ot = Convert.ToDecimal(item.ot); } catch { ot = 0; }
|
||||
try { idx = Convert.ToInt32(item.idx); } catch { idx = 0; }
|
||||
try { pidx = Convert.ToInt32(item.pidx); } catch { pidx = 0; }
|
||||
|
||||
var desc = EscapeJsonString(item.description?.ToString() ?? ""); // 전체 내용
|
||||
var pdate = EscapeJsonString(item.pdate?.ToString() ?? "");
|
||||
var status = EscapeJsonString(item.status?.ToString() ?? "");
|
||||
var type = EscapeJsonString(item.type?.ToString() ?? "");
|
||||
var projectName = EscapeJsonString(item.projectName?.ToString() ?? "");
|
||||
var requestpart = EscapeJsonString(item.requestpart?.ToString() ?? "");
|
||||
var otStart = EscapeJsonString(item.otStart?.ToString() ?? "");
|
||||
var otEnd = EscapeJsonString(item.otEnd?.ToString() ?? "");
|
||||
|
||||
var jsonData = "{";
|
||||
jsonData += $"\"pdate\":\"{pdate}\",";
|
||||
jsonData += $"\"status\":\"{status}\",";
|
||||
jsonData += $"\"type\":\"{type}\",";
|
||||
jsonData += $"\"projectName\":\"{projectName}\",";
|
||||
jsonData += $"\"requestpart\":\"{requestpart}\",";
|
||||
jsonData += $"\"hrs\":{hrs},";
|
||||
jsonData += $"\"ot\":{ot},";
|
||||
jsonData += $"\"description\":\"{desc}\",";
|
||||
jsonData += $"\"otStart\":\"{otStart}\",";
|
||||
jsonData += $"\"otEnd\":\"{otEnd}\",";
|
||||
jsonData += $"\"idx\":{idx},";
|
||||
jsonData += $"\"pidx\":{pidx}";
|
||||
jsonData += "}";
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
jsonData,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 데이터를 찾을 수 없는 경우
|
||||
var errorResp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
"{\"error\":\"데이터를 찾을 수 없습니다.\"}",
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
return errorResp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorResp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
$"{{\"error\":\"{ex.Message}\"}}",
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
return errorResp;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetUsers()
|
||||
{
|
||||
try
|
||||
{
|
||||
string connectionString = Properties.Settings.Default.gwcs;
|
||||
var users = new List<dynamic>();
|
||||
|
||||
using (var connection = new System.Data.SqlClient.SqlConnection(connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
string selectSql = @"
|
||||
SELECT name, id, processs
|
||||
FROM vGroupUser
|
||||
WHERE gcode = @gcode AND useJobReport = 1 AND useUserState = 1
|
||||
ORDER BY name";
|
||||
|
||||
using (var command = new System.Data.SqlClient.SqlCommand(selectSql, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
|
||||
using (var reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
users.Add(new
|
||||
{
|
||||
name = reader["name"],
|
||||
id = reader["id"],
|
||||
process = reader["processs"]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 디버깅 로그 추가
|
||||
System.Diagnostics.Debug.WriteLine($"GetUsers: Found {users.Count} users for gcode {FCOMMON.info.Login.gcode}");
|
||||
|
||||
// JSON 형태로 변환
|
||||
var jsonData = "[";
|
||||
bool first = true;
|
||||
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (!first) jsonData += ",";
|
||||
first = false;
|
||||
|
||||
var name = EscapeJsonString(user.name?.ToString() ?? "");
|
||||
var id = EscapeJsonString(user.id?.ToString() ?? "");
|
||||
var process = EscapeJsonString(user.process?.ToString() ?? "");
|
||||
|
||||
jsonData += "{";
|
||||
jsonData += $"\"name\":\"{name}\",";
|
||||
jsonData += $"\"id\":\"{id}\",";
|
||||
jsonData += $"\"process\":\"{process}\"";
|
||||
jsonData += "}";
|
||||
}
|
||||
jsonData += "]";
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
jsonData,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorResp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
$"{{\"error\":\"{ex.Message}\"}}",
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
return errorResp;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetJobData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var gets = Request.GetQueryNameValuePairs();
|
||||
var startDateParam = gets.Where(t => t.Key == "startDate").FirstOrDefault();
|
||||
var endDateParam = gets.Where(t => t.Key == "endDate").FirstOrDefault();
|
||||
var userParam = gets.Where(t => t.Key == "user").FirstOrDefault();
|
||||
|
||||
var startDate = startDateParam.Key != null ? startDateParam.Value : null;
|
||||
var endDate = endDateParam.Key != null ? endDateParam.Value : null;
|
||||
var selectedUser = userParam.Key != null ? userParam.Value : null;
|
||||
|
||||
// 날짜 파라미터 처리
|
||||
string sd, ed;
|
||||
if (!string.IsNullOrEmpty(startDate) && !string.IsNullOrEmpty(endDate))
|
||||
{
|
||||
sd = startDate;
|
||||
ed = endDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 기본값: 오늘부터 -2주
|
||||
var now = DateTime.Now;
|
||||
var twoWeeksAgo = now.AddDays(-14);
|
||||
sd = twoWeeksAgo.ToShortDateString();
|
||||
ed = now.ToShortDateString();
|
||||
}
|
||||
|
||||
// 직접 SQL로 데이터 조회
|
||||
string connectionString = Properties.Settings.Default.gwcs;
|
||||
var jobReports = new List<dynamic>();
|
||||
|
||||
using (var connection = new System.Data.SqlClient.SqlConnection(connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
string selectSql = @"
|
||||
SELECT idx, pdate, gcode, uid as id, '' as name, '' as process, type, '' as svalue,
|
||||
hrs, ot, requestpart, '' as package, '' as userProcess, status, projectName,
|
||||
description, '' as ww, otStart, otEnd, ot as ot2, '' as otReason,
|
||||
'' as grade, '' as indate, '' as outdate, pidx
|
||||
FROM JobReport WITH (NOLOCK)
|
||||
WHERE gcode = @gcode AND pdate BETWEEN @startDate AND @endDate";
|
||||
|
||||
// 사용자 필터가 있으면 해당 사용자, 없으면 로그인한 사용자
|
||||
selectSql += " AND uid = @uid";
|
||||
|
||||
selectSql += " ORDER BY pdate DESC";
|
||||
|
||||
using (var command = new System.Data.SqlClient.SqlCommand(selectSql, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@gcode", FCOMMON.info.Login.gcode);
|
||||
command.Parameters.AddWithValue("@uid", !string.IsNullOrEmpty(selectedUser) ? selectedUser : FCOMMON.info.Login.no);
|
||||
command.Parameters.AddWithValue("@startDate", sd);
|
||||
command.Parameters.AddWithValue("@endDate", ed);
|
||||
|
||||
using (var reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
jobReports.Add(new
|
||||
{
|
||||
idx = reader["idx"],
|
||||
pdate = reader["pdate"],
|
||||
gcode = reader["gcode"],
|
||||
id = reader["id"],
|
||||
name = reader["name"],
|
||||
process = reader["process"],
|
||||
type = reader["type"],
|
||||
svalue = reader["svalue"],
|
||||
hrs = reader["hrs"],
|
||||
ot = reader["ot"],
|
||||
requestpart = reader["requestpart"],
|
||||
package = reader["package"],
|
||||
userProcess = reader["userProcess"],
|
||||
status = reader["status"],
|
||||
projectName = reader["projectName"],
|
||||
description = reader["description"],
|
||||
ww = reader["ww"],
|
||||
otStart = reader["otStart"],
|
||||
otEnd = reader["otEnd"],
|
||||
ot2 = reader["ot2"],
|
||||
otReason = reader["otReason"],
|
||||
grade = reader["grade"],
|
||||
indate = reader["indate"],
|
||||
outdate = reader["outdate"],
|
||||
pidx = reader["pidx"]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// JSON 형태로 변환
|
||||
var jsonData = "[";
|
||||
bool first = true;
|
||||
|
||||
if (jobReports != null)
|
||||
{
|
||||
foreach (var item in jobReports)
|
||||
{
|
||||
if (!first) jsonData += ",";
|
||||
first = false;
|
||||
|
||||
// DBNull 처리를 위한 안전한 변환
|
||||
decimal hrs = 0;
|
||||
decimal ot = 0;
|
||||
int idx = 0;
|
||||
int pidx = 0;
|
||||
|
||||
try { hrs = Convert.ToDecimal(item.hrs); } catch { hrs = 0; }
|
||||
try { ot = Convert.ToDecimal(item.ot); } catch { ot = 0; }
|
||||
try { idx = Convert.ToInt32(item.idx); } catch { idx = 0; }
|
||||
try { pidx = Convert.ToInt32(item.pidx); } catch { pidx = 0; }
|
||||
|
||||
// 안전한 JSON 문자열 이스케이프 처리 및 25자 제한
|
||||
var fullDesc = item.description?.ToString() ?? "";
|
||||
var desc = EscapeJsonString(fullDesc.Length > 25 ? fullDesc.Substring(0, 25) + "..." : fullDesc);
|
||||
var pdate = EscapeJsonString(item.pdate?.ToString() ?? "");
|
||||
var ww = EscapeJsonString(item.ww?.ToString() ?? "");
|
||||
var name = EscapeJsonString(item.name?.ToString() ?? "");
|
||||
var status = EscapeJsonString(item.status?.ToString() ?? "");
|
||||
var type = EscapeJsonString(item.type?.ToString() ?? "");
|
||||
var projectName = EscapeJsonString(item.projectName?.ToString() ?? "");
|
||||
var requestpart = EscapeJsonString(item.requestpart?.ToString() ?? "");
|
||||
var userProcess = EscapeJsonString(item.userProcess?.ToString() ?? "");
|
||||
|
||||
jsonData += "{";
|
||||
jsonData += $"\"pdate\":\"{pdate}\",";
|
||||
jsonData += $"\"ww\":\"{ww}\",";
|
||||
jsonData += $"\"name\":\"{name}\",";
|
||||
jsonData += $"\"status\":\"{status}\",";
|
||||
jsonData += $"\"type\":\"{type}\",";
|
||||
jsonData += $"\"projectName\":\"{projectName}\",";
|
||||
jsonData += $"\"requestpart\":\"{requestpart}\",";
|
||||
jsonData += $"\"userProcess\":\"{userProcess}\",";
|
||||
jsonData += $"\"hrs\":{hrs},";
|
||||
jsonData += $"\"ot\":{ot},";
|
||||
jsonData += $"\"description\":\"{desc}\",";
|
||||
jsonData += $"\"idx\":{idx},";
|
||||
jsonData += $"\"pidx\":{pidx}";
|
||||
jsonData += "}";
|
||||
}
|
||||
}
|
||||
jsonData += "]";
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
jsonData,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorResp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
$"{{\"error\":\"{ex.Message}\"}}",
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
return errorResp;
|
||||
}
|
||||
}
|
||||
|
||||
private string EscapeJsonString(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
return "";
|
||||
|
||||
// 제어 문자 제거 (0x00-0x1F 범위)
|
||||
var cleanInput = System.Text.RegularExpressions.Regex.Replace(input, @"[\x00-\x08\x0B\x0C\x0E-\x1F]", "");
|
||||
|
||||
return cleanInput
|
||||
.Replace("\\", "\\\\") // 백슬래시
|
||||
.Replace("\"", "\\\"") // 따옴표
|
||||
.Replace("\n", "\\n") // 개행
|
||||
.Replace("\r", "\\r") // 캐리지 리턴
|
||||
.Replace("\t", "\\t"); // 탭
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,293 +0,0 @@
|
||||
using FCM0000;
|
||||
using Microsoft.Owin;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class KuntaeController : BaseController
|
||||
{
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetList(string sd = null, string ed = null)
|
||||
{
|
||||
var sql = string.Empty;
|
||||
sql = "select idx,gcode,uid,dbo.getUserName(uid) as uname,cate,sdate,edate,term,termdr,drtime,DrTimePMS,crtime,title,contents, tag, extcate,extidx, wuid,wdate" +
|
||||
" from Holyday" +
|
||||
" where gcode = @gcode" +
|
||||
" and uid = @uid" +
|
||||
" and sdate between @sd and @ed" +
|
||||
" order by wdate desc";
|
||||
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!";
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no);
|
||||
|
||||
// 날짜 파라미터가 없으면 기본값 사용 (현재 월)
|
||||
var startDate = !string.IsNullOrEmpty(sd) ? sd : DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
|
||||
var endDate = !string.IsNullOrEmpty(ed) ? ed : DateTime.Now.ToString("yyyy-MM-dd");
|
||||
|
||||
cmd.Parameters.AddWithValue("sd", startDate);
|
||||
cmd.Parameters.AddWithValue("ed", endDate);
|
||||
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
|
||||
var dt = new System.Data.DataTable();
|
||||
da.Fill(dt);
|
||||
da.Dispose();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var txtjson = JsonConvert.SerializeObject(dt, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
txtjson,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
// 직접 파일을 읽어서 반환
|
||||
var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "kuntae", "index.html");
|
||||
var contents = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 파일이 없으면 404 에러 페이지 또는 기본 메시지
|
||||
contents = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
|
||||
}
|
||||
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
contents,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage Insert([FromBody] KuntaeModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = @"INSERT INTO Holyday (gcode, uid, cate, sdate, edate, term, termdr, drtime, DrTimePMS, crtime, title, contents, tag, extcate, extidx, wuid, wdate)
|
||||
VALUES (@gcode, @uid, @cate, @sdate, @edate, @term, @termdr, @drtime, @DrTimePMS, @crtime, @title, @contents, @tag, @extcate, @extidx, @wuid, @wdate)";
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no);
|
||||
cmd.Parameters.AddWithValue("cate", (object)model.cate ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("sdate", model.sdate);
|
||||
cmd.Parameters.AddWithValue("edate", (object)model.edate ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("term", (object)model.term ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("termdr", (object)model.termdr ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("drtime", (object)model.drtime ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("DrTimePMS", (object)model.DrTimePMS ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("crtime", (object)model.crtime ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("title", (object)model.title ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("contents", (object)model.contents ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("tag", (object)model.tag ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("extcate", (object)model.extcate ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("extidx", (object)model.extidx ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("wuid", FCOMMON.info.Login.no);
|
||||
cmd.Parameters.AddWithValue("wdate", DateTime.Now);
|
||||
|
||||
cn.Open();
|
||||
var result = cmd.ExecuteNonQuery();
|
||||
cn.Close();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var response = new { success = true, message = "근태가 추가되었습니다." };
|
||||
var json = JsonConvert.SerializeObject(response);
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new { success = false, message = "근태 추가 중 오류가 발생했습니다: " + ex.Message };
|
||||
var json = JsonConvert.SerializeObject(response);
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public HttpResponseMessage Update([FromBody] KuntaeModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = @"UPDATE Holyday SET cate = @cate, sdate = @sdate, edate = @edate, term = @term, termdr = @termdr,
|
||||
drtime = @drtime, DrTimePMS = @DrTimePMS, crtime = @crtime, title = @title, contents = @contents,
|
||||
tag = @tag, extcate = @extcate, extidx = @extidx
|
||||
WHERE gcode = @gcode AND uid = @uid AND idx = @idx";
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no);
|
||||
cmd.Parameters.AddWithValue("cate", (object)model.cate ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("sdate", model.sdate);
|
||||
cmd.Parameters.AddWithValue("edate", (object)model.edate ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("term", (object)model.term ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("termdr", (object)model.termdr ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("drtime", (object)model.drtime ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("DrTimePMS", (object)model.DrTimePMS ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("crtime", (object)model.crtime ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("title", (object)model.title ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("contents", (object)model.contents ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("tag", (object)model.tag ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("extcate", (object)model.extcate ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("extidx", (object)model.extidx ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("idx", model.idx);
|
||||
|
||||
cn.Open();
|
||||
var result = cmd.ExecuteNonQuery();
|
||||
cn.Close();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var response = new { success = true, message = "근태가 수정되었습니다." };
|
||||
var json = JsonConvert.SerializeObject(response);
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new { success = false, message = "근태 수정 중 오류가 발생했습니다: " + ex.Message };
|
||||
var json = JsonConvert.SerializeObject(response);
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
public HttpResponseMessage Delete(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = "DELETE FROM Holyday WHERE gcode = @gcode AND uid = @uid AND idx = @idx";
|
||||
|
||||
var cs = Properties.Settings.Default.gwcs;
|
||||
var cn = new System.Data.SqlClient.SqlConnection(cs);
|
||||
var cmd = new System.Data.SqlClient.SqlCommand(sql, cn);
|
||||
|
||||
cmd.Parameters.AddWithValue("gcode", FCOMMON.info.Login.gcode);
|
||||
cmd.Parameters.AddWithValue("uid", FCOMMON.info.Login.no);
|
||||
cmd.Parameters.AddWithValue("idx", id);
|
||||
|
||||
cn.Open();
|
||||
var result = cmd.ExecuteNonQuery();
|
||||
cn.Close();
|
||||
cmd.Dispose();
|
||||
cn.Dispose();
|
||||
|
||||
var response = new { success = true, message = "근태가 삭제되었습니다." };
|
||||
var json = JsonConvert.SerializeObject(response);
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new { success = false, message = "근태 삭제 중 오류가 발생했습니다: " + ex.Message };
|
||||
var json = JsonConvert.SerializeObject(response);
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class KuntaeModel
|
||||
{
|
||||
/*
|
||||
idx : 데이터고유번호
|
||||
gcode : 그룹코드(데이터 그룹간 식별)
|
||||
uid : 사원번호
|
||||
cate : 근태구분
|
||||
sdate : 시작일
|
||||
edate : 종료일
|
||||
term : 사용일
|
||||
termdr : 발생일
|
||||
drtime : 발생시간,
|
||||
crtime : 사용시간
|
||||
DrTimePMS : PMS등록시간
|
||||
title : 제목
|
||||
contents : 내용
|
||||
tag : 입력방식특이사항(clipboard=클립보드에서붙여넣었다)
|
||||
extcate : 외부에서생성된 경우 외부 출처
|
||||
extidx : 외부출처인경우 데이터고유번호
|
||||
wuid : 데이터기록자 사원번호
|
||||
wdate : 데이터를기록한일시
|
||||
*/
|
||||
|
||||
public int idx { get; set; } // 데이터고유번호
|
||||
public string gcode { get; set; } // 그룹코드(데이터 그룹간 식별)
|
||||
public string uid { get; set; } // 사원번호
|
||||
public string uname { get; set; } // 성명
|
||||
public string cate { get; set; } // 근태구분
|
||||
public string sdate { get; set; } // 시작일
|
||||
public string edate { get; set; } // 종료일
|
||||
public string term { get; set; } // 사용일
|
||||
public string termdr { get; set; } // 발생일
|
||||
public string drtime { get; set; } // 발생시간
|
||||
public string DrTimePMS { get; set; } // PMS등록시간
|
||||
public string crtime { get; set; } // 사용시간
|
||||
public string title { get; set; } // 제목
|
||||
public string contents { get; set; } // 내용
|
||||
public string tag { get; set; } // 입력방식특이사항
|
||||
public string extcate { get; set; } // 외부에서생성된 경우 외부 출처
|
||||
public string extidx { get; set; } // 외부출처인경우 데이터고유번호
|
||||
public string wuid { get; set; } // 데이터기록자 사원번호
|
||||
public string wdate { get; set; } // 데이터를기록한일시
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class ManualController : BaseController
|
||||
{
|
||||
[HttpPost]
|
||||
public void Index([FromBody]string value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Page(string id)
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View($"\\Manual\\{id}");
|
||||
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var contents = result.Content;
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var contents = result.Content;
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,408 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Newtonsoft.Json;
|
||||
using FCOMMON;
|
||||
using Project.Web.Model;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class ProjectController : BaseController
|
||||
{
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Project", "index.html");
|
||||
var contents = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
contents = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
|
||||
}
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
contents,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetProjects(string status = "진행", string userFilter = "my")
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
string currentUserName = FCOMMON.info.Login.nameK ?? "";
|
||||
|
||||
var sql = @"
|
||||
SELECT idx, status as 상태,asset as 자산번호, model as 장비모델, serial as 시리얼번호, Priority as 우선순위,
|
||||
ReqSite as 요청국가, ReqPlant as 요청공장, ReqLine as 요청라인, ReqPackage as 요청부서패키지,
|
||||
reqstaff as 요청자, process as 프로젝트공정, sdate as 시작일,edate as 완료일,ddate as 만료일, odate as 출고일, name as 프로젝트명,
|
||||
dbo.getUserName( isnull(championid, userManager) ) as 프로젝트관리자,
|
||||
dbo.getUserName (isnull(designid, usermain)) as 설계담당,
|
||||
dbo.getUserName(isnull(epanelid, userhw2)) as 전장담당,
|
||||
dbo.getUserName(isnull(softwareid, usersub)) as 프로그램담당,
|
||||
crdue as 예산만기일, cramount as 예산,jasmin as 웹관리번호
|
||||
FROM Projects
|
||||
WHERE gcode = @gcode
|
||||
AND status = @status
|
||||
AND ISNULL(isdel, 0) = 0";
|
||||
|
||||
// 사용자 필터 적용
|
||||
if (userFilter == "my" && !string.IsNullOrEmpty(currentUserName))
|
||||
{
|
||||
sql += @" AND (
|
||||
dbo.getUserName(ISNULL(championid, userManager)) LIKE @userName
|
||||
OR dbo.getUserName(ISNULL(designid, usermain)) LIKE @userName
|
||||
OR dbo.getUserName(ISNULL(epanelid, userhw2)) LIKE @userName
|
||||
OR dbo.getUserName(ISNULL(softwareid, usersub)) LIKE @userName
|
||||
)";
|
||||
}
|
||||
|
||||
sql += " ORDER BY wdate DESC";
|
||||
|
||||
var parameters = new
|
||||
{
|
||||
gcode = gcode,
|
||||
status = status,
|
||||
userName = userFilter == "my" ? "%" + currentUserName + "%" : ""
|
||||
};
|
||||
|
||||
var projects = DBM.Query<ProjectModel>(sql, parameters);
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Data = projects,
|
||||
CurrentUser = currentUserName
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "프로젝트 목록을 가져오는 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetProject(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (id <= 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "유효하지 않은 프로젝트 ID입니다."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
|
||||
var sql = @"
|
||||
SELECT idx, status as 상태,asset as 자산번호, model as 장비모델, serial as 시리얼번호, Priority as 우선순위,
|
||||
ReqSite as 요청국가, ReqPlant as 요청공장, ReqLine as 요청라인, ReqPackage as 요청부서패키지,
|
||||
reqstaff as 요청자, process as 프로젝트공정, sdate as 시작일,edate as 완료일,ddate as 만료일, odate as 출고일, name as 프로젝트명,
|
||||
dbo.getUserName( isnull(championid, userManager) ) as 프로젝트관리자,
|
||||
dbo.getUserName (isnull(designid, usermain)) as 설계담당,
|
||||
dbo.getUserName(isnull(epanelid, userhw2)) as 전장담당,
|
||||
dbo.getUserName(isnull(softwareid, usersub)) as 프로그램담당,
|
||||
crdue as 예산만기일, cramount as 예산,jasmin as 웹관리번호
|
||||
FROM Projects
|
||||
WHERE idx = @idx AND gcode = @gcode AND ISNULL(isdel, 0) = 0";
|
||||
|
||||
var project = DBM.QuerySingleOrDefault<ProjectModel>(sql, new { idx = id, gcode = gcode });
|
||||
|
||||
if (project == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "프로젝트를 찾을 수 없습니다."
|
||||
});
|
||||
}
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Data = project
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "프로젝트 조회 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage CreateProject([FromBody] ProjectModel project)
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(project.프로젝트명))
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "프로젝트명을 입력해주세요."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
string uid = FCOMMON.info.Login.no;
|
||||
|
||||
var sql = @"
|
||||
INSERT INTO Projects (gcode, process, sdate, name, edate, ddate, odate, userManager, status, memo, wdate)
|
||||
VALUES (@gcode, @process, @sdate, @name, @edate, @ddate, @odate, @userManager, @status, @memo, GETDATE())";
|
||||
|
||||
var parameters = new
|
||||
{
|
||||
gcode = gcode,
|
||||
process = project.프로젝트공정 ?? "",
|
||||
sdate = project.시작일,
|
||||
name = project.프로젝트명,
|
||||
edate = project.완료일,
|
||||
ddate = project.만료일,
|
||||
odate = project.출고일,
|
||||
userManager = project.프로젝트관리자 ?? "",
|
||||
status = project.상태 ?? "진행",
|
||||
memo = project.memo ?? ""
|
||||
};
|
||||
|
||||
DBM.Execute(sql, parameters);
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Message = "프로젝트가 추가되었습니다."
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "프로젝트 추가 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public HttpResponseMessage UpdateProject([FromBody] ProjectModel project)
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (project.idx <= 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "유효하지 않은 프로젝트 ID입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(project.프로젝트명))
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "프로젝트명을 입력해주세요."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
|
||||
// 먼저 프로젝트가 존재하는지 확인
|
||||
var checkSql = "SELECT COUNT(*) FROM Projects WHERE idx = @idx AND gcode = @gcode AND ISNULL(isdel, 0) = 0";
|
||||
var count = DBM.QuerySingle<int>(checkSql, new { idx = project.idx, gcode = gcode });
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "수정할 프로젝트를 찾을 수 없습니다."
|
||||
});
|
||||
}
|
||||
|
||||
var sql = @"
|
||||
UPDATE Projects
|
||||
SET process = @process, sdate = @sdate, name = @name, edate = @edate,
|
||||
ddate = @ddate, odate = @odate, userManager = @userManager,
|
||||
status = @status, memo = @memo
|
||||
WHERE idx = @idx AND gcode = @gcode";
|
||||
|
||||
var parameters = new
|
||||
{
|
||||
idx = project.idx,
|
||||
gcode = gcode,
|
||||
process = project.프로젝트공정 ?? "",
|
||||
sdate = project.시작일,
|
||||
name = project.프로젝트명,
|
||||
edate = project.완료일,
|
||||
ddate = project.만료일,
|
||||
odate = project.출고일,
|
||||
userManager = project.프로젝트관리자 ?? "",
|
||||
status = project.상태 ?? "진행",
|
||||
memo = project.memo ?? ""
|
||||
};
|
||||
|
||||
DBM.Execute(sql, parameters);
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Message = "프로젝트가 수정되었습니다."
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "프로젝트 수정 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
public HttpResponseMessage DeleteProject(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (id <= 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "유효하지 않은 프로젝트 ID입니다."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
|
||||
// 먼저 프로젝트가 존재하는지 확인
|
||||
var checkSql = "SELECT COUNT(*) FROM Projects WHERE idx = @idx AND gcode = @gcode AND ISNULL(isdel, 0) = 0";
|
||||
var count = DBM.QuerySingle<int>(checkSql, new { idx = id, gcode = gcode });
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "삭제할 프로젝트를 찾을 수 없습니다."
|
||||
});
|
||||
}
|
||||
|
||||
var sql = "UPDATE Projects SET isdel = 1 WHERE idx = @idx AND gcode = @gcode";
|
||||
DBM.Execute(sql, new { idx = id, gcode = gcode });
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Message = "프로젝트가 삭제되었습니다."
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "프로젝트 삭제 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private object GetCurrentUser()
|
||||
{
|
||||
if (string.IsNullOrEmpty(FCOMMON.info.Login.no)) return null;
|
||||
else return FCOMMON.info.Login;
|
||||
}
|
||||
|
||||
private HttpResponseMessage CreateJsonResponse(object data)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DateFormatString = "yyyy-MM-dd HH:mm:ss"
|
||||
});
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
json,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,215 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class PurchaseController : BaseController
|
||||
{
|
||||
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string Test()
|
||||
{
|
||||
return "test";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Find()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
|
||||
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
|
||||
var key_search = gets.Where(t => t.Key == "search").FirstOrDefault();
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
|
||||
if(searchkey.isEmpty()==false && searchkey != "%")
|
||||
{
|
||||
if (searchkey.StartsWith("%") == false) searchkey = "%" + searchkey;
|
||||
if (searchkey.EndsWith("%") == false) searchkey += "%";
|
||||
}
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new dsMSSQLTableAdapters.vFindSIDTableAdapter();// EEEntitiesMain();
|
||||
var rows = db.GetData(searchkey);//.vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.manu.Contains(searchkey) || t.model.Contains(searchkey));
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine($"<th scope='row'>{item.Location}</th>");
|
||||
tbody.AppendLine($"<td>{item.sid}</td>");
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
tbody.AppendLine($"<td>{item.model}</td>");
|
||||
|
||||
if (item.IspriceNull())
|
||||
tbody.AppendLine($"<td>--</td>");
|
||||
else
|
||||
{
|
||||
var price = (double)item.price / 1000.0;
|
||||
|
||||
tbody.AppendLine($"<td>{price.ToString("N0")}</td>");
|
||||
}
|
||||
|
||||
|
||||
tbody.AppendLine($"<td>{item.manu}</td>");
|
||||
tbody.AppendLine($"<td>{item.supply}</td>");
|
||||
|
||||
if (item.remark.Length > 10)
|
||||
tbody.AppendLine($"<td>{item.remark.Substring(0, 10)}...</td>");
|
||||
else
|
||||
tbody.AppendLine($"<td>{item.remark}</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
|
||||
//아잍쳄이 없는경우
|
||||
if (itemcnt == 0)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine("<th scope='row'>1</th>");
|
||||
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
|
||||
|
||||
var contents = result.Content.Replace("{search}", searchkey);
|
||||
contents = contents.Replace("{tabledata}", tbody.ToString());
|
||||
contents = contents.Replace("{cnt}", itemcnt.ToString());
|
||||
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
|
||||
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
|
||||
var key_search = gets.Where(t => t.Key == "search").FirstOrDefault();
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
//if (searchkey.isEmpty() == false)
|
||||
//{
|
||||
var db = new dsMSSQLTableAdapters.vPurchaseTableAdapter();// EEEntitiesPurchase();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var rows = db.GetAfter(FCOMMON.info.Login.gcode, sd);// .vPurchase.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) >= 0).OrderByDescending(t => t.pdate);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine($"<th scope='row'>{item.pdate.Substring(5)}</th>");
|
||||
|
||||
if (item.state == "---") tbody.AppendLine($"<td class='table-info'>{item.state}</td>");
|
||||
else if (item.state == "Received") tbody.AppendLine($"<td class='table-success'>{item.state}</td>");
|
||||
else tbody.AppendLine($"<td>{item.state}</td>");
|
||||
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
tbody.AppendLine($"<td>{item.sid}</td>");
|
||||
tbody.AppendLine($"<td>{item.pumname}</td>");
|
||||
|
||||
if (item.pumscale.Length > 10) tbody.AppendLine($"<td>{item.pumscale.Substring(0, 10)}...</td>");
|
||||
else tbody.AppendLine($"<td>{item.pumscale}</td>");
|
||||
|
||||
tbody.AppendLine($"<td>{item.pumqty}</td>");
|
||||
tbody.AppendLine($"<td>{item.pumprice}</td>");
|
||||
tbody.AppendLine($"<td>{item.pumamt}</td>");
|
||||
tbody.AppendLine($"<td>{item.supply}</td>");
|
||||
if (item.project != null && item.project.Length > 10) tbody.AppendLine($"<td>{item.project.Substring(0, 10)}...</td>");
|
||||
else tbody.AppendLine($"<td>{item.project}</td>");
|
||||
|
||||
if (item.bigo.Length > 10) tbody.AppendLine($"<td>{item.bigo.Substring(0, 10)}...</td>");
|
||||
else tbody.AppendLine($"<td>{item.bigo}</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
//}
|
||||
|
||||
//아잍쳄이 없는경우
|
||||
if (itemcnt == 0)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine("<th scope='row'>1</th>");
|
||||
tbody.AppendLine("<td colspan='6'>자료가 없습니다</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
|
||||
|
||||
var contents = result.Content.Replace("{search}", searchkey);
|
||||
contents = contents.Replace("{tabledata}", tbody.ToString());
|
||||
contents = contents.Replace("{cnt}", itemcnt.ToString());
|
||||
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class ResourceController : BaseController
|
||||
{
|
||||
//[HttpGet]
|
||||
//public HttpResponseMessage Index()
|
||||
//{
|
||||
// //로그인이 되어있지않다면 로그인을 가져온다
|
||||
// MethodResult result;
|
||||
// result = View(true);
|
||||
|
||||
// var model = GetGlobalModel();
|
||||
// var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
// //기본값을 찾아서 없애줘야한다
|
||||
// var contents = result.Content;
|
||||
|
||||
// //공용값 적용
|
||||
// ApplyCommonValue(ref contents);
|
||||
|
||||
// //최종문자 적용
|
||||
// result.Content = contents;
|
||||
|
||||
// var resp = new HttpResponseMessage()
|
||||
// {
|
||||
// Content = new StringContent(
|
||||
// result.Content,
|
||||
// System.Text.Encoding.UTF8,
|
||||
// "text/html")
|
||||
// };
|
||||
|
||||
// return resp;
|
||||
//}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage file()
|
||||
{
|
||||
var config = RequestContext.Configuration;
|
||||
var routeData = config.Routes.GetRouteData(Request).Values.ToList();
|
||||
|
||||
var p_resource = routeData.Where(t => t.Key == "resource").FirstOrDefault();
|
||||
var p_path = routeData.Where(t => t.Key == "path").FirstOrDefault();
|
||||
var p_ext = routeData.Where(t => t.Key == "ext").FirstOrDefault();
|
||||
var p_subdir = routeData.Where(t => t.Key == "subdir").FirstOrDefault();
|
||||
|
||||
var v_resource = string.Empty;
|
||||
var v_path = string.Empty;
|
||||
var v_ext = string.Empty;
|
||||
var v_subdir = string.Empty;
|
||||
|
||||
if (p_resource.Key == "resource") v_resource = p_resource.Value.ToString();
|
||||
if (p_path.Key == "path") v_path = p_path.Value.ToString();
|
||||
if (p_ext.Key == "ext") v_ext = p_ext.Value.ToString();
|
||||
if (p_subdir.Key == "subdir") v_subdir = p_subdir.Value.ToString();
|
||||
|
||||
//var file_ext = routeData[0].Value.ToString();
|
||||
//var name_resource = routeData[1].Value.ToString() + "." + file_ext;
|
||||
//var name_action = routeData[3].Value.ToString();
|
||||
|
||||
Boolean isBinary = true;
|
||||
|
||||
|
||||
string content_type = "text/plain";
|
||||
|
||||
if (v_ext == "json")
|
||||
{
|
||||
isBinary = false;
|
||||
content_type = "application/json";
|
||||
}
|
||||
else if(v_ext == "vue")
|
||||
{
|
||||
isBinary = false;
|
||||
content_type = "application/js";
|
||||
}
|
||||
else if (v_ext == "js")
|
||||
{
|
||||
isBinary = false;
|
||||
content_type = "application/js";
|
||||
}
|
||||
else if (v_ext == "css")
|
||||
{
|
||||
isBinary = false;
|
||||
content_type = "text/css";
|
||||
}
|
||||
else if (v_ext == "csv")
|
||||
{
|
||||
isBinary = false;
|
||||
content_type = "text/csv";
|
||||
}
|
||||
else if (v_ext == "ico")
|
||||
{
|
||||
isBinary = true;
|
||||
content_type = "image/x-icon";
|
||||
}
|
||||
else if(v_ext == "ttf" || v_ext == "otf")
|
||||
{
|
||||
isBinary = true;
|
||||
content_type = "application/octet-stream";
|
||||
}
|
||||
|
||||
HttpContent resultContent = null;
|
||||
|
||||
if (v_resource.isEmpty() && v_ext.isEmpty())
|
||||
{
|
||||
v_resource = "index";
|
||||
v_ext = "html";
|
||||
isBinary = false;
|
||||
content_type = "text/html";
|
||||
}
|
||||
|
||||
|
||||
|
||||
var file = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "View", v_path, v_subdir, v_resource + "." + v_ext);
|
||||
|
||||
if (isBinary)
|
||||
{
|
||||
|
||||
if (System.IO.File.Exists(file))
|
||||
{
|
||||
var buffer = System.IO.File.ReadAllBytes(file);
|
||||
resultContent = new ByteArrayContent(buffer);
|
||||
Console.WriteLine(">>File(B) : " + file);
|
||||
}
|
||||
else Console.WriteLine("no resouoir file " + file);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (System.IO.File.Exists(file))
|
||||
{
|
||||
|
||||
var buffer = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8);
|
||||
resultContent = new StringContent(buffer, System.Text.Encoding.UTF8, content_type);
|
||||
Console.WriteLine(">>File(S) : " + file);
|
||||
}
|
||||
else Console.WriteLine("no resouoir file " + file);
|
||||
}
|
||||
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = resultContent
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class ResultController : BaseController
|
||||
{
|
||||
[HttpPost]
|
||||
public void Index([FromBody]string value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string Test()
|
||||
{
|
||||
return "test";
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var contents = result.Content;
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class SettingController : BaseController
|
||||
{
|
||||
[HttpPost]
|
||||
public void Index([FromBody]string value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string Test()
|
||||
{
|
||||
return "test";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
//로그인이 되어있지않다면 로그인을 가져온다
|
||||
MethodResult result;
|
||||
result = View();
|
||||
|
||||
var model = GetGlobalModel();
|
||||
var getParams = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var contents = result.Content;
|
||||
|
||||
//공용값 적용
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
//최종문자 적용
|
||||
result.Content = contents;
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
result.Content,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,439 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Newtonsoft.Json;
|
||||
using FCOMMON;
|
||||
using Project.Web.Model;
|
||||
|
||||
namespace Project.Web.Controllers
|
||||
{
|
||||
public class TodoController : BaseController
|
||||
{
|
||||
[HttpGet]
|
||||
public HttpResponseMessage Index()
|
||||
{
|
||||
var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "Todo", "index.html");
|
||||
var contents = string.Empty;
|
||||
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
contents = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
|
||||
}
|
||||
|
||||
ApplyCommonValue(ref contents);
|
||||
|
||||
var resp = new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
contents,
|
||||
System.Text.Encoding.UTF8,
|
||||
"text/html")
|
||||
};
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetTodos()
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
string uid = FCOMMON.info.Login.no;
|
||||
|
||||
var sql = @"SELECT * FROM EETGW_Todo WHERE gcode = @gcode AND uid = @uid
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN ISNULL(status,'0') = '1' THEN 1 -- 진행
|
||||
WHEN ISNULL(status,'0') = '0' THEN 2 -- 대기
|
||||
WHEN ISNULL(status,'0') = '3' THEN 3 -- 보류
|
||||
WHEN ISNULL(status,'0') = '5' THEN 4 -- 완료
|
||||
WHEN ISNULL(status,'0') = '2' THEN 5 -- 취소
|
||||
ELSE 6
|
||||
END, flag DESC,
|
||||
ISNULL(seqno, 0) DESC,
|
||||
expire ASC";
|
||||
var todos = DBM.Query<TodoModel>(sql, new { gcode = gcode, uid = uid });
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Data = todos
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "Todo 목록을 가져오는 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetUrgentTodos()
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
string uid = FCOMMON.info.Login.no;
|
||||
|
||||
var sql = @"
|
||||
SELECT * FROM EETGW_Todo
|
||||
WHERE gcode = @gcode AND uid = @uid
|
||||
and isnull(status,'0') not in ('2','3','5')
|
||||
ORDER BY flag DESC, seqno DESC, expire ASC, wdate ASC";
|
||||
|
||||
var todos = DBM.Query<TodoModel>(sql, new { gcode = gcode, uid = uid });
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Data = todos
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "급한 Todo 목록을 가져오는 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage CreateTodo([FromBody] TodoModel todo)
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(todo.remark))
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "할일 내용은 필수입니다."
|
||||
});
|
||||
}
|
||||
|
||||
todo.gcode = FCOMMON.info.Login.gcode;
|
||||
todo.uid = FCOMMON.info.Login.no;
|
||||
todo.wuid = FCOMMON.info.Login.no;
|
||||
todo.wdate = DateTime.Now;
|
||||
|
||||
if (todo.seqno == null) todo.seqno = 0;
|
||||
if (todo.flag == null) todo.flag = false;
|
||||
if (todo.status == '\0') todo.status = '0';
|
||||
|
||||
// 새로 생성할 때 완료 상태면 완료일 설정
|
||||
DateTime? okdateValue = null;
|
||||
if (todo.status == '5')
|
||||
{
|
||||
okdateValue = DateTime.Now;
|
||||
}
|
||||
|
||||
var sql = @"
|
||||
INSERT INTO EETGW_Todo (gcode, uid, title, remark, flag, expire, seqno, request, status, okdate, wuid, wdate)
|
||||
VALUES (@gcode, @uid, @title, @remark, @flag, @expire, @seqno, @request, @status, @okdate, @wuid, @wdate);
|
||||
SELECT SCOPE_IDENTITY();";
|
||||
|
||||
var newId = DBM.QuerySingle<int>(sql, new
|
||||
{
|
||||
gcode = todo.gcode,
|
||||
uid = todo.uid,
|
||||
title = todo.title,
|
||||
remark = todo.remark,
|
||||
flag = todo.flag,
|
||||
expire = todo.expire,
|
||||
seqno = todo.seqno,
|
||||
request = todo.request,
|
||||
status = todo.status,
|
||||
okdate = okdateValue,
|
||||
wuid = todo.wuid,
|
||||
wdate = todo.wdate
|
||||
});
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Message = "할일이 추가되었습니다.",
|
||||
Data = new { idx = newId }
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "할일 추가 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public HttpResponseMessage UpdateTodo([FromBody] TodoModel todo)
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (todo.idx <= 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "유효하지 않은 Todo ID입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(todo.remark))
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "할일 내용은 필수입니다."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
string uid = FCOMMON.info.Login.no;
|
||||
|
||||
// 상태가 완료('5')로 변경되고 아직 완료일이 설정되지 않은 경우 완료일 설정
|
||||
DateTime? okdateValue = null;
|
||||
if (todo.status == '5')
|
||||
{
|
||||
// 기존 완료일이 있는지 확인
|
||||
var existingTodo = DBM.QuerySingleOrDefault<TodoModel>(
|
||||
"SELECT okdate FROM EETGW_Todo WHERE idx = @idx AND gcode = @gcode AND uid = @uid",
|
||||
new { idx = todo.idx, gcode = gcode, uid = uid });
|
||||
|
||||
if (existingTodo?.okdate == null)
|
||||
{
|
||||
okdateValue = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
var sql = @"
|
||||
UPDATE EETGW_Todo
|
||||
SET title = @title, remark = @remark, flag = @flag, expire = @expire, seqno = @seqno, request = @request, status = @status, okdate = @okdate
|
||||
WHERE idx = @idx AND gcode = @gcode AND uid = @uid";
|
||||
|
||||
var affectedRows = DBM.Execute(sql, new
|
||||
{
|
||||
title = todo.title,
|
||||
remark = todo.remark,
|
||||
flag = todo.flag ?? false,
|
||||
expire = todo.expire,
|
||||
seqno = todo.seqno ?? 0,
|
||||
request = todo.request,
|
||||
status = todo.status == '\0' ? '0' : todo.status,
|
||||
okdate = okdateValue,
|
||||
idx = todo.idx,
|
||||
gcode = gcode,
|
||||
uid = uid
|
||||
});
|
||||
|
||||
if (affectedRows == 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "수정할 할일을 찾을 수 없습니다."
|
||||
});
|
||||
}
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Message = "할일이 수정되었습니다."
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "할일 수정 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
public HttpResponseMessage DeleteTodo(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (id <= 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "유효하지 않은 Todo ID입니다."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
string uid = FCOMMON.info.Login.no;
|
||||
|
||||
var sql = "DELETE FROM EETGW_Todo WHERE idx = @idx AND gcode = @gcode AND uid = @uid";
|
||||
var affectedRows = DBM.Execute(sql, new { idx = id, gcode = gcode, uid = uid });
|
||||
|
||||
if (affectedRows == 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "삭제할 할일을 찾을 수 없습니다."
|
||||
});
|
||||
}
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Message = "할일이 삭제되었습니다."
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "할일 삭제 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetTodo(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = GetCurrentUser();
|
||||
if (currentUser == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "로그인되지 않은 상태입니다."
|
||||
});
|
||||
}
|
||||
|
||||
if (id <= 0)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "유효하지 않은 Todo ID입니다."
|
||||
});
|
||||
}
|
||||
|
||||
string gcode = FCOMMON.info.Login.gcode;
|
||||
string uid = FCOMMON.info.Login.no;
|
||||
|
||||
var sql = "SELECT * FROM EETGW_Todo WHERE idx = @idx AND gcode = @gcode AND uid = @uid";
|
||||
var todo = DBM.QuerySingleOrDefault<TodoModel>(sql, new { idx = id, gcode = gcode, uid = uid });
|
||||
|
||||
if (todo == null)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "할일을 찾을 수 없습니다."
|
||||
});
|
||||
}
|
||||
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = true,
|
||||
Data = todo
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CreateJsonResponse(new
|
||||
{
|
||||
Success = false,
|
||||
Message = "할일 조회 중 오류가 발생했습니다: " + ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private object GetCurrentUser()
|
||||
{
|
||||
if (string.IsNullOrEmpty(FCOMMON.info.Login.no)) return null;
|
||||
else return FCOMMON.info.Login;
|
||||
}
|
||||
|
||||
private HttpResponseMessage CreateJsonResponse(object data)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DateFormatString = "yyyy-MM-dd HH:mm:ss"
|
||||
});
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(
|
||||
json,
|
||||
System.Text.Encoding.UTF8,
|
||||
"application/json")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,44 @@ namespace Project.OWIN
|
||||
{
|
||||
public void Configuration(IAppBuilder app)
|
||||
{
|
||||
// Configure Web API for Self-Host
|
||||
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
|
||||
|
||||
// 정적 파일 서빙을 가장 먼저 설정 (다른 모든 미들웨어보다 우선)
|
||||
var staticFileOptions = new FileServerOptions
|
||||
{
|
||||
EnableDefaultFiles = true,
|
||||
DefaultFilesOptions = { DefaultFileNames = { "index.html" } },
|
||||
FileSystem = new Microsoft.Owin.FileSystems.PhysicalFileSystem("Web/wwwroot"),
|
||||
RequestPath = Microsoft.Owin.PathString.Empty
|
||||
};
|
||||
app.UseFileServer(staticFileOptions);
|
||||
|
||||
// 캐시 방지 미들웨어 (정적 파일이 처리되지 않은 경우에만 적용)
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
var path = context.Request.Path.Value;
|
||||
|
||||
if (path.EndsWith(".js") ||
|
||||
path.EndsWith(".css") ||
|
||||
path.EndsWith(".jsx") ||
|
||||
path.EndsWith(".tsx") ||
|
||||
path.EndsWith(".html"))
|
||||
{
|
||||
context.Response.Headers["Cache-Control"] = "no-cache, no-store, must-revalidate";
|
||||
context.Response.Headers["Pragma"] = "no-cache";
|
||||
context.Response.Headers["Expires"] = "0";
|
||||
}
|
||||
|
||||
// JSX/TSX 파일을 JavaScript로 처리
|
||||
if (path.EndsWith(".jsx") || path.EndsWith(".tsx"))
|
||||
{
|
||||
context.Response.ContentType = "application/javascript";
|
||||
}
|
||||
|
||||
await next();
|
||||
});
|
||||
|
||||
// Configure Web API for Self-Host (정적 파일 후에 설정)
|
||||
HttpConfiguration config = new HttpConfiguration();
|
||||
|
||||
//라우팅 설정
|
||||
@@ -41,31 +78,8 @@ namespace Project.OWIN
|
||||
// 파일 업로드 설정
|
||||
config.Formatters.Remove(config.Formatters.XmlFormatter);
|
||||
|
||||
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
|
||||
app.UseWebApi(config);
|
||||
|
||||
// 캐시 방지 미들웨어 추가 (정적 파일 서빙 전에 적용)
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
if (context.Request.Path.Value.EndsWith(".js") || context.Request.Path.Value.EndsWith(".css"))
|
||||
{
|
||||
context.Response.Headers["Cache-Control"] = "no-cache, no-store, must-revalidate";
|
||||
context.Response.Headers["Pragma"] = "no-cache";
|
||||
context.Response.Headers["Expires"] = "0";
|
||||
}
|
||||
await next();
|
||||
});
|
||||
|
||||
// 정적 파일 서빙 설정
|
||||
var options = new FileServerOptions
|
||||
{
|
||||
EnableDefaultFiles = true,
|
||||
DefaultFilesOptions = { DefaultFileNames = { "index.html" } },
|
||||
FileSystem = new Microsoft.Owin.FileSystems.PhysicalFileSystem("Web/wwwroot")
|
||||
};
|
||||
|
||||
app.UseFileServer(options);
|
||||
|
||||
//appBuilder.UseFileServer(new FileServerOptions
|
||||
//{
|
||||
// RequestPath = new PathString(string.Empty),
|
||||
|
||||
@@ -298,12 +298,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 공통 네비게이션 JS -->
|
||||
<script src="/js/common-navigation.js"></script>
|
||||
|
||||
<script>
|
||||
// 공통 네비게이션 컴포넌트
|
||||
class CommonNavigation {
|
||||
constructor(currentPage = '') {
|
||||
this.currentPage = currentPage;
|
||||
this.menuItems = [];
|
||||
// 공용코드 전용 스크립트
|
||||
this.init();
|
||||
}
|
||||
|
||||
|
||||
@@ -675,158 +675,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 공통 네비게이션 JS -->
|
||||
<script src="/js/common-navigation.js"></script>
|
||||
|
||||
<script>
|
||||
// 공통 네비게이션 컴포넌트
|
||||
class CommonNavigation {
|
||||
constructor(currentPage = '') {
|
||||
this.currentPage = currentPage;
|
||||
this.menuItems = [];
|
||||
this.init();
|
||||
}
|
||||
|
||||
async init() {
|
||||
try {
|
||||
await this.loadMenuItems();
|
||||
this.createNavigation();
|
||||
this.addEventListeners();
|
||||
} catch (error) {
|
||||
console.error('Navigation initialization failed:', error);
|
||||
this.createFallbackNavigation();
|
||||
}
|
||||
}
|
||||
|
||||
async loadMenuItems() {
|
||||
try {
|
||||
const response = await fetch('/Common/GetNavigationMenu');
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
|
||||
if (data.Success && data.Data) {
|
||||
this.menuItems = data.Data;
|
||||
} else {
|
||||
throw new Error(data.Message || 'Failed to load menu items');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load navigation menu:', error);
|
||||
this.menuItems = this.getDefaultMenuItems();
|
||||
}
|
||||
}
|
||||
|
||||
getDefaultMenuItems() {
|
||||
return [
|
||||
{ key: 'dashboard', title: '대시보드', url: '/Dashboard/', icon: 'M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z', isVisible: true, sortOrder: 1 },
|
||||
{ key: 'common', title: '공용코드', url: '/Common', icon: 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z', isVisible: true, sortOrder: 2 },
|
||||
{ key: 'jobreport', title: '업무일지', url: '/Jobreport/', icon: 'M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2', isVisible: true, sortOrder: 3 },
|
||||
{ key: 'kuntae', title: '근태관리', url: '/Kuntae/', icon: 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z', isVisible: true, sortOrder: 4 },
|
||||
{ key: 'todo', title: '할일관리', url: '/Todo/', icon: 'M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2M12 12l2 2 4-4', isVisible: true, sortOrder: 5 },
|
||||
{ key: 'project', title: '프로젝트', url: '/Project/', icon: 'M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10', isVisible: true, sortOrder: 6 },
|
||||
];
|
||||
}
|
||||
|
||||
createFallbackNavigation() {
|
||||
this.createNavigation();
|
||||
}
|
||||
|
||||
createNavigation() {
|
||||
const nav = document.createElement('nav');
|
||||
nav.className = 'glass-effect border-b border-white/10';
|
||||
nav.innerHTML = this.getNavigationHTML();
|
||||
|
||||
// body의 첫 번째 자식으로 추가
|
||||
document.body.insertBefore(nav, document.body.firstChild);
|
||||
}
|
||||
|
||||
getNavigationHTML() {
|
||||
const visibleItems = this.menuItems.filter(item => item.isVisible).sort((a, b) => a.sortOrder - b.sortOrder);
|
||||
return `
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="flex items-center justify-between h-16">
|
||||
<div class="flex items-center space-x-8">
|
||||
<div class="flex items-center space-x-2">
|
||||
<svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z"></path>
|
||||
</svg>
|
||||
<span class="text-xl font-bold text-white">GroupWare</span>
|
||||
</div>
|
||||
<nav class="hidden md:flex space-x-1">
|
||||
${visibleItems.map(item => `
|
||||
<a href="${item.url}" class="px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
this.currentPage === item.key
|
||||
? 'bg-white/20 text-white'
|
||||
: 'text-white/60 hover:text-white hover:bg-white/10'
|
||||
}">
|
||||
<svg class="w-4 h-4 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${item.icon}"></path>
|
||||
</svg>
|
||||
${item.title}
|
||||
</a>
|
||||
`).join('')}
|
||||
</nav>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<div class="text-sm text-white/60">
|
||||
<span id="currentUser">사용자</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
getMenuItemHTML(item) {
|
||||
const isActive = this.currentPage === item.key;
|
||||
const activeClass = isActive ? 'text-white bg-white/20' : 'text-white/80 hover:text-white hover:bg-white/10';
|
||||
|
||||
return `
|
||||
<a href="${item.url}" class="${activeClass} transition-colors px-3 py-2 rounded-lg">
|
||||
<svg class="w-4 h-4 inline mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${item.icon}"></path>
|
||||
</svg>
|
||||
${item.title}
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
getMobileMenuItemHTML(item) {
|
||||
const isActive = this.currentPage === item.key;
|
||||
const activeClass = isActive ? 'text-white bg-white/20' : 'text-white/80 hover:text-white hover:bg-white/10';
|
||||
|
||||
return `
|
||||
<a href="${item.url}" class="block ${activeClass} transition-colors px-3 py-2 rounded-lg mb-2">
|
||||
<svg class="w-4 h-4 inline mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${item.icon}"></path>
|
||||
</svg>
|
||||
${item.title}
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
addEventListeners() {
|
||||
// 모바일 메뉴 토글
|
||||
const mobileMenuButton = document.getElementById('mobile-menu-button');
|
||||
const mobileMenu = document.getElementById('mobile-menu');
|
||||
|
||||
if (mobileMenuButton && mobileMenu) {
|
||||
mobileMenuButton.addEventListener('click', function() {
|
||||
mobileMenu.classList.toggle('hidden');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 전역 함수로 내비게이션 초기화
|
||||
function initNavigation(currentPage = '') {
|
||||
// DOM이 로드된 후에 실행
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
new CommonNavigation(currentPage);
|
||||
});
|
||||
} else {
|
||||
new CommonNavigation(currentPage);
|
||||
}
|
||||
}
|
||||
// 대시보드 전용 스크립트
|
||||
|
||||
// 휴가 인원 Ajax 업데이트
|
||||
function updateLeaveCount() {
|
||||
|
||||
@@ -39,6 +39,10 @@ class CommonNavigation {
|
||||
${this.getMenuItemHTML('common', '/Common', '공용코드', 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z')}
|
||||
${this.getMenuItemHTML('jobreport', '/Jobreport/', '업무일지', 'M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2')}
|
||||
${this.getMenuItemHTML('kuntae', '/Kuntae/', '근태관리', 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z')}
|
||||
${this.getMenuItemHTML('todo', '/Todo/', '할일관리', 'M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2M12 12l2 2 4-4')}
|
||||
${this.getMenuItemHTML('project', '/Project/', '프로젝트', 'M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10')}
|
||||
${this.getMenuItemHTML('purchase', '/Purchase/', '구매관리', 'M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z')}
|
||||
${this.getMenuItemHTML('customer', '/Customer/', '고객관리', 'M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z')}
|
||||
</div>
|
||||
|
||||
<!-- 모바일 메뉴 버튼 -->
|
||||
@@ -57,6 +61,10 @@ class CommonNavigation {
|
||||
${this.getMobileMenuItemHTML('common', '/Common', '공용코드', 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z')}
|
||||
${this.getMobileMenuItemHTML('jobreport', '/Jobreport/', '업무일지', 'M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2')}
|
||||
${this.getMobileMenuItemHTML('kuntae', '/Kuntae/', '근태관리', 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z')}
|
||||
${this.getMobileMenuItemHTML('todo', '/Todo/', '할일관리', 'M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2M12 12l2 2 4-4')}
|
||||
${this.getMobileMenuItemHTML('project', '/Project/', '프로젝트', 'M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10')}
|
||||
${this.getMobileMenuItemHTML('purchase', '/Purchase/', '구매관리', 'M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z')}
|
||||
${this.getMobileMenuItemHTML('customer', '/Customer/', '고객관리', 'M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z')}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Project._Common
|
||||
{
|
||||
FCOMMON.Util.MsgE("견적서 폴더 업데이트 실패");
|
||||
}
|
||||
else Pub.log.AddI("견적서폴더 업뎅트 : " + tbKJPath.Text);
|
||||
else FCOMMON.Pub.log.AddI("견적서폴더 업뎅트 : " + tbKJPath.Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
158
Project/_add_to_project.py
Normal file
158
Project/_add_to_project.py
Normal file
@@ -0,0 +1,158 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
C# 프로젝트 파일 자동 업데이트 도구
|
||||
새로운 파일을 EETGW.csproj에 자동으로 등록합니다.
|
||||
"""
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
from typing import List, Tuple, Optional
|
||||
|
||||
class ProjectFileUpdater:
|
||||
def __init__(self, project_path: str = "EETGW.csproj"):
|
||||
self.project_path = project_path
|
||||
self.content = ""
|
||||
self.load_project()
|
||||
|
||||
def load_project(self) -> bool:
|
||||
"""프로젝트 파일 로드"""
|
||||
try:
|
||||
with open(self.project_path, 'r', encoding='utf-8') as f:
|
||||
self.content = f.read()
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"❌ 프로젝트 파일을 읽을 수 없습니다: {e}")
|
||||
return False
|
||||
|
||||
def save_project(self) -> bool:
|
||||
"""프로젝트 파일 저장"""
|
||||
try:
|
||||
with open(self.project_path, 'w', encoding='utf-8') as f:
|
||||
f.write(self.content)
|
||||
print("✅ 프로젝트 파일이 업데이트되었습니다.")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"❌ 프로젝트 파일 저장 실패: {e}")
|
||||
return False
|
||||
|
||||
def is_file_registered(self, file_path: str) -> bool:
|
||||
"""파일이 이미 등록되어 있는지 확인"""
|
||||
# Windows 스타일 경로로 변환
|
||||
windows_path = file_path.replace('/', '\\')
|
||||
unix_path = file_path.replace('\\', '/')
|
||||
|
||||
patterns = [
|
||||
f'Include="{windows_path}"',
|
||||
f"Include='{windows_path}'",
|
||||
f'Include="{unix_path}"',
|
||||
f"Include='{unix_path}'"
|
||||
]
|
||||
|
||||
return any(pattern in self.content for pattern in patterns)
|
||||
|
||||
def find_last_wwwroot_entry(self) -> Optional[Tuple[int, int]]:
|
||||
"""마지막 wwwroot 관련 항목의 위치 찾기"""
|
||||
pattern = r'<(?:Content|None) Include="Web\\wwwroot.*?</(?:Content|None)>'
|
||||
matches = list(re.finditer(pattern, self.content, re.DOTALL))
|
||||
|
||||
if matches:
|
||||
last_match = matches[-1]
|
||||
return (last_match.start(), last_match.end())
|
||||
|
||||
return None
|
||||
|
||||
def add_file_to_project(self, file_path: str, file_type: str = "None") -> bool:
|
||||
"""파일을 프로젝트에 추가"""
|
||||
# Windows 스타일 경로로 변환
|
||||
windows_path = file_path.replace('/', '\\')
|
||||
|
||||
# 이미 등록된 파일인지 확인
|
||||
if self.is_file_registered(windows_path):
|
||||
print(f"⚠️ 파일이 이미 등록되어 있습니다: {windows_path}")
|
||||
return False
|
||||
|
||||
# 새로운 항목 생성
|
||||
new_entry = f''' <{file_type} Include="{windows_path}">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</{file_type}>'''
|
||||
|
||||
# 마지막 wwwroot 항목 찾기
|
||||
last_entry_pos = self.find_last_wwwroot_entry()
|
||||
|
||||
if last_entry_pos:
|
||||
start_pos, end_pos = last_entry_pos
|
||||
# 마지막 항목 다음에 새 항목 삽입
|
||||
self.content = (
|
||||
self.content[:end_pos] +
|
||||
'\n' + new_entry +
|
||||
self.content[end_pos:]
|
||||
)
|
||||
print(f"✅ 파일이 프로젝트에 추가되었습니다: {windows_path}")
|
||||
return True
|
||||
else:
|
||||
print("❌ wwwroot 섹션을 찾을 수 없습니다.")
|
||||
return False
|
||||
|
||||
def add_multiple_files(self, files: List[Tuple[str, str]]) -> int:
|
||||
"""여러 파일을 한 번에 추가"""
|
||||
added_count = 0
|
||||
|
||||
for file_path, file_type in files:
|
||||
if self.add_file_to_project(file_path, file_type):
|
||||
added_count += 1
|
||||
|
||||
return added_count
|
||||
|
||||
def add_react_component_files(component_name: str) -> bool:
|
||||
"""React 컴포넌트 관련 파일들을 프로젝트에 추가"""
|
||||
updater = ProjectFileUpdater()
|
||||
|
||||
files_to_add = [
|
||||
(f"Web\\wwwroot\\react\\{component_name}.jsx", "None"),
|
||||
(f"Web\\wwwroot\\react-{component_name.lower()}.html", "None")
|
||||
]
|
||||
|
||||
added_count = updater.add_multiple_files(files_to_add)
|
||||
|
||||
if added_count > 0:
|
||||
updater.save_project()
|
||||
print(f"🎉 {component_name} 컴포넌트 관련 {added_count}개 파일이 등록되었습니다!")
|
||||
return True
|
||||
else:
|
||||
print("추가된 파일이 없습니다.")
|
||||
return False
|
||||
|
||||
def add_single_file(file_path: str, file_type: str = "None") -> bool:
|
||||
"""단일 파일을 프로젝트에 추가"""
|
||||
updater = ProjectFileUpdater()
|
||||
|
||||
if updater.add_file_to_project(file_path, file_type):
|
||||
updater.save_project()
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def main():
|
||||
"""CLI 메인 함수"""
|
||||
if len(sys.argv) < 2:
|
||||
print("사용법:")
|
||||
print(" python _add_to_project.py <파일경로> [파일타입]")
|
||||
print(" python _add_to_project.py --react <컴포넌트명>")
|
||||
print("")
|
||||
print("예시:")
|
||||
print(" python _add_to_project.py 'Web\\wwwroot\\react\\MyComponent.jsx'")
|
||||
print(" python _add_to_project.py --react Dashboard")
|
||||
sys.exit(1)
|
||||
|
||||
if sys.argv[1] == "--react" and len(sys.argv) >= 3:
|
||||
component_name = sys.argv[2]
|
||||
add_react_component_files(component_name)
|
||||
else:
|
||||
file_path = sys.argv[1]
|
||||
file_type = sys.argv[2] if len(sys.argv) > 2 else "None"
|
||||
add_single_file(file_path, file_type)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
177
Project/_project_updater.js
Normal file
177
Project/_project_updater.js
Normal file
@@ -0,0 +1,177 @@
|
||||
// C# 프로젝트 파일 자동 업데이트 헬퍼
|
||||
// 새로운 파일을 생성할 때 EETGW.csproj에 자동으로 등록하는 스크립트
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
class ProjectUpdater {
|
||||
constructor(projectPath = 'EETGW.csproj') {
|
||||
this.projectPath = projectPath;
|
||||
this.projectContent = '';
|
||||
this.loadProject();
|
||||
}
|
||||
|
||||
loadProject() {
|
||||
try {
|
||||
this.projectContent = fs.readFileSync(this.projectPath, 'utf8');
|
||||
} catch (error) {
|
||||
console.error('프로젝트 파일을 읽을 수 없습니다:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 새로운 파일을 프로젝트에 등록
|
||||
* @param {string} filePath - Web/wwwroot로 시작하는 상대 경로
|
||||
* @param {string} fileType - 'Content' 또는 'None' (기본값: 'None')
|
||||
*/
|
||||
addFile(filePath, fileType = 'None') {
|
||||
// 파일 경로를 백슬래시로 변경 (Windows 형식)
|
||||
const windowsPath = filePath.replace(/\//g, '\\');
|
||||
|
||||
// 이미 등록된 파일인지 확인
|
||||
if (this.isFileAlreadyRegistered(windowsPath)) {
|
||||
console.log(`파일이 이미 등록되어 있습니다: ${windowsPath}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 새로운 항목 생성
|
||||
const newEntry = ` <${fileType} Include="${windowsPath}">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</${fileType}>`;
|
||||
|
||||
// 마지막 wwwroot 관련 항목 찾기
|
||||
const lastWwwrootMatch = this.findLastWwwrootEntry();
|
||||
|
||||
if (lastWwwrootMatch) {
|
||||
// 마지막 wwwroot 항목 다음에 삽입
|
||||
const insertPosition = lastWwwrootMatch.index + lastWwwrootMatch[0].length;
|
||||
this.projectContent =
|
||||
this.projectContent.slice(0, insertPosition) +
|
||||
'\n' + newEntry +
|
||||
this.projectContent.slice(insertPosition);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
console.error('wwwroot 섹션을 찾을 수 없습니다.');
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일이 이미 등록되어 있는지 확인
|
||||
*/
|
||||
isFileAlreadyRegistered(filePath) {
|
||||
const patterns = [
|
||||
`Include="${filePath}"`,
|
||||
`Include='${filePath}'`,
|
||||
filePath.replace(/\\/g, '/') // 슬래시 형태도 확인
|
||||
];
|
||||
|
||||
return patterns.some(pattern => this.projectContent.includes(pattern));
|
||||
}
|
||||
|
||||
/**
|
||||
* 마지막 wwwroot 관련 항목 찾기
|
||||
*/
|
||||
findLastWwwrootEntry() {
|
||||
const wwwrootPattern = /<(?:Content|None) Include="Web\\wwwroot.*?<\/(?:Content|None)>/gs;
|
||||
let lastMatch = null;
|
||||
let match;
|
||||
|
||||
while ((match = wwwrootPattern.exec(this.projectContent)) !== null) {
|
||||
lastMatch = match;
|
||||
}
|
||||
|
||||
return lastMatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프로젝트 파일 저장
|
||||
*/
|
||||
saveProject() {
|
||||
try {
|
||||
fs.writeFileSync(this.projectPath, this.projectContent, 'utf8');
|
||||
console.log('프로젝트 파일이 업데이트되었습니다.');
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('프로젝트 파일 저장 실패:', error.message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 파일을 한 번에 등록
|
||||
*/
|
||||
addFiles(files) {
|
||||
let hasChanges = false;
|
||||
|
||||
files.forEach(({ path, type = 'None' }) => {
|
||||
if (this.addFile(path, type)) {
|
||||
hasChanges = true;
|
||||
console.log(`추가됨: ${path}`);
|
||||
}
|
||||
});
|
||||
|
||||
return hasChanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* React 관련 파일들 자동 등록
|
||||
*/
|
||||
addReactFiles(basePath) {
|
||||
const reactFiles = [
|
||||
{ path: `${basePath}.html`, type: 'None' },
|
||||
{ path: `${basePath}.jsx`, type: 'None' }
|
||||
];
|
||||
|
||||
return this.addFiles(reactFiles);
|
||||
}
|
||||
}
|
||||
|
||||
// 사용 예시
|
||||
function addNewReactComponent(componentName) {
|
||||
const updater = new ProjectUpdater();
|
||||
const basePath = `Web\\wwwroot\\react\\${componentName}`;
|
||||
|
||||
const files = [
|
||||
{ path: `${basePath}.jsx`, type: 'None' },
|
||||
{ path: `Web\\wwwroot\\react-${componentName.toLowerCase()}.html`, type: 'None' }
|
||||
];
|
||||
|
||||
if (updater.addFiles(files)) {
|
||||
updater.saveProject();
|
||||
console.log(`✅ ${componentName} 컴포넌트 파일들이 프로젝트에 등록되었습니다.`);
|
||||
}
|
||||
}
|
||||
|
||||
// 일반 파일 추가
|
||||
function addNewFile(filePath, fileType = 'None') {
|
||||
const updater = new ProjectUpdater();
|
||||
|
||||
if (updater.addFile(filePath, fileType)) {
|
||||
updater.saveProject();
|
||||
console.log(`✅ 파일이 프로젝트에 등록되었습니다: ${filePath}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ProjectUpdater,
|
||||
addNewReactComponent,
|
||||
addNewFile
|
||||
};
|
||||
|
||||
// CLI에서 직접 실행할 수 있도록
|
||||
if (require.main === module) {
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
if (args.length === 0) {
|
||||
console.log('사용법: node _project_updater.js <파일경로> [파일타입]');
|
||||
console.log('예시: node _project_updater.js "Web\\wwwroot\\react\\NewComponent.jsx" None');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const filePath = args[0];
|
||||
const fileType = args[1] || 'None';
|
||||
|
||||
addNewFile(filePath, fileType);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace Project
|
||||
public fLog()
|
||||
{
|
||||
InitializeComponent();
|
||||
Pub.log.RaiseMsg += Log_RaiseMsg;
|
||||
FCOMMON.Pub.log.RaiseMsg += Log_RaiseMsg;
|
||||
this.FormClosed += FLog_FormClosed;
|
||||
this.KeyDown += (s1, e1) => {
|
||||
if (e1.KeyCode == Keys.Escape) this.Close();
|
||||
@@ -24,7 +24,7 @@ namespace Project
|
||||
|
||||
private void FLog_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Pub.log.RaiseMsg -= Log_RaiseMsg;
|
||||
FCOMMON.Pub.log.RaiseMsg -= Log_RaiseMsg;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Project
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.logTextBox1.LoadFile(Pub.log.FileName, RichTextBoxStreamType.PlainText);
|
||||
this.logTextBox1.LoadFile(FCOMMON.Pub.log.FileName, RichTextBoxStreamType.PlainText);
|
||||
this.logTextBox1.ForeColor = Color.White;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace Project
|
||||
// }
|
||||
//}
|
||||
//catch { }
|
||||
FCOMMON.Pub.FlushLog();
|
||||
}
|
||||
|
||||
bool closeforce = false;
|
||||
@@ -92,8 +93,8 @@ namespace Project
|
||||
}
|
||||
}
|
||||
|
||||
Pub.log.Add("Program Close");
|
||||
Pub.log.Flush();
|
||||
FCOMMON.Pub.log.Add("Program Close");
|
||||
FCOMMON.Pub.log.Flush();
|
||||
}
|
||||
|
||||
|
||||
@@ -126,14 +127,14 @@ namespace Project
|
||||
var options = new StartOptions(Pub.setting.WebServiceURL);
|
||||
webApp = WebApp.Start<OWIN.Startup>(options);
|
||||
Console.WriteLine("start webapp");
|
||||
Pub.log.AddI("웹지원 서버 준비 완료");
|
||||
FCOMMON.Pub.log.AddI("웹지원 서버 준비 완료");
|
||||
webok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//Util.MsgE("Web Interface Error\r\n" + ex.Message)/;
|
||||
Console.WriteLine(ex.Message);
|
||||
Pub.log.AddE("웹지원오류" + ex.Message);
|
||||
FCOMMON.Pub.log.AddE("웹지원오류" + ex.Message);
|
||||
webok = false;
|
||||
}
|
||||
|
||||
@@ -237,7 +238,7 @@ namespace Project
|
||||
FCOMMON.info.Login.tel,
|
||||
FCOMMON.info.Login.dept,
|
||||
FCOMMON.info.Login.gcode);
|
||||
Pub.log.Add("Program Start");
|
||||
FCOMMON.Pub.log.Add("Program Start");
|
||||
|
||||
sbLoginUseTime.Text = "접속시간:" + FCOMMON.info.Login.loginusetime.ToString("N1") + "ms";
|
||||
|
||||
@@ -285,7 +286,7 @@ namespace Project
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
Pub.log.Add("BCD", "Rx:" + e.StrValue);
|
||||
FCOMMON.Pub.log.Add("BCD", "Rx:" + e.StrValue);
|
||||
}
|
||||
|
||||
void Menu_Log()
|
||||
@@ -303,8 +304,8 @@ namespace Project
|
||||
FCOMMON.info.camIndex = Pub.setting.CamIndex;
|
||||
FCOMMON.info.Disable_8hourover = Pub.setting.Disable8HourOver;
|
||||
Pub.setting.Save();
|
||||
Pub.log.AddI("Setting Save");
|
||||
Pub.log.Add(Pub.setting.ToString());
|
||||
FCOMMON.Pub.log.AddI("Setting Save");
|
||||
FCOMMON.Pub.log.Add(Pub.setting.ToString());
|
||||
UpdateControls();
|
||||
setToolbar();
|
||||
}
|
||||
|
||||
@@ -281,13 +281,13 @@ namespace Project.Dialog
|
||||
MessageBox.Show(warningMessage, "포트 충돌 경고", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}));
|
||||
|
||||
Pub.log.Add($"포트 7979가 이미 사용 중입니다. 웹서버 시작에 문제가 발생할 수 있습니다.");
|
||||
FCOMMON.Pub.log.Add($"포트 7979가 이미 사용 중입니다. 웹서버 시작에 문제가 발생할 수 있습니다.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 포트 체크 중 오류가 발생해도 프로그램 실행은 계속
|
||||
Pub.log.AddE($"포트 7979 체크 중 오류 발생: {ex.Message}");
|
||||
FCOMMON.Pub.log.AddE($"포트 7979 체크 중 오류 발생: {ex.Message}");
|
||||
Console.WriteLine($"Port check error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user