Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
code
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
solho
code
Commits
677eeb43
Commit
677eeb43
authored
Aug 11, 2022
by
solho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:新增USERINFO ,發文管理API
parent
c84f5c1e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
151 additions
and
1 deletion
+151
-1
WebAPI/Controllers/UserInfoController.cs
WebAPI/Controllers/UserInfoController.cs
+65
-1
WebAPI/Controllers/WadeMailController.cs
WebAPI/Controllers/WadeMailController.cs
+86
-0
No files found.
WebAPI/Controllers/UserInfoController.cs
View file @
677eeb43
...
@@ -14,15 +14,22 @@ using WebAPI.Tool;
...
@@ -14,15 +14,22 @@ using WebAPI.Tool;
using
Dapper
;
using
Dapper
;
using
System.Reflection
;
using
System.Reflection
;
using
Dapper.Contrib.Extensions
;
using
Dapper.Contrib.Extensions
;
using
DapperQueryBuilder
;
using
Newtonsoft.Json.Linq
;
namespace
WebAPI.Controllers
namespace
WebAPI.Controllers
{
{
public
class
UserInfoController
:
ApiController
public
class
UserInfoController
:
ApiController
{
{
String
connectionString
=
ConfigurationManager
.
ConnectionStrings
[
"DefaultConnection"
].
ConnectionString
;
String
connectionString
;
HttpResponseMessage
result
;
CommonResponseMsg
response
;
public
UserInfoController
()
public
UserInfoController
()
{
{
result
=
new
HttpResponseMessage
(
HttpStatusCode
.
OK
);
response
=
new
CommonResponseMsg
();
connectionString
=
ConfigurationManager
.
ConnectionStrings
[
"DefaultConnection"
].
ConnectionString
;
}
}
...
@@ -412,5 +419,62 @@ namespace WebAPI.Controllers
...
@@ -412,5 +419,62 @@ namespace WebAPI.Controllers
return
list_all_sub_dept
;
return
list_all_sub_dept
;
}
}
}
}
/// <summary>
/// 取得WADE員工資訊
/// </summary>
/// <returns></returns>
[
Route
(
"UserInfo/Get_evw_Employee"
)]
[
CorsHandle
]
[
HttpPost
]
public
HttpResponseMessage
Get_evw_Employee
(
ParamModel
param
)
{
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
{
string
input
=
param
.
Input
.
ToString
();
try
{
JObject
obj_input
=
JObject
.
Parse
(
input
.
ToString
());
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connectionString
))
{
var
dysql
=
Conn
.
QueryBuilder
(
$@" select user_id,emp_no,cn_name,main_email,manage_center,Emp_DS,Emp_DeptName,Emp_DeptGroup from evw_Employee eel
/**where**/ "
);
if
(
obj_input
[
"manage_center_TargetID"
]
!=
null
)
{
dysql
.
Where
(
$" manage_center_TargetID =
{
obj_input
[
"manage_center_TargetID"
].
ToString
()}
"
);
}
if
(
obj_input
[
"Emp_DS_TargetID"
]
!=
null
)
{
dysql
.
Where
(
$" Emp_DS_TargetID =
{
obj_input
[
"Emp_DS_TargetID"
].
ToString
()}
"
);
}
if
(
obj_input
[
"Emp_Item_TargetID"
]
!=
null
)
{
dysql
.
Where
(
$" Emp_Item_TargetID =
{
obj_input
[
"Emp_Item_TargetID"
].
ToString
()}
"
);
}
if
(
obj_input
[
"Emp_DeptGroup_TargetID"
]
!=
null
)
{
dysql
.
Where
(
$" Emp_DeptGroup_TargetID =
{
obj_input
[
"Emp_DeptGroup_TargetID"
].
ToString
()}
"
);
}
var
results
=
dysql
.
Query
();
response
.
Msg
=
JsonConvert
.
SerializeObject
(
results
);
response
.
Code
=
"1"
;
}
}
catch
(
Exception
e
)
{
response
.
Code
=
"0"
;
response
.
Msg
=
"Exception:"
+
e
.
StackTrace
;
}
}
else
{
response
.
Code
=
"0"
;
response
.
Msg
=
"no input or format error"
;
}
result
.
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
response
),
System
.
Text
.
Encoding
.
UTF8
,
"application/json"
);
return
result
;
}
}
}
}
}
\ No newline at end of file
WebAPI/Controllers/WadeMailController.cs
0 → 100644
View file @
677eeb43
using
Dapper
;
using
DapperQueryBuilder
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Configuration
;
using
System.Data
;
using
System.Data.SqlClient
;
using
System.Net
;
using
System.Net.Http
;
using
System.Web
;
using
System.Web.Http
;
using
WebAPI.Models
;
using
static
WebAPI
.
Tool
.
Common
;
namespace
WebAPI.Controllers
{
public
class
WadeMailController
:
ApiController
{
HttpResponseMessage
result
;
CommonResponseMsg
response
;
String
connString
;
public
WadeMailController
()
{
result
=
new
HttpResponseMessage
(
HttpStatusCode
.
OK
);
response
=
new
CommonResponseMsg
();
connString
=
ConfigurationManager
.
ConnectionStrings
[
"DefaultConnection"
].
ConnectionString
;
}
/// <summary>
/// 取得 Mail_js內返稿文件命名規範 資訊
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[
Route
(
"Get_essen_back_file_rule"
)]
[
CorsHandle
]
[
HttpPost
]
public
HttpResponseMessage
Get_essen_back_file_rule
(
ParamModel
param
)
{
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
{
string
input
=
param
.
Input
.
ToString
();
try
{
JObject
obj_input
=
JObject
.
Parse
(
input
.
ToString
());
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connString
))
{
var
dysql
=
Conn
.
QueryBuilder
(
$@"
SELECT cc.customer_name,icp.ctrl_proc_zh_tw,ebfr.* FROM essen_back_file_rule ebfr
left join c_customer cc on cc.customer_id =ebfr.customer_id
left join i_ctrl_proc icp on icp.ctrl_proc_id =ebfr.ctrl_proc_id
/**where**/ "
);
if
(
obj_input
[
"ctrl_proc_id"
]
!=
null
)
{
dysql
.
Where
(
$"icp.ctrl_proc_id in (
{
obj_input
[
"ctrl_proc_id"
].
ToString
()}
)"
);
}
if
(
obj_input
[
"customer_id"
]
!=
null
)
{
dysql
.
Where
(
$"cc.customer_id in (
{
obj_input
[
"customer_id"
].
ToString
()}
)"
);
}
if
(
obj_input
[
"country_id"
]
!=
null
)
{
dysql
.
Where
(
$" ebfr.country_id in (
{
obj_input
[
"country_id"
].
ToString
()}
)"
);
}
var
results
=
dysql
.
Query
();
response
.
Msg
=
JsonConvert
.
SerializeObject
(
results
);
response
.
Code
=
"1"
;
}
}
catch
(
Exception
e
)
{
response
.
Code
=
"0"
;
response
.
Msg
=
"Exception:"
+
e
.
StackTrace
;
}
}
else
{
response
.
Code
=
"0"
;
response
.
Msg
=
"no input or format error"
;
}
result
.
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
response
),
System
.
Text
.
Encoding
.
UTF8
,
"application/json"
);
return
result
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment