From 00687a35ff02900e87718503d70fd2bb5fbe1ade Mon Sep 17 00:00:00 2001 From: berlin-tzen Date: Tue, 14 Mar 2023 17:24:56 +0800 Subject: [PATCH] =?UTF-8?q?[WHAT]=20=E5=A2=9E=E5=8A=A0=E6=9C=83=E5=93=A1?= =?UTF-8?q?=E8=A8=82=E5=96=AEAPI=E9=97=9C=E9=8D=B5=E5=AD=97=E6=90=9C?= =?UTF-8?q?=E5=B0=8B=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShowEasy/BookingMaintain_QryService.cs | 92 ++++++++++++++++++- .../ShowEasy/BookingOnlineService.cs | 5 +- .../Controllers/BookingOnlineController.cs | 4 +- 3 files changed, 92 insertions(+), 9 deletions(-) diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingMaintain_QryService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingMaintain_QryService.cs index f830b4b..5a40203 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingMaintain_QryService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingMaintain_QryService.cs @@ -886,10 +886,12 @@ namespace EasyBL.WEBAPP.SYS rsPayment.DueDate = Payment.DueDate; rsPayment.PaymentDate = Payment.PaymentDate; - if (ImageDic.ContainsKey(Payment.Remittance)) - { + if (!string.IsNullOrEmpty(Payment.Remittance)) { - rsPayment.Remittance = ImageDic[Payment.Remittance]; + if (ImageDic.ContainsKey(Payment.Remittance)) + { + rsPayment.Remittance = ImageDic[Payment.Remittance]; + } } @@ -980,7 +982,8 @@ namespace EasyBL.WEBAPP.SYS string sAccount, List SubCategoryIDs, List BookingStatus, - List PaymentStatus) + List PaymentStatus, + string Query) { if (string.IsNullOrEmpty(sLanguageID)) @@ -1005,6 +1008,10 @@ namespace EasyBL.WEBAPP.SYS BookingDic = FilterDTOByPaymentStatus(BookingDic, PaymentStatus); } + if (!string.IsNullOrEmpty(Query)) { + BookingDic = FilterByQuery(BookingDic, Query); + } + return BookingDic; } @@ -1169,6 +1176,83 @@ namespace EasyBL.WEBAPP.SYS return rsBookingDic; } + public Dictionary FilterByQuery(Dictionary BookingDic, string Query) + { + + Dictionary rsBookingDic = new Dictionary(); + + var rsBookingList = BookingDic.Values.ToList(); + + foreach (var Booking in rsBookingList) + { + + // Filter by BookingNo + if (!string.IsNullOrEmpty(Booking.BookingNo)) + { + + if (Booking.BookingNo.Contains(Query)) + { + rsBookingDic[Booking.BookingID] = Booking; + } + + } + + // Filter by OnSiteService + if (Booking.OnSiteService != null) { + + var OnSiteService = Booking.OnSiteService; + + if (!string.IsNullOrEmpty(OnSiteService.ServiceName)) { + + if (OnSiteService.ServiceName.Contains(Query)) + { + rsBookingDic[Booking.BookingID] = Booking; + } + + } + + } + + // Filter by BookingDetail + if (Booking.BookingDetail.Count > 0) { + + foreach (var item in Booking.BookingDetail) { + + if (item.Contains(Query)) { + rsBookingDic[Booking.BookingID] = Booking; + } + + } + + } + + // Filter by OtherDetail + if (Booking.OtherDetail.Count > 0) + { + + if (Booking.OtherDetail.Contains(Query)) + { + rsBookingDic[Booking.BookingID] = Booking; + } + + } + + // Filter by NoticeDetail + if (!string.IsNullOrEmpty(Booking.NoticeDetail)) + { + + if (Booking.NoticeDetail.Contains(Query)) + { + rsBookingDic[Booking.BookingID] = Booking; + } + + } + + } + + return rsBookingDic; + + } } } \ No newline at end of file diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingOnlineService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingOnlineService.cs index ac17bc4..40a637d 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingOnlineService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingOnlineService.cs @@ -123,7 +123,7 @@ namespace EasyBL.WEBAPP.SYS /// /// /// - public HttpResponseMessage BookingCardList(string sLanguageID, string sAccount, int iPageIndex, int iPageSize, List SubCategoryIDs, List BookingStatuses, List PaymentStatuses) + public HttpResponseMessage BookingCardList(string sLanguageID, string sAccount, int iPageIndex, int iPageSize, List SubCategoryIDs, List BookingStatuses, List PaymentStatuses, string Query) { SuccessResponseMessage srm = null; @@ -137,10 +137,9 @@ namespace EasyBL.WEBAPP.SYS sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; } - BookingMaintain_QryService bm_qry = new BookingMaintain_QryService(); - var rsResult = bm_qry.QueryAllBookingAsDTO(sLanguageID, sAccount, SubCategoryIDs, BookingStatuses, PaymentStatuses).Values.ToList(); + var rsResult = bm_qry.QueryAllBookingAsDTO(sLanguageID, sAccount, SubCategoryIDs, BookingStatuses, PaymentStatuses, Query).Values.ToList(); // Pagination if (iPageSize <= 0) diff --git a/EuroTran/WebApp/Controllers/BookingOnlineController.cs b/EuroTran/WebApp/Controllers/BookingOnlineController.cs index 1bada46..55b0bbc 100644 --- a/EuroTran/WebApp/Controllers/BookingOnlineController.cs +++ b/EuroTran/WebApp/Controllers/BookingOnlineController.cs @@ -47,7 +47,7 @@ namespace WebApp.Controllers [HttpGet] [SEApiSecurityFilter] - public HttpResponseMessage BookingCardList(string Lang, int PageIndex, int PageSize, string SubCategoryIDs, string BookingStatuses, string PaymentStatuses) + public HttpResponseMessage BookingCardList(string Lang, int PageIndex, int PageSize, string SubCategoryIDs, string BookingStatuses, string PaymentStatuses, string Query) { var SEToken = SETokenUtil.GetToken(this.Request); @@ -72,7 +72,7 @@ namespace WebApp.Controllers rsPaymentStatuses = JsonConvert.DeserializeObject>(PaymentStatuses); } - return new BookingOnlineService().BookingCardList(Lang, sAccount, PageIndex, PageSize, rsSubCategoryIDs, rsBookingStatuses, rsPaymentStatuses); + return new BookingOnlineService().BookingCardList(Lang, sAccount, PageIndex, PageSize, rsSubCategoryIDs, rsBookingStatuses, rsPaymentStatuses, Query); } ///