diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingService.cs index 88f41bd..3fa02d9 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/BookingService.cs @@ -63,10 +63,10 @@ namespace EasyBL.WEBAPP.SYS #endregion 類別選單(List 類別選單查詢) - #region 類別選單(List 類別選單查詢) + #region 子類別查詢API (服務有包含該類別才列出) /// - /// 類別選單(List 類別選單查詢) + /// 子類別查詢API (服務有包含該類別才列出) /// /// /// @@ -79,64 +79,67 @@ namespace EasyBL.WEBAPP.SYS { do { - //Alina:有錯誤先注釋掉 - ////用Account取Member的MemberID - //MemberMaintain_QryService member_qry = new MemberMaintain_QryService(); - //var member = member_qry.QueryOneByAccount(Account); + //用Account取Member的MemberID + MemberMaintain_QryService member_qry = new MemberMaintain_QryService(); + var member = member_qry.QueryOneByAccount(Account); - ////取Member所有的訂單 - //BookingMaintain_QryService booking_qry = new BookingMaintain_QryService(); + //取Member所有的訂單 + BookingMaintain_QryService booking_qry = new BookingMaintain_QryService(); - //var allBooking = booking_qry.FindAllByIDsAsDictionary(member.MemberID); + var allBooking = booking_qry.FindAllByIDsAsDictionary(member.MemberID); - //var allBookingServiceList = booking_qry.FindAllByIDsAsDictionary(member.MemberID).Values.ToList().Where(w => !string.IsNullOrEmpty(w.ServiceID)).Select(s => s.ServiceID).ToList(); + var allBookingServiceList = booking_qry.FindAllByIDsAsDictionary(member.MemberID).Values.ToList().Where(w => !string.IsNullOrEmpty(w.ServiceID)).Select(s => s.ServiceID).ToList(); - ////取所有category - //ServiceSubCategoryMaintain_QryService serviceSub_qry = new ServiceSubCategoryMaintain_QryService(); - //var subCategory = serviceSub_qry.FindAllByIDsAsDictionary("", LangType); + //取所有category + ServiceSubCategoryMaintain_QryService serviceSub_qry = new ServiceSubCategoryMaintain_QryService(); + var subCategory = serviceSub_qry.FindAllByIDsAsDictionary("", LangType); - ////取得所有OnSiteService - //ONSiteMaintain_QryService onSiteService_qry = new ONSiteMaintain_QryService(); - //var allService = onSiteService_qry.FindAllByIDsAsDictionary(""); + //取得所有OnSiteService + ONSiteMaintain_QryService onSiteService_qry = new ONSiteMaintain_QryService(); + var allService = onSiteService_qry.FindAllByIDsAsDictionary(""); - //var ServiceIDSet = new HashSet(); //去重複值 - //var CategoryDic = new Dictionary(); + var ServiceIDSet = new HashSet(); //去重複值 + var CategoryDic = new Dictionary(); - //foreach (var ServiceID in allBookingServiceList) { + foreach (var ServiceID in allBookingServiceList) + { - // SETB_PDT_ONSiteBaseInfo Service = new SETB_PDT_ONSiteBaseInfo(); + SETB_PDT_ONSiteBaseInfo Service = new SETB_PDT_ONSiteBaseInfo(); - // if (allService.ContainsKey(ServiceID)) { - // Service = allService[ServiceID]; - // } + if (allService.ContainsKey(ServiceID)) + { + Service = allService[ServiceID]; + } - // var SubCategoryIDList = new List(); + var SubCategoryIDList = new List(); - // if (!string.IsNullOrEmpty(Service.SubCategoryID)) { - // SubCategoryIDList = JsonConvert.DeserializeObject>(Service.SubCategoryID); - // } + if (!string.IsNullOrEmpty(Service.SubCategoryID)) + { + SubCategoryIDList = JsonConvert.DeserializeObject>(Service.SubCategoryID); + } - // foreach(var subCategoryID in SubCategoryIDList) - // { + foreach (var subCategoryID in SubCategoryIDList) + { - // SETB_SYS_Category category = new SETB_SYS_Category(); + SETB_SYS_Category category = new SETB_SYS_Category(); - // if (subCategory.ContainsKey(subCategoryID)) { - // category = subCategory[subCategoryID]; //用subCategoryID在subCategory內找 - // } + if (subCategory.ContainsKey(subCategoryID)) + { + category = subCategory[subCategoryID]; //用subCategoryID在subCategory內找 + } - // CategoryDTO categoryDTO = new CategoryDTO(); + CategoryDTO categoryDTO = new CategoryDTO(); - // categoryDTO.CategoryID = category.CategoryID; - // categoryDTO.CategoryName = category.CategoryName; + categoryDTO.CategoryID = category.CategoryID; + categoryDTO.CategoryName = category.CategoryName; - // CategoryDic[categoryDTO.CategoryID] = categoryDTO; //把categoryDTO.CategoryID當作key,把value(categoryDTO)存進CategoryDic - // //存到Dictionary內會去重複值。不用額外用HashSet - // } - //} + CategoryDic[categoryDTO.CategoryID] = categoryDTO; //把categoryDTO.CategoryID當作key,把value(categoryDTO)存進CategoryDic + //存到Dictionary內會去重複值。不用額外用HashSet + } + } - //srm = new SuccessResponseMessage(null, null); - //srm.DATA.Add(BLWording.REL, CategoryDic.Values.ToList()); + srm = new SuccessResponseMessage(null, null); + srm.DATA.Add(BLWording.REL, CategoryDic.Values.ToList()); } while (false); } @@ -155,7 +158,7 @@ namespace EasyBL.WEBAPP.SYS } - #endregion 類別選單(List 類別選單查詢) + #endregion 子類別查詢API (服務有包含該類別才列出) } } \ No newline at end of file diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_QryService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_QryService.cs index c358009..bbfd0fc 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_QryService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_QryService.cs @@ -1942,5 +1942,52 @@ namespace EasyBL.WEBAPP.ShowEasy } + //QueryALLOnSiteServiceAsDic + public Dictionary FindAllByIDsAsDictionary(string ServiceID) + { + + string sMsg = null; + + var db = SugarBase.GetIntance(); + + Dictionary saServiceDic = new Dictionary(); + + try + { + do + { + + var saServiceList = db.Queryable() + .Where(t1 => t1.Effective == "Y") + .WhereIF(!string.IsNullOrEmpty(ServiceID), t1 => t1.ServiceID == ServiceID) + .Select((t1) => new SETB_PDT_ONSiteBaseInfo + { + + ServiceID = SqlFunc.GetSelfAndAutoFill(t1.ServiceID) + + }) + .ToList(); + + foreach (var service in saServiceList) + { + saServiceDic[service.ServiceID] = service; + } + + return saServiceDic; + + } while (false); + } + catch (Exception ex) + { + sMsg = Util.GetLastExceptionMsg(ex); + + } + + return saServiceDic; + + } + } -} \ No newline at end of file +} + +