AccountServiceClient.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Aitex.Core.Account;
  6. using Aitex.Core.Util;
  7. using Aitex.Core.WCF;
  8. namespace Aitex.Triton160.UI.Wcf
  9. {
  10. public class AccountServiceClient : ServiceClientWrapper<IAccountService>, IAccountService
  11. {
  12. public AccountServiceClient()
  13. : base("Client_IAccountService", "AccountService")
  14. {
  15. }
  16. /// <summary>
  17. /// user login verify
  18. /// </summary>
  19. /// <param name="accountId"></param>
  20. /// <param name="accountPwd"></param>
  21. /// <returns></returns>
  22. public LoginResult Login(string accountId, string accountPwd)
  23. {
  24. LoginResult result = null;
  25. Invoke(svc => { result = svc.Login(accountId, accountPwd); });
  26. return result;
  27. }
  28. /// <summary>
  29. /// user logout system
  30. /// </summary>
  31. /// <param name="accountId"></param>
  32. public void Logout(string accountId)
  33. {
  34. Invoke(svc => { svc.Logout(accountId); });
  35. }
  36. /// <summary>
  37. /// get user data by accountId
  38. /// </summary>
  39. /// <param name="accountId"></param>
  40. /// <returns></returns>
  41. public GetAccountInfoResult GetAccountInfo(string accountId)
  42. {
  43. GetAccountInfoResult result = null;
  44. Invoke(svc => { result = svc.GetAccountInfo(accountId); });
  45. return result;
  46. }
  47. /// <summary>
  48. /// change account password
  49. /// </summary>
  50. /// <param name="accountId"></param>
  51. /// <param name="newPassword"></param>
  52. public ChangePwdResult ChangePassword(string accountId, string newPassword)
  53. {
  54. ChangePwdResult result = null;
  55. Invoke(svc => { result = svc.ChangePassword(accountId, newPassword); });
  56. return result;
  57. }
  58. /// <summary>
  59. /// create account
  60. /// </summary>
  61. /// <param name="newAccount"></param>
  62. /// <returns></returns>
  63. public CreateAccountResult CreateAccount(Account newAccount)
  64. {
  65. CreateAccountResult result = null;
  66. Invoke(svc => { result = svc.CreateAccount(newAccount); });
  67. return result;
  68. }
  69. /// <summary>
  70. /// Administrator user calls this method to delete an account.
  71. /// </summary>
  72. /// <param name="account"></param>
  73. /// <returns></returns>
  74. public DeleteAccountResult DeleteAccount(string accountId)
  75. {
  76. DeleteAccountResult result = null;
  77. Invoke(svc => { result = svc.DeleteAccount(accountId); });
  78. return result;
  79. }
  80. /// <summary>
  81. /// Update account information
  82. /// </summary>
  83. /// <param name="accountList"></param>
  84. /// <returns></returns>
  85. public UpdateAccountResult UpdateAccount(Account account)
  86. {
  87. UpdateAccountResult result = null;
  88. Invoke(svc => { result = svc.UpdateAccount(account); });
  89. return result;
  90. }
  91. /// <summary>
  92. /// get account list
  93. /// </summary>
  94. /// <returns></returns>
  95. public GetAccountListResult GetAccountList()
  96. {
  97. GetAccountListResult result = null;
  98. Invoke(svc => { result = svc.GetAccountList(); });
  99. return result;
  100. }
  101. /// <summary>
  102. /// 获取当前所有已登录的用户列表
  103. /// </summary>
  104. /// <returns></returns>
  105. public List<Account> GetLoginUsers()
  106. {
  107. List<Account> result = null;
  108. Invoke(svc => { result = svc.GetLoginUsers(); });
  109. return result;
  110. }
  111. /// <summary>
  112. /// 强制注销用户登录
  113. /// </summary>
  114. /// <param name="accountId"></param>
  115. /// <param name="kickoutReason"></param>
  116. public void KickUserOut(string accountId, string kickoutReason)
  117. {
  118. Invoke(svc => { svc.KickUserOut(accountId, kickoutReason); });
  119. }
  120. /// <summary>
  121. /// get all roles' perrmission
  122. /// </summary>
  123. /// <returns></returns>
  124. public SerializableDictionary<string, SerializableDictionary<string, ViewPermission>> GetAllRolesPermission()
  125. {
  126. SerializableDictionary<string, SerializableDictionary<string, ViewPermission>> result = null;
  127. Invoke(svc => { result = svc.GetAllRolesPermission(); });
  128. return result;
  129. }
  130. /// <summary>
  131. /// save all roles' permission
  132. /// </summary>
  133. /// <param name="data"></param>
  134. /// <returns></returns>
  135. public bool SaveAllRolesPermission(Dictionary<string, Dictionary<string, ViewPermission>> data)
  136. {
  137. bool result = false;
  138. Invoke(svc => { result = svc.SaveAllRolesPermission(data); });
  139. return result;
  140. }
  141. /// <summary>
  142. /// get all view's list
  143. /// </summary>
  144. /// <returns></returns>
  145. public SerializableDictionary<string, string> GetAllViewList()
  146. {
  147. SerializableDictionary<string, string> result = null;
  148. Invoke(svc => { result = svc.GetAllViewList(); });
  149. return result;
  150. }
  151. /// <summary>
  152. /// Get all defined roles
  153. /// </summary>
  154. /// <returns></returns>
  155. public IEnumerable<string> GetAllRoles()
  156. {
  157. IEnumerable<string> result = null;
  158. Invoke(svc => { result = svc.GetAllRoles(); });
  159. return result;
  160. }
  161. /// <summary>
  162. /// 检查账号是否仍旧有效
  163. /// </summary>
  164. /// <param name="accountId"></param>
  165. public void CheckAlive(string accountId)
  166. {
  167. Invoke(svc => { svc.CheckAlive(accountId); });
  168. }
  169. /// <summary>
  170. /// 获取流程视图的许可
  171. /// </summary>
  172. /// <returns></returns>
  173. public string GetProcessViewPermission()
  174. {
  175. string result = null;
  176. Invoke(svc => { result = svc.GetProcessViewPermission(); });
  177. return result;
  178. }
  179. /// <summary>
  180. /// 保存流程视图的许可
  181. /// </summary>
  182. /// <param name="viewXML"></param>
  183. /// <returns></returns>
  184. public bool SaveProcessViewPermission(string viewXML)
  185. {
  186. bool result = false;
  187. Invoke(svc => { result = svc.SaveProcessViewPermission(viewXML); });
  188. return result;
  189. }
  190. }
  191. }