获取用户Token
///
/// 获取用户token
///
///
private string GetUserToken()
{
string dbId = "";//账套id
string username = "Administrator"; //用户名
string password = "00"; //密码
int lcid = 2052; //登录语言
string loginResultString = _client.Login(dbid, username, password, lcid);//调用登录
JObject loginResult = JsonConvert.DeserializeObject<JObject>(loginResultString);//拿到结果后反序列化方便取数
return loginResult["Context"]["UserToken"].ToString();//返回用户Token
}
/// 获取用户token
///
///
private string GetUserToken()
{
string dbId = "";//账套id
string username = "Administrator"; //用户名
string password = "00"; //密码
int lcid = 2052; //登录语言
string loginResultString = _client.Login(dbid, username, password, lcid);//调用登录
JObject loginResult = JsonConvert.DeserializeObject<JObject>(loginResultString);//拿到结果后反序列化方便取数
return loginResult["Context"]["UserToken"].ToString();//返回用户Token
}
获取上下文Context
///
/// 获取当前系统上下文信息
///
///
public static Context GetContext()
{
UserServiceProxy userServiceProxy = new UserServiceProxy();
userServiceProxy.HostURL = WebSiteUrl;
LoginInfo loginInfo = new LoginInfo();
loginInfo.AcctID = dbid;//账套id
loginInfo.Username = username; //用户名
loginInfo.Password = password; //密码
loginInfo.Lcid = 2052;//登录语言
var ret = userServiceProxy.ValidateUser(WebSiteUrl, loginInfo);
return ret.Context;//返回上下文信息
}
/// 获取当前系统上下文信息
///
///
public static Context GetContext()
{
UserServiceProxy userServiceProxy = new UserServiceProxy();
userServiceProxy.HostURL = WebSiteUrl;
LoginInfo loginInfo = new LoginInfo();
loginInfo.AcctID = dbid;//账套id
loginInfo.Username = username; //用户名
loginInfo.Password = password; //密码
loginInfo.Lcid = 2052;//登录语言
var ret = userServiceProxy.ValidateUser(WebSiteUrl, loginInfo);
return ret.Context;//返回上下文信息
}
暂无评论