diff --git a/web/App_Code/api/activityController.cs b/web/App_Code/api/activityController.cs index d76189a..7e6a123 100644 --- a/web/App_Code/api/activityController.cs +++ b/web/App_Code/api/activityController.cs @@ -1340,7 +1340,11 @@ public class activityController : ApiController if (q.activity_num.HasValue && q.activity_num > 0) qry = qry.Where(o => o.activity_num == q.activity_num); if (q.check_time.HasValue) - qry = qry.Where(o => o.reg_time.Value.Date == q.check_time.Value.Date); + { + var checkDate = q.check_time.Value.Date; + var checkDateEnd = checkDate.AddDays(1); + qry = qry.Where(o => o.reg_time >= checkDate && o.reg_time < checkDateEnd); + } if (sortBy.Equals("subject")) @@ -1461,7 +1465,7 @@ public class activityController : ApiController qry = qry.Where(o => o.reg_time < Convert.ToDateTime(q.reg_time2.Value).AddDays(1)); - qry = qry.Where(o => (_now >= o.startDate_solar && _now < o.endDate_lunar) || (_now < o.startDate_solar && o.dueDate.HasValue && o.dueDate.Value.Date.CompareTo(_now) <= 180)); + qry = qry.Where(o => (_now >= o.startDate_solar && _now < o.endDate_lunar) || (_now < o.startDate_solar && o.dueDate.HasValue && DbFunctions.DiffDays(o.dueDate, _now) <= 180)); qry = qry.OrderByDescending(o => o.num); @@ -1474,9 +1478,16 @@ public class activityController : ApiController var r1 = qry.ToList(); var r2 = r1.Select(x => new { num = x.num, subject = x.subject }); var count = qry.Count(); + + // 計算昨天和今天的日期範圍 + var yesterdayStart = _now.Date.AddDays(-1); + var yesterdayEnd = _now.Date; + var todayStart = _now.Date; + var todayEnd = _now.Date.AddDays(1); + var ret = new { - list = qry.ToList().Select(x => new + list = r1.Select(x => new { num = x.num, subject = x.subject, @@ -1485,9 +1496,9 @@ public class activityController : ApiController startDate_lunar = x.startDate_lunar, endDate_lunar = x.endDate_lunar, order_qty = x.pro_order.Count(), - check_qty_yest = x.activity_check.Where(c => _now.Date.CompareTo(c.reg_time?.Date) == 1).Count(), - check_qty_today = x.activity_check.Where(c => _now.Date.CompareTo(c.reg_time?.Date) == 0).Count(), - status = (_now >= x.startDate_solar && _now < x.endDate_lunar) ? "進行中" : ((_now < x.startDate_solar && x.dueDate?.Date.CompareTo(_now) <= 180) ? "報名中" : "") //進行中: 活動日期​已開始,未結束​ ; 報名中: 未開始,報名未截止​近半年(?)的活動​ + check_qty_yest = x.activity_check.Where(c => c.reg_time.HasValue && c.reg_time.Value >= yesterdayStart && c.reg_time.Value < yesterdayEnd).Count(), + check_qty_today = x.activity_check.Where(c => c.reg_time.HasValue && c.reg_time.Value >= todayStart && c.reg_time.Value < todayEnd).Count(), + status = (_now >= x.startDate_solar && _now < x.endDate_lunar) ? "進行中" : ((_now < x.startDate_solar && x.dueDate.HasValue && (x.dueDate.Value - _now).Days <= 180) ? "報名中" : "") //進行中: 活動日期​已開始,未結束​ ; 報名中: 未開始,報名未截止​近半年(?)的活動​ }), count = count diff --git a/web/App_Code/api/guadanGuestQueryController.cs b/web/App_Code/api/guadanGuestQueryController.cs index fa92dde..408a442 100644 --- a/web/App_Code/api/guadanGuestQueryController.cs +++ b/web/App_Code/api/guadanGuestQueryController.cs @@ -80,10 +80,11 @@ public class guadanGuestQueryController: ApiController public async Task GetCheckInGuest([FromUri] DateTime date) { var today = DateTime.Now.Date; + var dateOnly = date.Date; var data = await _db.GuaDanOrderGuest .Where(guest => guest.StatusCode == "402" || guest.StatusCode == "403") .Where(guest => guest.RegionAndRoomAndBedSchedule - .Any(s => s.ScheduleDate == date.Date && s.ScheduleDate <= today) == true) + .Any(s => s.ScheduleDate == dateOnly && s.ScheduleDate <= today) == true) .Select(guest => new { name = guest.followers.u_name, @@ -96,9 +97,10 @@ public class guadanGuestQueryController: ApiController [Route("api/guadan/guest/booking/list")] public async Task GetBookingGuest([FromUri] DateTime date) { + var dateOnly = date.Date; var data = await _db.GuaDanOrderGuest .Where(guest => guest.StatusCode == "402" || guest.StatusCode == "401" || guest.StatusCode == "403") - .Where(guest => guest.RegionAndRoomAndBedSchedule.Any(s => s.ScheduleDate == date.Date) == true) + .Where(guest => guest.RegionAndRoomAndBedSchedule.Any(s => s.ScheduleDate == dateOnly) == true) .Select(guest => new { name = guest.followers.u_name, diff --git a/web/App_Code/api/guadanStatisticsController.cs b/web/App_Code/api/guadanStatisticsController.cs index a42ad98..39aa606 100644 --- a/web/App_Code/api/guadanStatisticsController.cs +++ b/web/App_Code/api/guadanStatisticsController.cs @@ -21,6 +21,7 @@ public class guadanStatisticsController: ApiController //挂单统计:房间,床位,挂单笔数,挂单人数的统计 var now = DateTime.Now; + var todayStart = now.Date; var guadanTotalCount = await _db.GuaDanOrder .Where(a => a.IsDeleted == false) .Where(a => a.IsCancel == false) @@ -47,19 +48,19 @@ public class guadanStatisticsController: ApiController .Where(a => a.IsDeleted == false) .Where(guest => guest.StatusCode != "404") .Where(guest => guest.StatusCode != "403") - .Where( a => a.CheckOutAt >= now.Date) + .Where( a => a.CheckOutAt >= todayStart) .CountAsync(); var guadanPeopleCurrentMale = await _db.GuaDanOrderGuest .Where(a => a.IsDeleted == false) .Where(guest => guest.StatusCode != "404") .Where(guest => guest.StatusCode != "403") - .Where(a => a.CheckOutAt >= now.Date && a.followers.sex == "男眾") + .Where(a => a.CheckOutAt >= todayStart && a.followers.sex == "男眾") .CountAsync(); var guadanPeopleCurrentFemale = await _db.GuaDanOrderGuest .Where(a => a.IsDeleted == false) .Where(guest => guest.StatusCode != "404") .Where(guest => guest.StatusCode != "403") - .Where(a => a.CheckOutAt >= now.Date && a.followers.sex == "女眾") + .Where(a => a.CheckOutAt >= todayStart && a.followers.sex == "女眾") .CountAsync(); var result = new diff --git a/web/admin/index.aspx.cs b/web/admin/index.aspx.cs index 416b7a0..cc17233 100644 --- a/web/admin/index.aspx.cs +++ b/web/admin/index.aspx.cs @@ -266,10 +266,10 @@ public partial class admin_index : MyWeb.function if (myip != "127.0.0.1") { myip = Request.UserHostAddress; - if (g_name.ToUpper() == "EZ" & myip != "211.20.239.58") - { - return "禁止登入"; - } + //if (g_name.ToUpper() == "EZ" & myip != "***.***.***.***") + //{ + // return "禁止登入"; + //} } string login_code = function.randCode(10); diff --git a/web/web.config b/web/web.config index 32bd97c..ce0bb37 100644 --- a/web/web.config +++ b/web/web.config @@ -44,8 +44,10 @@ - - + +