修改登录模块~支持多用户登录
This commit is contained in:
@@ -10,10 +10,12 @@ namespace NX.ERP.U8
|
||||
{
|
||||
public class U8LoginContext : IDisposable
|
||||
{
|
||||
#region 单例
|
||||
private static readonly object locker = new object();
|
||||
private static U8LoginContext _u8LoginContext;
|
||||
private string EaiPort = System.Configuration.ConfigurationManager.AppSettings["EaiPort"];
|
||||
private string EaiPath = System.Configuration.ConfigurationManager.AppSettings["EaiPath"];
|
||||
/// <summary>
|
||||
/// 默认实例
|
||||
/// </summary>
|
||||
public static U8LoginContext Instance
|
||||
{
|
||||
get
|
||||
@@ -25,6 +27,7 @@ namespace NX.ERP.U8
|
||||
if (_u8LoginContext == null)
|
||||
{
|
||||
_u8LoginContext = new U8LoginContext();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +38,10 @@ namespace NX.ERP.U8
|
||||
private UFSoft.U8.Framework.Login.UI.clsLogin uiLogin;
|
||||
private clsLogin _clslogin;
|
||||
|
||||
#endregion
|
||||
|
||||
private string EaiPort = System.Configuration.ConfigurationManager.AppSettings["EaiPort"];
|
||||
private string EaiPath = System.Configuration.ConfigurationManager.AppSettings["EaiPath"];
|
||||
|
||||
public string cAcc_id
|
||||
{
|
||||
@@ -44,9 +51,29 @@ namespace NX.ERP.U8
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public U8LoginContext()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="Server"></param>
|
||||
/// <param name="Accid"></param>
|
||||
public U8LoginContext(string Server, string Accid)
|
||||
{
|
||||
this._server = Server;
|
||||
this._accid = Accid;
|
||||
}
|
||||
|
||||
public U8LoginContext(string userid, string password, string server, string accid) : this(server, accid)
|
||||
{
|
||||
this._password = password;
|
||||
this._userId = userid;
|
||||
}
|
||||
private static readonly object locker1 = new object();
|
||||
|
||||
public clsLogin ClsLogin
|
||||
@@ -256,35 +283,18 @@ namespace NX.ERP.U8
|
||||
string.IsNullOrEmpty(this._password) ||
|
||||
string.IsNullOrEmpty(this._server) ||
|
||||
string.IsNullOrEmpty(this._accid);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Login()
|
||||
|
||||
public void Login(string userId, string password)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if (NeedUiLogin)
|
||||
if (!UiLogin.login("DP", userId, password, this._server, DateTime.Today.ToString("yyyy-MM-dd"), this._accid, Serial))
|
||||
{
|
||||
if (!UiLogin.login("DP"))
|
||||
{
|
||||
|
||||
throw new Exception(UiLogin.ErrDescript);
|
||||
|
||||
}
|
||||
throw new Exception(UiLogin.ErrDescript);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UiLogin.login("DP", this._userId, this._password, this._server, DateTime.Today.ToString("yyyy-MM-dd"), this._accid, Serial))
|
||||
{
|
||||
throw new Exception(UiLogin.ErrDescript);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (UiLogin.SubLogin("ST") == null)
|
||||
{
|
||||
@@ -299,6 +309,62 @@ namespace NX.ERP.U8
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录ID 唯一凭据
|
||||
/// </summary>
|
||||
public string loginId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.UserToken == null ? "" : this.UserToken.UserTokenData.SignedToken.Id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ufsoft UserToken
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._clslogin == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (this._clslogin.userToken=="")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return XmlHelper.XmlDeserialize<ufsoft>(this._clslogin.userToken, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
public void Login()
|
||||
{
|
||||
if (NeedUiLogin)
|
||||
{
|
||||
if (!UiLogin.login("DP"))
|
||||
{
|
||||
throw new Exception(UiLogin.ErrDescript);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UiLogin.login("DP", this._userId, this._password, this._server, DateTime.Today.ToString("yyyy-MM-dd"), this._accid, Serial))
|
||||
{
|
||||
throw new Exception(UiLogin.ErrDescript);
|
||||
}
|
||||
}
|
||||
|
||||
if (UiLogin.SubLogin("ST") == null)
|
||||
{
|
||||
throw new Exception(UiLogin.ErrDescript);
|
||||
}
|
||||
this._clslogin = new clsLoginClass();
|
||||
if (!_clslogin.ConstructLogin(UiLogin.userToken))
|
||||
{
|
||||
throw new Exception(_clslogin.ShareString);
|
||||
}
|
||||
_clslogin.set_TaskId(UiLogin.GetTaskID("ST"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user