修正项目
This commit is contained in:
132
NX.ERP.U8/U8LoginContext.cs
Normal file
132
NX.ERP.U8/U8LoginContext.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using U8Login;
|
||||
|
||||
|
||||
namespace NX.ERP.U8
|
||||
{
|
||||
public class U8LoginContext : IDisposable
|
||||
{
|
||||
|
||||
|
||||
private static U8LoginContext _u8LoginContext;
|
||||
|
||||
public static U8LoginContext Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
if (_u8LoginContext == null)
|
||||
{
|
||||
_u8LoginContext = new U8LoginContext();
|
||||
}
|
||||
return _u8LoginContext;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private UFSoft.U8.Framework.Login.UI.clsLogin uiLogin;
|
||||
|
||||
private clsLogin _clslogin;
|
||||
|
||||
public U8LoginContext()
|
||||
{
|
||||
//uiLogin = new UFSoft.U8.Framework.Login.UI.clsLogin();
|
||||
}
|
||||
|
||||
public clsLogin ClsLogin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._clslogin == null)
|
||||
{
|
||||
this.Login();
|
||||
}
|
||||
return this._clslogin;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (uiLogin != null)
|
||||
{
|
||||
uiLogin.SubLogout(AccID);
|
||||
uiLogin.ShutDown();
|
||||
uiLogin = null;
|
||||
}
|
||||
|
||||
}
|
||||
public string UserId { get; set; } = "003";
|
||||
|
||||
public string PassWord { get; set; } = "123456";
|
||||
|
||||
public string Server { get; set; } = "192.168.0.250";
|
||||
|
||||
public string AccID { get; set; } = "u8@889";
|
||||
|
||||
public string Serial { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public string Constr4Net
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ClsLogin.UFDataConnstringForNet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string Constr
|
||||
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ClsLogin.UfDbName;
|
||||
}
|
||||
}
|
||||
|
||||
private UFSoft.U8.Framework.Login.UI.clsLogin UiLogin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (uiLogin == null)
|
||||
{
|
||||
uiLogin = new UFSoft.U8.Framework.Login.UI.clsLogin();
|
||||
}
|
||||
return uiLogin;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void Login(bool showlogin = false)
|
||||
{
|
||||
if (!UiLogin.login("DP", "wx998", "", "192.168.0.250", "2020-12-31", AccID, Serial, showlogin))
|
||||
{
|
||||
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