diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/OnsiteService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/OnsiteService.cs index b76de0a..1b93833 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/OnsiteService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/OnsiteService.cs @@ -931,5 +931,108 @@ namespace EasyBL.WEBAPP.ShowEasy #endregion 展覽管理(List API 展覽類別篩選器) + #region Get會員個人信息 + + //會員個人訊息查詢 + public HttpResponseMessage GetMemberInfo(string OrgID, string Account) + { + SuccessResponseMessage srm = null; + string sError = null; + var db = SugarBase.GetIntance(); + try + { + do + { + + MemberDTO member = new MemberDTO(); + var sLang = WebAppGlobalConstWord.DEFAULT_LANGUAGE; + string requestUrl = Common.ConfigGetValue("", "ida:RedirectUri"); + + var saUser = db.Queryable() + //搜尋條件 + .Where(x => x.OrgID == OrgID && x.Account == Account) + .Single(); + + + member.FirstName = saUser.FirstName;//名字 + member.LastName = saUser.LastName; //姓氏 + member.Email = saUser.Email;//Email + member.Phone = saUser.Phone;//電話 + member.CountryID = saUser.CountryID;//國家 + member.PhoneCode = saUser.PhoneCode;//電話國碼 + if (!string.IsNullOrEmpty(member.CountryID)) + { + + var sCountry = db.Queryable() + .Where(x => x.CountryID == member.CountryID && x.LangType == sLang) + .Single(); + member.CountryName = sCountry.CountryName; + member.Country_ENCode = sCountry.Country_ENCode; + + } + //返回user信息 + srm = new SuccessResponseMessage(null, null); + srm.DATA.Add(BLWording.REL, member); + + } while (false); + } + catch (Exception ex) + { + sError = Util.GetLastExceptionMsg(ex); + srm = new SuccessResponseMessage(null, null) + { + STATUSCODE = (int)StatusCodeEnum.Error, + MSG = StatusCodeEnum.Error.GetEnumText() + }; + } + return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm)); + } + + #endregion + + #region 修改會員個人信息 + /// + /// 修改會員個人信息 + /// + /// + /// + public HttpResponseMessage UpdateMember(MemberDTO Member) + { + SuccessResponseMessage srm = null; + string sError = null; + var db = SugarBase.GetIntance(); + try + { + do + { + + SETB_CMS_Member rsMember = new SETB_CMS_Member(); + rsMember.FirstName = Member.FirstName;//名字 + rsMember.LastName = Member.LastName;//姓氏 + rsMember.Email = Member.Email;//Email + rsMember.Phone = Member.Phone;//電話 + rsMember.CountryID = Member.CountryID;//國家 + rsMember.PhoneCode = Member.PhoneCode;//電話國碼 + var iRel = db.Updateable(rsMember) + .UpdateColumns(it => new { it.FirstName, it.LastName, it.Email, it.Phone,it.CountryID,it.PhoneCode }) + .Where(t1 => t1.Account == Member.Account).ExecuteCommand(); + srm = new SuccessResponseMessage(null, null); + srm.DATA.Add(BLWording.REL, iRel); + } 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)); + } + #endregion + } } \ No newline at end of file diff --git a/EuroTran/WebApp/Controllers/OnsiteController.cs b/EuroTran/WebApp/Controllers/OnsiteController.cs index 1b2dd00..6e43486 100644 --- a/EuroTran/WebApp/Controllers/OnsiteController.cs +++ b/EuroTran/WebApp/Controllers/OnsiteController.cs @@ -1,5 +1,6 @@ using EasyBL.WebApi.Filters; using EasyBL.WebApi.Message; +using EasyBL.WEBAPP; using EasyBL.WEBAPP.ShowEasy; using EasyBL.WEBAPP.SYS; using Entity.ShowEasyDtos; @@ -137,5 +138,34 @@ namespace WebApp.Controllers { return new OnsiteService().GetPayTypes(Lang, ServiceID); } + + + //會員個人訊息查詢 + [HttpGet] + [SEApiSecurityFilter] + public HttpResponseMessage MemberInfo() + { + //根據參數取得Member的詳細信息,調用時需要在Header中添加token相關信息,包括orgId,userid,timestamp,token + //需要驗證的token相關信息的Api,添加上 [SEApiSecurityFilter]即可 + + var SEToken = SETokenUtil.GetToken(this.Request); + + return new OnsiteService().GetMemberInfo(SEToken.OrgID, SEToken.Account); + } + + + [HttpPost] + [SEApiSecurityFilter] + public HttpResponseMessage Member([FromBody] MemberDTO Member) + { + + var SEToken = SETokenUtil.GetToken(this.Request); + Member.Account = SEToken.Account; + + return new OnsiteService().UpdateMember(Member); + } + + + } }