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
8544537f
Commit
8544537f
authored
Sep 01, 2021
by
solho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
取得權限資料邏輯調整
parent
96045529
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
31 deletions
+37
-31
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
+37
-31
No files found.
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
View file @
8544537f
...
...
@@ -62,7 +62,19 @@ namespace WebAPI.Controllers
left join [evw_qResult_EmpItem] d on a.ItemNum=d.Emp_ItemNum
where 1=1 @wherecase2
"
;
JObject
objPermission_furtherSql
=
JObject
.
Parse
(
obj_input
[
"Permission_furtherSql"
].
ToString
());
if
(
obj_input
[
"Permission_furtherSql"
]
!=
null
)
{
JObject
objPermission_furtherSql
=
JObject
.
Parse
(
obj_input
[
"Permission_furtherSql"
].
ToString
());
if
(
objPermission_furtherSql
[
"firmID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"firmID"
].
ToString
()))
{
@wherecase1
+=
" and b.ID in(@DSid)"
;
@wherecase2
+=
" and b.ID in(@DSid)"
;
@wherecase1
=
@wherecase1
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
@wherecase2
=
@wherecase2
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
//cmd.Parameters.Add("@DSid", objPermission_furtherSql["firmID"].ToString());
}
}
if
(
obj_input
[
"Settle_Date"
]
!=
null
)
{
@wherecase2
+=
" and Settle_Date between @Settle_Date and @Settle_Date "
;
...
...
@@ -74,21 +86,13 @@ namespace WebAPI.Controllers
@wherecase2
+=
" and isClosed=@isClosed "
;
cmd
.
Parameters
.
AddWithValue
(
"@isClosed"
,
(
obj_input
[
"isClosed"
].
ToString
()
==
"1"
?
true
:
false
));
}
if
(
objPermission_furtherSql
[
"firmID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"firmID"
].
ToString
()))
{
@wherecase1
+=
" and b.ID in(@DSid)"
;
@wherecase2
+=
" and b.ID in(@DSid)"
;
@wherecase1
=
@wherecase1
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
@wherecase2
=
@wherecase2
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
//cmd.Parameters.Add("@DSid", objPermission_furtherSql["firmID"].ToString());
}
strsql
=
strsql
.
Replace
(
"@wherecase1"
,
@wherecase1
).
Replace
(
"@wherecase2"
,
@wherecase2
);
strsql
+=
" order by a.Settle_Date"
;
response
.
Code
=
"1"
;
cmd
.
CommandText
=
strsql
;
DataTable
dt
=
SqlToDt
(
cmd
);
response
.
Msg
=
JsonConvert
.
SerializeObject
(
dt
);
response
.
Msg
=
JsonConvert
.
SerializeObject
(
dt
);
result
.
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
response
),
System
.
Text
.
Encoding
.
UTF8
,
"application/json"
);
}
...
...
@@ -127,14 +131,32 @@ namespace WebAPI.Controllers
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connString
))
{
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
);
String
strsql
=
""
,
Permission_furtherSql
=
obj_input
[
"Permission_furtherSql"
].
ToString
()
;
strsql
+=
String
.
Format
(
@"select a.id, Settle_Date ,isClosed ,Emp_DS ,a.update_time,b.id as DStargetid from [esn_todos_Settle] a
String
strsql
=
""
;
strsql
+=
String
.
Format
(
@"select a.id, Settle_Date ,isClosed ,Emp_DS ,a.update_time,b.id as DStargetid
,b.Emp_DSNum
from [esn_todos_Settle] a
inner join [evw_qResult_EmpDS] b on a.DSNum=b.Emp_DSNum
left join [evw_qResult_Dept] c on a.DeptNum=c.targetID
left join [evw_qResult_EmpItem] d on a.ItemNum=d.Emp_ItemNum
where 1=1 "
);
JObject
objPermission_furtherSql
=
JObject
.
Parse
(
obj_input
[
"Permission_furtherSql"
].
ToString
());
if
(
obj_input
[
"Permission_furtherSql"
]
!=
null
)
{
JObject
objPermission_furtherSql
=
JObject
.
Parse
(
obj_input
[
"Permission_furtherSql"
].
ToString
());
if
(
objPermission_furtherSql
[
"firmID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"firmID"
].
ToString
()))
{
strsql
+=
" and b.ID in(@DSid)"
;
strsql
=
strsql
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
//cmd.Parameters.Add("@DSid", objPermission_furtherSql["firmID"].ToString());
}
if
(
objPermission_furtherSql
[
"deptID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"deptID"
].
ToString
()))
{
//strsql += " and DeptNum in(@DeptNum)";
//cmd.Parameters.Add("@DeptNum", objPermission_furtherSql["deptID"].ToString());
}
if
(
objPermission_furtherSql
[
"workGroupID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"workGroupID"
].
ToString
()))
{
//strsql += " and ItemNum in(@ItemNum)";
//cmd.Parameters.Add("@ItemNum", objPermission_furtherSql["workGroupID"].ToString());
}
}
if
(
obj_input
[
"Settle_Date"
]!=
null
&&
!
String
.
IsNullOrEmpty
(
obj_input
[
"Settle_Date"
].
ToString
())
)
{
strsql
+=
" and Settle_Date between @Settle_Date_begin and @Settle_Date_end "
;
...
...
@@ -147,22 +169,6 @@ namespace WebAPI.Controllers
strsql
+=
" and isClosed=@isClosed "
;
cmd
.
Parameters
.
AddWithValue
(
"@isClosed"
,
(
obj_input
[
"isClosed"
].
ToString
()==
"1"
?
true
:
false
));
}
if
(
objPermission_furtherSql
[
"firmID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"firmID"
].
ToString
()))
{
strsql
+=
" and b.ID in(@DSid)"
;
strsql
=
strsql
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
//cmd.Parameters.Add("@DSid", objPermission_furtherSql["firmID"].ToString());
}
if
(
objPermission_furtherSql
[
"deptID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"deptID"
].
ToString
()))
{
//strsql += " and DeptNum in(@DeptNum)";
//cmd.Parameters.Add("@DeptNum", objPermission_furtherSql["deptID"].ToString());
}
if
(
objPermission_furtherSql
[
"workGroupID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"workGroupID"
].
ToString
()))
{
//strsql += " and ItemNum in(@ItemNum)";
//cmd.Parameters.Add("@ItemNum", objPermission_furtherSql["workGroupID"].ToString());
}
cmd
.
CommandText
=
strsql
;
DataTable
dt
=
SqlToDt
(
cmd
);
response
.
Msg
=
JsonConvert
.
SerializeObject
(
dt
);
...
...
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