diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/FavoriteMaintain_QryService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/FavoriteMaintain_QryService.cs index 5533ed6..5e94b93 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/FavoriteMaintain_QryService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/FavoriteMaintain_QryService.cs @@ -124,40 +124,56 @@ namespace EasyBL.WEBAPP.SYS } - #region 收藏管理(List 查詢收藏展覽列表) + public Dictionary FindFavoriateExhibitionByIDsAsDictionary(string sLanguageID, string sAccount) { - /// - /// 收藏管理(List 查詢收藏展覽列表) - /// - /// - /// - /// - public Dictionary QueryFavoriteExhibition(string sLanguageID, string sAccount, List SubCategoryIDList, List CountryIDList, List StatusList) - { + var rsExhibitionDic = new Dictionary(); if (string.IsNullOrEmpty(sLanguageID)) { sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; } - var rsExhibitionList = new List(); - var rsExhibitionCardDic = new Dictionary(); - var FavoriateDic = FindAllByIDsAsDictionary(sAccount, "Exhibition"); ExhibMaintain_QryService em_qry = new ExhibMaintain_QryService(); var ExhibitionDic = em_qry.QueryAllDetailExhibitionAsDictionary(sLanguageID); - - foreach (var Favoriate in FavoriateDic.Values) { - if (ExhibitionDic.ContainsKey(Favoriate.ParentID)) { + foreach (var Favoriate in FavoriateDic.Values) + { + + if (ExhibitionDic.ContainsKey(Favoriate.ParentID)) + { var Exhibition = ExhibitionDic[Favoriate.ParentID]; - rsExhibitionList.Add(Exhibition); + rsExhibitionDic[Exhibition.ExhibitionID] = Exhibition; } } + return rsExhibitionDic; + + } + + #region 收藏管理(Dictionary 查詢收藏展覽列表) + + /// + /// 收藏管理(Dictionary 查詢收藏展覽列表) + /// + /// + /// + /// + public Dictionary QueryFavoriteExhibition(string sLanguageID, string sAccount, List SubCategoryIDList, List CountryIDList, List StatusList) + { + + if (string.IsNullOrEmpty(sLanguageID)) { + sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; + } + + var rsExhibitionList = FindFavoriateExhibitionByIDsAsDictionary(sLanguageID, sAccount).Values.ToList(); + var rsExhibitionCardDic = new Dictionary(); + + ExhibMaintain_QryService em_qry = new ExhibMaintain_QryService(); + if (SubCategoryIDList.Count > 0) { rsExhibitionList = em_qry.FilterBySubCategoryIDs(rsExhibitionList, SubCategoryIDList); } @@ -182,7 +198,30 @@ namespace EasyBL.WEBAPP.SYS } - #endregion 收藏管理(List 查詢收藏展覽列表) + #endregion 收藏管理(Dictionary 查詢收藏展覽列表) + + public Dictionary QueryExhibitionCountryList(string sLanguageID, string sAccount) { + + var rsCountryDic = new Dictionary(); + + if (string.IsNullOrEmpty(sLanguageID)) + { + sLanguageID = WebAppGlobalConstWord.DEFAULT_LANGUAGE; + } + + var rsExhibitionList = FindFavoriateExhibitionByIDsAsDictionary(sLanguageID, sAccount).Values.ToList(); + + foreach (var Exhibition in rsExhibitionList) { + + if (!string.IsNullOrEmpty(Exhibition.Country.CountryID)) { + rsCountryDic[Exhibition.Country.CountryID] = Exhibition.Country; + } + + } + + return rsCountryDic; + + } diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/FavoriteService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/FavoriteService.cs index ac4a730..2746302 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/FavoriteService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/FavoriteService.cs @@ -1,4 +1,5 @@  +using DocumentFormat.OpenXml.Wordprocessing; using EasyBL.WebApi; using EasyBL.WebApi.Common; using EasyBL.WebApi.Message; @@ -185,8 +186,41 @@ namespace EasyBL.WEBAPP.SYS #endregion 收藏管理(HttpResponseMessage API 分頁查詢收藏展覽列表) + public HttpResponseMessage GetExhibitionCountryList(string sLanguageID, string sAccount) { + SuccessResponseMessage srm = null; + string sError = null; + + try + { + do + { + + FavoriteMaintain_QryService fm_qry = new FavoriteMaintain_QryService(); + var rsResult = fm_qry.QueryExhibitionCountryList(sLanguageID, sAccount).Values.ToList(); + + + //返回token信息 + srm = new SuccessResponseMessage(null, null); + + srm.DATA.Add(BLWording.REL, rsResult); + + } while (false); + } + catch (Exception ex) + { + sError = Util.GetLastExceptionMsg(ex); + srm = new SuccessResponseMessage(null, null) + { + STATUSCODE = (int)StatusCodeEnum.Error, + MSG = StatusCodeEnum.Error.GetEnumText() + }; + srm.DATA.Add(BLWording.REL, ""); + } + return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm)); + + } private List FavoriteEntityToDTO(Object Data) { diff --git a/EuroTran/WebApp/Controllers/FavoriteController.cs b/EuroTran/WebApp/Controllers/FavoriteController.cs index 677b8fe..18d3db9 100644 --- a/EuroTran/WebApp/Controllers/FavoriteController.cs +++ b/EuroTran/WebApp/Controllers/FavoriteController.cs @@ -93,5 +93,18 @@ namespace WebApp.Controllers return new FavoriteService().GetFavoriteExhibition(Lang, sAccount, PageIndex, PageSize, rsSubCategoryIDList, rsCountryIDList, rsStatusList); } + [HttpGet] + [SEApiSecurityFilter] + public HttpResponseMessage ExhibitionCountryList(string Lang) + { + + // get authtoken + var SEToken = SETokenUtil.GetToken(this.Request); + var sAccount = SEToken.Email; + + return new FavoriteService().GetExhibitionCountryList(Lang, sAccount); + + } + } }