From 486cdc1728b834185e80228abdba21bc0c7a211c Mon Sep 17 00:00:00 2001 From: berlin-tzen Date: Wed, 15 Feb 2023 10:18:17 +0800 Subject: [PATCH] =?UTF-8?q?[WHAT]=20=E5=B1=95=E8=A6=BD=E6=9F=A5=E8=A9=A2?= =?UTF-8?q?=E5=84=AA=E5=8C=96=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=A8=BB=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShowEasy/ExhibMaintain_QryService.cs | 450 +++++++++--------- .../ShowEasy/ExhibitionService.cs | 24 +- 2 files changed, 228 insertions(+), 246 deletions(-) diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/ExhibMaintain_QryService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/ExhibMaintain_QryService.cs index b7c65de..6997f19 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/ExhibMaintain_QryService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/ExhibMaintain_QryService.cs @@ -461,12 +461,13 @@ namespace EasyBL.WEBAPP.SYS var sLanguageID = _fetchString(i_crm, @"LanguageID"); - if (string.IsNullOrEmpty(sLanguageID)) { + if (string.IsNullOrEmpty(sLanguageID)) + { sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; } saShowStatus = am_qry.FindAllByIDsAsDictionary(sLanguageID, i_crm.ORIGID, sArgumentClassID).Values.ToList(); - + rm = new SuccessResponseMessage(null, i_crm); rm.DATA.Add(BLWording.REL, saShowStatus); } while (false); @@ -497,11 +498,13 @@ namespace EasyBL.WEBAPP.SYS /// /// /// - public Dictionary QueryShowStatusDic(string sLanguageID) { + public Dictionary QueryShowStatusDic(string sLanguageID) + { Dictionary rsResult = new Dictionary(); - if (string.IsNullOrEmpty(sLanguageID)) { + if (string.IsNullOrEmpty(sLanguageID)) + { sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; } @@ -510,9 +513,11 @@ namespace EasyBL.WEBAPP.SYS var rsExhibitionStatusList = QueryAllDetailExhibitionAsDictionary(sLanguageID).Values.ToList().Where(w => !string.IsNullOrEmpty(w.Status)).Select(s => s.Status); - foreach (var sStatus in rsExhibitionStatusList) { + foreach (var sStatus in rsExhibitionStatusList) + { - if (StatusDic.ContainsKey(sStatus)) { + if (StatusDic.ContainsKey(sStatus)) + { StatusDTO rsStatus = new StatusDTO(); rsStatus.Key = sStatus; @@ -525,7 +530,7 @@ namespace EasyBL.WEBAPP.SYS } return rsResult; - + } #endregion 展覽管理(Dictionary 查詢展覽狀態) @@ -555,13 +560,23 @@ namespace EasyBL.WEBAPP.SYS var sArgumentClassID = "Frequency"; - saFrequency = db.Queryable() - .Where(x => x.OrgID == i_crm.ORIGID && x.Effective == "Y" && x.DelStatus == "N") - .Where(t1 => t1.ArgumentClassID == sArgumentClassID) - .ToList(); + var sLanguageID = _fetchString(i_crm, @"LanguageID"); + + if (string.IsNullOrEmpty(sLanguageID)) { + sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; + } + + var sOrgID = i_crm.ORIGID; + + if (string.IsNullOrEmpty(sOrgID)) { + sOrgID = WebAppGlobalConstWord.TG_ORGID; + } + + saFrequency = am_qry.FindAllByIDsAsDictionary(sLanguageID, sOrgID, sArgumentClassID).Values.ToList(); rm = new SuccessResponseMessage(null, i_crm); rm.DATA.Add(BLWording.REL, saFrequency); + } while (false); } catch (Exception ex) @@ -583,7 +598,10 @@ namespace EasyBL.WEBAPP.SYS #endregion 展覽管理(List 查詢展覽週期選單) - public List QueryCategoryFilterList(string sLanguageID) { + #region 展覽管理(List 查詢展覽階層類別) + + public List QueryCategoryFilterList(string sLanguageID) + { string sMsg = null; @@ -606,17 +624,20 @@ namespace EasyBL.WEBAPP.SYS var rsCategoryDic = cm_qry.FindAllByIDsAsDictionary(sCategoryType, sLanguageID); - foreach (var Exhibition in rsExhibitionList) { + foreach (var Exhibition in rsExhibitionList) + { // MainCategory var sMainCategoryIDs = Exhibition.MainCategoryIDs; var MainCategoryIDList = new List(); - if (!string.IsNullOrEmpty(sMainCategoryIDs)) { + if (!string.IsNullOrEmpty(sMainCategoryIDs)) + { MainCategoryIDList = JsonConvert.DeserializeObject>(sMainCategoryIDs); } - foreach (var sMainCategoryID in MainCategoryIDList) { + foreach (var sMainCategoryID in MainCategoryIDList) + { var rsCategory = rsCategoryDic[sMainCategoryID]; CategoryDicDTO MainCategory = new CategoryDicDTO(); @@ -634,21 +655,26 @@ namespace EasyBL.WEBAPP.SYS SubCategoryIDList = JsonConvert.DeserializeObject>(sSubCategoryIDs); } - foreach (var SubCategoryID in SubCategoryIDList) { + foreach (var SubCategoryID in SubCategoryIDList) + { var rsCategory = rsCategoryDic[SubCategoryID]; var ParentIDList = new List(); - if (rsCategory != null) { + if (rsCategory != null) + { - if (!string.IsNullOrEmpty(rsCategory.ParentIDs)) { + if (!string.IsNullOrEmpty(rsCategory.ParentIDs)) + { ParentIDList = JsonConvert.DeserializeObject>(rsCategory.ParentIDs); - foreach (var ParentID in ParentIDList) { + foreach (var ParentID in ParentIDList) + { - if (rsResult.ContainsKey(ParentID)) { + if (rsResult.ContainsKey(ParentID)) + { CategoryDTO SubCategory = new CategoryDTO(); SubCategory.CategoryID = rsCategory.CategoryID; @@ -657,11 +683,11 @@ namespace EasyBL.WEBAPP.SYS rsResult[ParentID].SubCategoryDic[SubCategory.CategoryID] = SubCategory; } - + } } - + } } @@ -669,7 +695,8 @@ namespace EasyBL.WEBAPP.SYS } // Categories to list - foreach (KeyValuePair MainCategory in rsResult) { + foreach (KeyValuePair MainCategory in rsResult) + { var MainCategoryID = MainCategory.Key; rsResult[MainCategoryID].SubCategoryList = rsResult[MainCategoryID].SubCategoryDic.Values.ToList(); @@ -682,16 +709,17 @@ namespace EasyBL.WEBAPP.SYS { sMsg = Util.GetLastExceptionMsg(ex); } - finally - { - - } return rsResult.Values.ToList(); } - public Dictionary FindAllByIDsAsDictionary(string sLanguageID) { + #endregion 展覽管理(List 查詢展覽階層類別) + + #region 展覽管理(Dictionary 以ID查詢所有展覽) + + public Dictionary FindAllByIDsAsDictionary(string sLanguageID) + { var db = SugarBase.GetIntance(); string sMsg = null; @@ -719,7 +747,8 @@ namespace EasyBL.WEBAPP.SYS }) .ToList(); - foreach (var Exhibition in saDataList) { + foreach (var Exhibition in saDataList) + { saDataDict[Exhibition.ExhibitionID] = Exhibition; } @@ -734,15 +763,21 @@ namespace EasyBL.WEBAPP.SYS return saDataDict; } + + #endregion 展覽管理(Dictionary 以ID查詢所有展覽) + + #region 展覽管理(List 查詢所有展覽列表卡片) public List QueryExhibitionCard( - string sLanguageID, + string sLanguageID, List RegionIDs, List CountryIDs, List CityIDs, List MainCategoryIDs, List SubCategoryIDs, List Status, - List sDate) { + List sDate, + string sSortType) + { List rsResult = new List(); @@ -753,11 +788,12 @@ namespace EasyBL.WEBAPP.SYS { do { - if (string.IsNullOrEmpty(sLanguageID)) { + if (string.IsNullOrEmpty(sLanguageID)) + { sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; } - var rsExhibitionList = FindAllByIDsAsDictionary(sLanguageID).Values.ToList(); + var rsExhibitionList = QueryAllDetailExhibitionAsDictionary(sLanguageID).Values.ToList(); if (MainCategoryIDs.Count > 0) { @@ -769,183 +805,94 @@ namespace EasyBL.WEBAPP.SYS rsExhibitionList = FilterBySubCategoryIDs(rsExhibitionList, SubCategoryIDs); } - var Cards = rsExhibitionList - .Select(t1 => new ExhibitionCardDTO - { - - ExhibitionID = t1.ExhibitionID, - IsRecommend = t1.IsRecommend, - Logo = t1.Logo, - AbbreviatedName = t1.AbbreviatedName, - ExhibitionName = t1.ExhibitionName, - - }) - .ToList(); - - var CardDic = new Dictionary(); - - foreach (var Card in Cards) { - CardDic[Card.ExhibitionID] = Card; - } - - CardDic = SetCardCategory(CardDic, rsExhibitionList, sLanguageID); - CardDic = SetCardInfo(CardDic, rsExhibitionList, sLanguageID); - if (Status.Count > 0) { - CardDic = FilterByStatus(CardDic, Status); + rsExhibitionList = FilterByStatus(rsExhibitionList, Status); } if (RegionIDs.Count > 0 || CountryIDs.Count > 0 || CityIDs.Count > 0) { - CardDic = FilterByLocationIDs(CardDic, RegionIDs, CountryIDs, CityIDs); + rsExhibitionList = FilterByLocationIDs(rsExhibitionList, RegionIDs, CountryIDs, CityIDs); } if (sDate.Count > 0) { - CardDic = FilterByDate(CardDic, sDate); + rsExhibitionList = FilterByDate(rsExhibitionList, sDate); } - rsResult = CardDic.Values.ToList(); - - } while (false); - } - catch (Exception ex) - { - sMsg = Util.GetLastExceptionMsg(ex); - } - finally - { - - } - - - return rsResult; - } - - public Dictionary SetCardCategory(Dictionary Cards, List ExhibitionList, string sLanguageID) { - - ExhibMainCategoryMaintain_QryService emcm_qry = new ExhibMainCategoryMaintain_QryService(); - ExhibSubCategoryMaintain_QryService escm_qry = new ExhibSubCategoryMaintain_QryService(); - - var MainCategoryDic = emcm_qry.QueryExhibMainCategoryAsDictionary(sLanguageID); - var SubCategoryDic = escm_qry.QueryExhibSubCategoryAsDictionary(sLanguageID); + var Cards = rsExhibitionList + .Select(t1 => new ExhibitionCardDTO + { - foreach (var Exhibition in ExhibitionList) { + ExhibitionID = t1.ExhibitionID, + AbbreviatedName = t1.AbbreviatedName, + ExhibitionName = t1.ExhibitionName, + MainCategoryList = t1.MainCategories, + SubCategoryList = t1.SubCategories, + Logo = t1.Logo, - if (!string.IsNullOrEmpty(Exhibition.MainCategoryIDs)) { + StartDate = t1.StartDate, + EndDate = t1.EndDate, + ExhibStatus = t1.Status, + Intro = t1.Intro, + IsRecommend = t1.IsRecommend, + ExhibitorCount = t1.ExhibitorCount, + VisitorCount = t1.VisitorCount - var rsMainCategoryIDs = JsonConvert.DeserializeObject>(Exhibition.MainCategoryIDs); + }) + .ToList(); - foreach (var MainCategoryID in rsMainCategoryIDs) { + if (!string.IsNullOrEmpty(sSortType)) + { - if (MainCategoryDic[MainCategoryID] != null) { - Cards[Exhibition.ExhibitionID].MainCategoryList.Add(MainCategoryDic[MainCategoryID]); + if (sSortType == "Recommended") + { + Cards = Cards.OrderByDescending(o => o.IsRecommend).ToList(); } - - } - } - - if (!string.IsNullOrEmpty(Exhibition.SubCategoryIDs)) - { - - var rsSubCategoryIDs = JsonConvert.DeserializeObject>(Exhibition.SubCategoryIDs); + if (sSortType == "ShowDate") + { + Cards = Cards.OrderByDescending(o => o.StartDate.ToString()).ToList(); + } - foreach (var SubCategoryID in rsSubCategoryIDs) - { + if (sSortType == "ExhibitorCount") + { + Cards = Cards.OrderByDescending(o => o.ExhibitorCount).ToList(); + } - if (SubCategoryDic[SubCategoryID] != null) + if (sSortType == "VisitorCount") { - Cards[Exhibition.ExhibitionID].SubCategoryList.Add(SubCategoryDic[SubCategoryID]); + Cards = Cards.OrderByDescending(o => o.VisitorCount).ToList(); } } - } + return Cards; + } while (false); + } + catch (Exception ex) + { + sMsg = Util.GetLastExceptionMsg(ex); } - return Cards; + return rsResult; } - public Dictionary SetCardInfo(Dictionary Cards, List ExhibitionList, string sLanguageID) { - - ExhibInfoMaintain_QryService eim_qry = new ExhibInfoMaintain_QryService(); - - FileMaintain_QryService fm_qry = new FileMaintain_QryService(); - - ExhibStatMaintain_QryService esm_qry = new ExhibStatMaintain_QryService(); - - var rsInfoLocationDic = eim_qry.FindAllLocationByIDsAsDictionary(sLanguageID, "", ""); - - foreach (var Exhibition in ExhibitionList) { - - var Info = eim_qry.FindAllByIDsAsDictionary(sLanguageID, Exhibition.ExhibitionID).Values.FirstOrDefault(); + #endregion 展覽管理(List 查詢所有展覽列表卡片) - var LogoFile = fm_qry.FindAllByIDsAsDictionary(Exhibition.Logo).Values.FirstOrDefault(); - - Cards[Exhibition.ExhibitionID].Logo = ""; - - if (LogoFile != null) { - - var Server = Common.ConfigGetValue("", "ida:RedirectUri"); - Cards[Exhibition.ExhibitionID].Logo = Server +"/"+ LogoFile.FilePath.Replace("\\", "/"); - - } + #region 展覽管理(List 以主類別過濾) - if (Info != null) { - - var Stat = esm_qry.FindAllByIDsAsDictionary(Exhibition.ExhibitionID, Info.Year).Values.FirstOrDefault(); - - Cards[Exhibition.ExhibitionID].ExhibStatus = Info.Status; - Cards[Exhibition.ExhibitionID].Intro = Info.Intro; - Cards[Exhibition.ExhibitionID].StartDate = Info.StartDate; - Cards[Exhibition.ExhibitionID].EndDate = Info.EndDate; - Cards[Exhibition.ExhibitionID].IsFavorite = ""; - - Cards[Exhibition.ExhibitionID].ExhibitorCount = 0; - Cards[Exhibition.ExhibitionID].VisitorCount = 0; - - if (Stat != null) { - - Cards[Exhibition.ExhibitionID].ExhibitorCount = Stat.ExhibitorCount; - Cards[Exhibition.ExhibitionID].VisitorCount = Stat.VisitorCount; - - } - - LocationDTO Location = new LocationDTO(); - - if (rsInfoLocationDic.ContainsKey(Info.ExhibitionInfoID)) { - Location = rsInfoLocationDic[Info.ExhibitionInfoID]; - } - - Cards[Exhibition.ExhibitionID].RegionID = Location.Region.RegionID; - Cards[Exhibition.ExhibitionID].RegionName = Location.Region.RegionName; - - Cards[Exhibition.ExhibitionID].CountryID = Location.Country.CountryID; - Cards[Exhibition.ExhibitionID].CountryName = Location.Country.CountryName; - - Cards[Exhibition.ExhibitionID].CityID = Location.City.CityID; - Cards[Exhibition.ExhibitionID].CityName = Location.City.CityName; - - } - - } - - return Cards; - } - - public List FilterByMainCategoryIDs(List ExhibitionList, List MainCategoryIDs) + public List FilterByMainCategoryIDs(List ExhibitionList, List MainCategoryIDs) { - var ExhibitionDic = new Dictionary(); + var ExhibitionDic = new Dictionary(); foreach (var Exhibition in ExhibitionList) { - var rsMainCategoryIDs = JsonConvert.DeserializeObject>(Exhibition.MainCategoryIDs); + var rsMainCategoryIDs = Exhibition.MainCategories.Select(s => s.CategoryID).ToList(); bool hasMatch = rsMainCategoryIDs.Intersect(MainCategoryIDs).Any(); @@ -960,15 +907,18 @@ namespace EasyBL.WEBAPP.SYS return ExhibitionDic.Values.ToList(); } - public List FilterBySubCategoryIDs(List ExhibitionList, List SubCategoryIDs) + #endregion 展覽管理(List 以主類別過濾) + + #region 展覽管理(List 以子類別過濾) + public List FilterBySubCategoryIDs(List ExhibitionList, List SubCategoryIDs) { - var ExhibitionDic = new Dictionary(); + var ExhibitionDic = new Dictionary(); foreach (var Exhibition in ExhibitionList) { - var rsSubCategoryIDs = JsonConvert.DeserializeObject>(Exhibition.SubCategoryIDs); + var rsSubCategoryIDs = Exhibition.SubCategories.Select(s => s.CategoryID).ToList(); bool hasMatch = rsSubCategoryIDs.Intersect(SubCategoryIDs).Any(); @@ -983,17 +933,20 @@ namespace EasyBL.WEBAPP.SYS return ExhibitionDic.Values.ToList(); } - public Dictionary FilterByLocationIDs(Dictionary Cards, List RegionIDs, List CountryIDs, List CityIDs) + #endregion 展覽管理(List 以子類別過濾) + + #region 展覽管理(List 以位址過濾) + public List FilterByLocationIDs(List ExhibitionList, List RegionIDs, List CountryIDs, List CityIDs) { - var ExhibitionDic = new Dictionary(); + var ExhibitionDic = new Dictionary(); - foreach (var Exhibition in Cards.Values) + foreach (var Exhibition in ExhibitionList) { - bool hasRegionMatch = RegionIDs.Contains(Exhibition.RegionID); - bool hasCountryMatch = CountryIDs.Contains(Exhibition.CountryID); - bool hasCityMatch = CityIDs.Contains(Exhibition.CityID); + bool hasRegionMatch = RegionIDs.Contains(Exhibition.Region.RegionID); + bool hasCountryMatch = CountryIDs.Contains(Exhibition.Country.CountryID); + bool hasCityMatch = CityIDs.Contains(Exhibition.City.CityID); if (hasRegionMatch && !ExhibitionDic.ContainsKey(Exhibition.ExhibitionID)) { @@ -1015,19 +968,22 @@ namespace EasyBL.WEBAPP.SYS } - return ExhibitionDic; + return ExhibitionDic.Values.ToList(); } - public Dictionary FilterByStatus(Dictionary Cards, List Status) + #endregion 展覽管理(List 以位址過濾) + + #region 展覽管理(List 以狀態過濾) + public List FilterByStatus(List ExhibitionList, List Status) { - var ExhibitionDic = new Dictionary(); + var ExhibitionDic = new Dictionary(); - foreach (var Exhibition in Cards.Values) + foreach (var Exhibition in ExhibitionList) { - var rsStatus = Exhibition.ExhibStatus; + var rsStatus = Exhibition.Status; bool hasMatch = Status.Contains(rsStatus); @@ -1039,37 +995,41 @@ namespace EasyBL.WEBAPP.SYS } - return ExhibitionDic; + return ExhibitionDic.Values.ToList(); } - public Dictionary FilterByDate(Dictionary Cards, List sDate) + #endregion 展覽管理(List 以狀態過濾) + + #region 展覽管理(List 以日期過濾) + public List FilterByDate(List ExhibitionList, List sDate) { - var rsCards = new Dictionary(); + var rsCards = new Dictionary(); var sStartDate = DateTime.ParseExact(sDate[0], "yyyy-MM-dd", CultureInfo.InvariantCulture); var sEndDate = DateTime.Now; - if (sDate.Count == 2) { + if (sDate.Count == 2) + { sEndDate = DateTime.ParseExact(sDate[1], "yyyy-MM-dd", CultureInfo.InvariantCulture); } - var rsCardList = Cards.Values.Where(w => w.StartDate >= sStartDate && w.StartDate <= sEndDate); + var rsExhibitionList = ExhibitionList.Where(w => w.StartDate >= sStartDate && w.StartDate <= sEndDate); - foreach (var Card in rsCardList) { - - rsCards[Card.ExhibitionID] = Card; - } + return rsExhibitionList.ToList(); + } - return rsCards; + #endregion 展覽管理(List 以日期過濾) - } + #region 展覽管理(List 查詢展覽階層位址) + public List QueryLocationFilterList(string sLanguageID) + { - public List QueryLocationFilterList(string sLanguageID) { + string sMsg = null; ExhibInfoMaintain_QryService eim_qry = new ExhibInfoMaintain_QryService(); @@ -1077,7 +1037,6 @@ namespace EasyBL.WEBAPP.SYS List rsRegionList = new List(); - var db = SugarBase.GetIntance(); try { do @@ -1089,7 +1048,8 @@ namespace EasyBL.WEBAPP.SYS var saDataList = eim_qry.FindAllLocationByIDsAsDictionary(sLanguageID, "", "").Values; - foreach (var Location in saDataList) { + foreach (var Location in saDataList) + { RegionDicDTO Region = new RegionDicDTO(); Region.RegionID = Location.Region.RegionID; @@ -1147,14 +1107,20 @@ namespace EasyBL.WEBAPP.SYS } catch (Exception ex) { - + sMsg = Util.GetLastExceptionMsg(ex); } return rsRegionList; } - public List QueryPopularExhibitionList(string sLanguageID, int iCount) { + #endregion 展覽管理(List 查詢展覽階層位址) + + #region 展覽管理(List 查詢熱門展覽) + public List QueryPopularExhibitionList(string sLanguageID, int iCount) + { + + string sMsg = ""; List rsExhibition = new List(); @@ -1169,7 +1135,8 @@ namespace EasyBL.WEBAPP.SYS sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; } - if (iCount <= 0) { + if (iCount <= 0) + { iCount = WebAppGlobalConstWord.TOP_LIMIT; } @@ -1193,14 +1160,20 @@ namespace EasyBL.WEBAPP.SYS } catch (Exception ex) { - + sMsg = Util.GetLastExceptionMsg(ex); } return rsExhibition; } - public List QueryPopularCountry(string sLanguageID, int iCount) { + #endregion 展覽管理(List 查詢熱門展覽) + + #region 展覽管理(List 查詢熱門國家) + public List QueryPopularCountry(string sLanguageID, int iCount) + { + + string sMsg = ""; List rsCountryList = new List(); @@ -1235,7 +1208,8 @@ namespace EasyBL.WEBAPP.SYS var Dic = new Dictionary(); - if (!CountryExhibDic.ContainsKey(Location.Country.CountryID)) { + if (!CountryExhibDic.ContainsKey(Location.Country.CountryID)) + { CountryExhibDic[Location.Country.CountryID] = Dic; } @@ -1258,7 +1232,8 @@ namespace EasyBL.WEBAPP.SYS CountryDTO Country = new CountryDTO(); - if (CountryDic.ContainsKey(CountryID)) { + if (CountryDic.ContainsKey(CountryID)) + { Country.CountryID = CountryDic[CountryID].CountryID; Country.CountryName = CountryDic[CountryID].CountryName; @@ -1275,13 +1250,16 @@ namespace EasyBL.WEBAPP.SYS } catch (Exception ex) { - + sMsg = Util.GetLastExceptionMsg(ex); } return rsCountryList; } + #endregion 展覽管理(List 查詢熱門國家) + + #region 展覽管理(List 查詢熱門類別) public List QueryPopularCategory(string sLanguageID, int iCount) { @@ -1315,9 +1293,11 @@ namespace EasyBL.WEBAPP.SYS var MainCategoryIDList = JsonConvert.DeserializeObject>(Exhibition.MainCategoryIDs); - foreach (var MainCategoryID in MainCategoryIDList) { + foreach (var MainCategoryID in MainCategoryIDList) + { - if (!CategoryExhibDic.ContainsKey(MainCategoryID)) { + if (!CategoryExhibDic.ContainsKey(MainCategoryID)) + { CategoryExhibDic[MainCategoryID] = Dic; } @@ -1364,7 +1344,11 @@ namespace EasyBL.WEBAPP.SYS } - public Dictionary QueryAllDetailExhibitionAsDictionary(string sLanguageID) { + #endregion 展覽管理(List 查詢熱門類別) + + #region 展覽管理(Dictionary 查詢所有詳細展覽) + public Dictionary QueryAllDetailExhibitionAsDictionary(string sLanguageID) + { Dictionary rsResult = new Dictionary(); @@ -1388,9 +1372,10 @@ namespace EasyBL.WEBAPP.SYS ExhibStatMaintain_QryService esm_qry = new ExhibStatMaintain_QryService(); ExhibMediaMaintain_QryService emm_qry = new ExhibMediaMaintain_QryService(); - - foreach (var Exhibition in ExhibitionList) { + + foreach (var Exhibition in ExhibitionList) + { ExhibitionDTO rsExhibition = new ExhibitionDTO(); @@ -1457,7 +1442,8 @@ namespace EasyBL.WEBAPP.SYS } // set ExhibInfo - if (ExhibInfo != null) { + if (ExhibInfo != null) + { Location = eim_qry.FindAllLocationByIDsAsDictionary(sLanguageID, ExhibInfo.Year, Exhibition.ExhibitionID).Values.FirstOrDefault(); @@ -1529,7 +1515,8 @@ namespace EasyBL.WEBAPP.SYS // set Media Link var MediaFileList = emm_qry.FindAllByIDsAsDictionary(rsExhibition.ExhibitionID, "").Values.ToList(); - foreach (var File in MediaFileList) { + foreach (var File in MediaFileList) + { VideoDTO Video = new VideoDTO(); Video.VideoLink = File.Link; @@ -1541,7 +1528,8 @@ namespace EasyBL.WEBAPP.SYS // set Image Files var ImageFileList = fm_qry.FindAllByIDsAsDictionary(rsExhibition.ExhibitionID).Values.ToList(); - foreach (var File in ImageFileList) { + foreach (var File in ImageFileList) + { ImageDTO Image = new ImageDTO(); Image.ImageLink = Server + "/" + File.FilePath.Replace("\\", "/"); @@ -1558,7 +1546,11 @@ namespace EasyBL.WEBAPP.SYS return rsResult; } - public ExhibitionDTO QueryOneDetailExhibition(string sLanguageID, string sExhibitionID) { + #endregion 展覽管理(Dictionary 查詢所有詳細展覽) + + #region 展覽管理(ExhibitionDTO 查詢單一詳細展覽) + public ExhibitionDTO QueryOneDetailExhibition(string sLanguageID, string sExhibitionID) + { var rsExhibition = QueryAllDetailExhibitionAsDictionary(sLanguageID) .Values.ToList() @@ -1569,31 +1561,40 @@ namespace EasyBL.WEBAPP.SYS } - public List QueryCategoryExhibition(string sLanguageID, List IncludeCountryIDs, List ExcludeCountryIDs) { + #endregion 展覽管理(ExhibitionDTO 查詢單一詳細展覽) + + #region 展覽管理(List 查詢階層主類別展覽) + public List QueryCategoryExhibition(string sLanguageID, List IncludeCountryIDs, List ExcludeCountryIDs) + { Dictionary rsResult = new Dictionary(); - if (string.IsNullOrEmpty(sLanguageID)) { + if (string.IsNullOrEmpty(sLanguageID)) + { sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; } var rsExhibitionList = QueryAllDetailExhibitionAsDictionary(sLanguageID).Values.Where(w => w.MainCategories.Count > 0); - if (IncludeCountryIDs.Count > 0) { + if (IncludeCountryIDs.Count > 0) + { rsExhibitionList = rsExhibitionList.Where(w => IncludeCountryIDs.Contains(w.Country.CountryID)); } - if (ExcludeCountryIDs.Count > 0) { + if (ExcludeCountryIDs.Count > 0) + { rsExhibitionList = rsExhibitionList.Where(w => !ExcludeCountryIDs.Contains(w.Country.CountryID)); } - foreach (var Exhibition in rsExhibitionList) { + foreach (var Exhibition in rsExhibitionList) + { List MainCategoryList = Exhibition.MainCategories; ExhibitionDTO ExhibDTO = new ExhibitionDTO(); - foreach (var MainCategory in MainCategoryList) { + foreach (var MainCategory in MainCategoryList) + { CategoryExhibitionDTO rsCategoryExhibition = new CategoryExhibitionDTO(); @@ -1608,7 +1609,8 @@ namespace EasyBL.WEBAPP.SYS } - foreach (KeyValuePair CM in rsResult) { + foreach (KeyValuePair CM in rsResult) + { var sCategoryID = CM.Key; @@ -1617,9 +1619,11 @@ namespace EasyBL.WEBAPP.SYS } return rsResult.Values.ToList(); - + } + #endregion 展覽管理(List 查詢階層主類別展覽) + } diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/ExhibitionService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/ExhibitionService.cs index e242e49..f06c2f2 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/ExhibitionService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/ExhibitionService.cs @@ -389,30 +389,8 @@ namespace EasyBL.WEBAPP.SYS } ExhibMaintain_QryService em_qry = new ExhibMaintain_QryService(); - var rsResult = em_qry.QueryExhibitionCard(sLanguageID, RegionIDs, CountryIDs, CityIDs, MainCategoryIDs, SubCategoryIDs, Status, Date); - if (!string.IsNullOrEmpty(SortType)) { - - if (SortType == "Recommended") - { - rsResult = rsResult.OrderByDescending(o => o.IsRecommend).ToList(); - } - - if (SortType == "ShowDate") { - rsResult = rsResult.OrderByDescending(o => o.StartDate.ToString()).ToList(); - } - - if (SortType == "ExhibitorCount") - { - rsResult = rsResult.OrderByDescending(o => o.ExhibitorCount).ToList(); - } - - if (SortType == "VisitorCount") - { - rsResult = rsResult.OrderByDescending(o => o.VisitorCount).ToList(); - } - - } + var rsResult = em_qry.QueryExhibitionCard(sLanguageID, RegionIDs, CountryIDs, CityIDs, MainCategoryIDs, SubCategoryIDs, Status, Date, SortType); //返回token信息 srm = new SuccessResponseMessage(null, null);