public SearchInfoInitViewModel SearchInfoInit() { #region 參數宣告 SearchInfoInitViewModel searchInfoInit = new SearchInfoInitViewModel(); IaaaService aaaService = new aaaService(); IAuthorityService authorityService = new AuthorityService(); #endregion #region 流程 //檢查是否驗證通過 if (!_authState.IsAuth) { throw new Exception(_authState.AuthDescription); } try { //取得SearchInfoInit searchInfoInit = aaaService.QuerySearchInfoInit(); } catch (Exception ex) { throw ex; } return(searchInfoInit); #endregion }
public bool login() { aaaService service = new aaaService("https://" + mseAddr + "/aaa/"); //Login LoginMethodArgs LM = new LoginMethodArgs(); AesLogin AL = new AesLogin(); AL.userName = mseUser; AL.password = msePasswd; LM.AesLogin = AL; try { Session s = service.Login(LM); if (s != null) { aaa.AesBusinessSession AB = (aaa.AesBusinessSession)s.AesBusinessSession; if (verbosity) { Trace.WriteLine("\nConnection ID = " + AB.id); } sessionId = AB.id; return(true); } } catch (Exception x) { Trace.WriteLine(x); return(false); } return(false); }
public bool Detail(DetailViewModel detail) { #region 參數宣告 bool result = false; IaaaService aaaService = new aaaService(); _BaseDetailRequestViewModel.EnumActiveType enumActiveType; #endregion #region 流程 if (!_authState.IsAuth) { throw new Exception(_authState.AuthDescription); } // 參數驗證 VerifyParams(detail); try { enumActiveType = detail.ActiveType.ConvertToEnum <_BaseDetailRequestViewModel.EnumActiveType>(); VerifyActiveType(enumActiveType, detail); //處理新增/編輯/刪除資料 switch (enumActiveType) { case _BaseDetailRequestViewModel.EnumActiveType.ADD: aaaService.AddDetail(detail); result = true; break; case _BaseDetailRequestViewModel.EnumActiveType.EDIT: aaaService.EditDetail(detail); result = true; break; case _BaseDetailRequestViewModel.EnumActiveType.DELETE: aaaService.DeleteDetail(detail); result = true; break; } } catch (Exception ex) { throw ex; } #endregion return(result); }
public ViewDetailViewModel ViewDetail(DetailRequestViewModel detailRequest) { #region 參數宣告 ViewDetailViewModel viewDetail = new ViewDetailViewModel(); IaaaService aaaService = new aaaService(); _BaseDetailRequestViewModel.EnumActiveType enumActiveType; #endregion #region 流程 if (!_authState.IsAuth) { throw new Exception(_authState.AuthDescription); } // 參數驗證 VerifyParams(detailRequest); try { enumActiveType = detailRequest.ActiveType.ConvertToEnum <_BaseDetailRequestViewModel.EnumActiveType>(); //判斷為EDIT 或 VIEW時需抓資料並檢查編輯權限 if (enumActiveType.Equals(_BaseDetailRequestViewModel.EnumActiveType.VIEW) || enumActiveType.Equals(_BaseDetailRequestViewModel.EnumActiveType.EDIT)) { //取得明細資料 viewDetail.Detail = aaaService.QueryDetail(detailRequest); //驗證編輯權限 VerifyActiveType(enumActiveType, ref viewDetail); } //取得明細下拉選單項目 viewDetail.DetailOption = aaaService.QueryDetailOption(); } catch (Exception ex) { throw ex; } #endregion return(viewDetail); }
public bool logout() { try { aaaService service = new aaaService("https://" + mseAddr + "/aaa/"); LogoutMethodArgs LMA = new LogoutMethodArgs(); LMA.AesBusinessSession = new aaa.AesBusinessSession(); LMA.AesBusinessSession.id = sessionId; LMA.AesLogout = new AesLogout(); aaa.Response r2 = service.Logout(LMA); if (r2 != null) { return(true); } else { Trace.WriteLine("Logout failed"); return(false); } } catch { return(false); } }
public SearchListViewModel SearchList(SearchInfoViewModel searchInfo) { #region 參數宣告 SearchListViewModel searchList = new SearchListViewModel(); IaaaService aaaService = new aaaService(); IAuthorityService authorityService = new AuthorityService(); #endregion #region 流程 //檢查是否驗證通過 if (!_authState.IsAuth) { throw new Exception(_authState.AuthDescription); } // 參數驗證 VerifyParams(searchInfo); try { //取得查詢結果 searchList = aaaService.QuerySearchList(searchInfo); //檢查資料編輯權限 searchList.SearchItemList.ForEach(item => item.HasEditPermission = authorityService.HasDataPermission(_authState.UserID, item.DepartmentCD)); } catch (Exception ex) { throw ex; } #endregion return(searchList); }