|  |  |  | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | using System.Data; | 
|---|
|  |  |  | using System.Linq; | 
|---|
|  |  |  | using System.Text; | 
|---|
|  |  |  | using System.Threading.Tasks; | 
|---|
|  |  |  | 
|---|
|  |  |  | return httpClient.SyncRequest(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static string LoginUser(string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //从C盘配置文件获取 CLOUD网址、账套信息、登录用户、登录密码 | 
|---|
|  |  |  | Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | var useName = Pub_Class.ClsPub.sCLOUDUseName; | 
|---|
|  |  |  | var pwd = Pub_Class.ClsPub.sCLOUDPsd; | 
|---|
|  |  |  | var dbId = Pub_Class.ClsPub.sCLOUDAcc; | 
|---|
|  |  |  | CloudUrl = Pub_Class.ClsPub.sCLOUDUrl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取用户绑定金蝶账号 | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_p_API_GetCloudUserByLoginUser '" + user.ToString() + "'", "h_p_API_GetCloudUserByLoginUser"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds != null && ds.Tables[0].Rows.Count != 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | useName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HCloudUserName"]); | 
|---|
|  |  |  | pwd = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HCloudUserPsd"]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | HttpClient httpClient = new HttpClient(); | 
|---|
|  |  |  | httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<object> Parameters = new List<object>(); | 
|---|
|  |  |  | Parameters.Add(dbId);//账套标示 | 
|---|
|  |  |  | Parameters.Add(useName);//用户名 | 
|---|
|  |  |  | Parameters.Add(pwd);//密码 | 
|---|
|  |  |  | Parameters.Add(2052);//2052代表中文 | 
|---|
|  |  |  | httpClient.Content = JsonConvert.SerializeObject(Parameters); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return httpClient.SyncRequest(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static async Task<string> LoginAsync() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | HttpClient httpClient = new HttpClient(); | 
|---|