This commit is contained in:
2025-11-12 16:20:51 +08:00
parent 5ae262205c
commit cd05ad2305
3 changed files with 42 additions and 47 deletions

View File

@@ -220,32 +220,32 @@ public class orderController : ApiController
if (!string.IsNullOrEmpty(q.address))
qry = qry.Where(o => o.address.Contains(q.address.Trim()));
if (!string.IsNullOrEmpty(q.subject))
qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(q.subject?.Trim()));
qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(q.subject.Trim()));
if (!string.IsNullOrEmpty(q.u_name))
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(q.u_name?.Trim()));
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(q.u_name.Trim()));
if (!string.IsNullOrEmpty(q.introducerTxt))
qry = qry.Where(o => o.introducer.HasValue && o.follower1.u_name.Contains(q.introducerTxt?.Trim()));
qry = qry.Where(o => o.introducer.HasValue && o.follower1.u_name.Contains(q.introducerTxt.Trim()));
if (!string.IsNullOrEmpty(q.actItemTxt))
{
//qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.order_no == o.order_no && aIDt.ToArray().Contains(f2.actItem_num?.ToString())).Count() > 0);
// qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.order_no == o.order_no && aIDt.Any(x => x == f2.actItem_num)).Count() > 0);
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem.subject.Contains(q.actItemTxt?.Trim())).Count() > 0);
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem.subject.Contains(q.actItemTxt.Trim())).Count() > 0);
}
if (!string.IsNullOrEmpty(q.country))
qry = qry.Where(o => o.f_num != null && o.follower?.country == q.country);
qry = qry.Where(o => o.f_num != null && o.follower != null && o.follower.country == q.country);
if (!string.IsNullOrEmpty(q.country2))
{
if (q.country2 == "1")
{
qry = qry.Where(o => o.f_num != null && o.follower?.country == "158");
qry = qry.Where(o => o.f_num != null && o.follower != null && o.follower.country == "158");
}
else if (q.country2 == "2")
{
qry = qry.Where(o => o.f_num != null && o.follower?.country != "158");
qry = qry.Where(o => o.f_num != null && o.follower != null && o.follower.country != "158");
}
}
@@ -275,16 +275,16 @@ public class orderController : ApiController
else if (sortBy.Equals("u_name"))
{
if (sortDesc)
qry = qry.OrderByDescending(o => o.follower?.u_name);
qry = qry.OrderByDescending(o => o.follower != null ? o.follower.u_name : "");
else
qry = qry.OrderBy(o => o.follower?.u_name);
qry = qry.OrderBy(o => o.follower != null ? o.follower.u_name : "");
}
else if (sortBy.Equals("subject"))
{
if (sortDesc)
qry = qry.OrderByDescending(o => o.activity?.subject);
qry = qry.OrderByDescending(o => o.activity != null ? o.activity.subject : "");
else
qry = qry.OrderBy(o => o.activity?.subject);
qry = qry.OrderBy(o => o.activity != null ? o.activity.subject : "");
}
else
qry = qry.OrderByDescending(o => o.reg_time);
@@ -802,7 +802,7 @@ public class orderController : ApiController
//家族 : 家長是我的人,跟我同家長的人,我的家長本人,我本人
var ccList = _db.followers.Where(x => x.num == _follower || x.leader == _follower).Select(x => x.num).ToList();
var qry = _db.followers.Where(f => ccList.Contains(f.num) || ccList.Contains(f.leader));
var qry = _db.followers.Where(f => ccList.Contains(f.num) || (f.leader.HasValue && ccList.Contains(f.leader.Value)));
//未付款資料
var unpayDt = _db.pro_order_detail.AsQueryable();