using Forks.JsonRpc.Client; using Forks.JsonRpc.Client.Data; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BO.Utils { public class LoginRpcUtil { public static string GetUserNameByCode(string code, out string error) { try { error = string.Empty; const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/UserInfoRpc/GetUserName"; return RpcFacade.Call(wpfUserMethod, code); } catch (Exception ex) { error = ex.ToString(); } return string.Empty; } public static void FillUserEmpInfo(string name, LoginUserInfo userInfo) { const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/UserInfoRpc/GetUserEmpInfo"; var obj = RpcFacade.Call(wpfUserMethod, name); if (obj != null) { userInfo.ID = obj.Get("User_ID"); userInfo.UserName = obj.Get("User_Name"); userInfo.Domain_ID = obj.Get("Domain_ID"); userInfo.AccountingUnit_ID = obj.Get("AccountingUnit_ID"); userInfo.AccountingUnit_Name = obj.Get("AccountingUnit_Name"); userInfo.Department_ID = obj.Get("Department_ID"); userInfo.Department_Name = obj.Get("Department_Name"); userInfo.Employee_ID = obj.Get("Employee_ID"); userInfo.Employee_Name = obj.Get("Employee_Name"); userInfo.Role = obj.Get("Role"); } } public static string CheckVersion(string version) { const string method = "/MainSystem/B3ClientService/Rpcs/VersionRpc/CheckVersion"; return RpcFacade.Call(method, version); } } }