116 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			116 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using FCOMMON;
 | |
| using Newtonsoft.Json;
 | |
| using System;
 | |
| using System.Linq;
 | |
| using System.Net.Http;
 | |
| using System.Security.Cryptography;
 | |
| using System.Web.Http;
 | |
| 
 | |
| namespace Project
 | |
| {
 | |
|     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 " +
 | |
|                 "where gcode  = 'EET1P' and conf = 1 and HolyDays > 0 and " +
 | |
|                 "sdate <= GETDATE() and edate >= GETDATE()";
 | |
|             var cnt = DBM.ExecuteScalar(sql);
 | |
|             return cnt.ToString();
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
|         [HttpGet]
 | |
|         public HttpResponseMessage GetholyUser()
 | |
|         {
 | |
|             var sql = string.Empty;
 | |
|             sql = $"select uid,cate,sdate,edate,HolyReason " +
 | |
|                 $"from EETGW_HolydayRequest " +
 | |
|                 $"where gcode  = '{FCOMMON.info.Login.gcode}'" +
 | |
|                 $"and conf = 1 and HolyDays > 0 and sdate <= GETDATE() and edate >= GETDATE()";
 | |
| 
 | |
|             if (info.Login.gcode == null)
 | |
|                 info.Login.gcode = "EET1P";
 | |
| 
 | |
|             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;
 | |
|         }
 | |
| 
 | |
|     }
 | |
| }
 | 
