2021-01-06 12:43:05 +08:00
|
|
|
|
using MSXML2;
|
|
|
|
|
|
using System;
|
2021-01-05 11:11:28 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using U8Login;
|
2021-01-06 12:43:05 +08:00
|
|
|
|
using UFIDA.U8.U8APIFramework;
|
|
|
|
|
|
using UFIDA.U8.U8MOMAPIFramework;
|
2021-01-07 17:01:56 +08:00
|
|
|
|
using Dapper;
|
2021-01-05 11:11:28 +08:00
|
|
|
|
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;
|
|
|
|
|
|
|
2021-01-05 16:49:51 +08:00
|
|
|
|
|
|
|
|
|
|
public string cAcc_id
|
2021-01-05 11:11:28 +08:00
|
|
|
|
{
|
2021-01-05 16:49:51 +08:00
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return this._clslogin.get_cAcc_Id();
|
|
|
|
|
|
}
|
2021-01-05 11:11:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-05 16:49:51 +08:00
|
|
|
|
public U8LoginContext()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
2021-01-05 11:11:28 +08:00
|
|
|
|
public clsLogin ClsLogin
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this._clslogin == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Login();
|
|
|
|
|
|
}
|
|
|
|
|
|
return this._clslogin;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-07 17:01:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public int GetDefaultPoTaxRate()
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
|
|
// try
|
|
|
|
|
|
// {
|
|
|
|
|
|
// string strSQL = "Select cValue from AccInformation Where cSysID=N'PU' and cName=N'iDefaultZHBVRate'";
|
|
|
|
|
|
// using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// return conn.ExecuteScalar<int>(strSQL, null, null, 0, System.Data.CommandType.Text);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// catch (Exception)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// throw;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// finally
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-05 11:11:28 +08:00
|
|
|
|
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";
|
|
|
|
|
|
|
2021-01-05 16:49:51 +08:00
|
|
|
|
public string AccID { get; set; } = "(default)@001";
|
2021-01-05 11:11:28 +08:00
|
|
|
|
|
|
|
|
|
|
public string Serial { get; set; }
|
2021-01-05 16:49:51 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ADO.NET 链接字符串
|
|
|
|
|
|
/// </summary>
|
2021-01-05 11:11:28 +08:00
|
|
|
|
public string Constr4Net
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return this.ClsLogin.UFDataConnstringForNet;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-01-07 17:01:56 +08:00
|
|
|
|
public string LoginUserName
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return this.ClsLogin.cUserName;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string LoginUserId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return this.ClsLogin.cUserId;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-01-05 16:49:51 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ADO的链接字符串
|
|
|
|
|
|
/// </summary>
|
2021-01-05 11:11:28 +08:00
|
|
|
|
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)
|
|
|
|
|
|
{
|
2021-01-05 16:49:51 +08:00
|
|
|
|
if (showlogin)
|
2021-01-05 11:11:28 +08:00
|
|
|
|
{
|
2021-01-05 16:49:51 +08:00
|
|
|
|
if (!UiLogin.login("DP"))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(UiLogin.ErrDescript);
|
|
|
|
|
|
}
|
2021-01-05 11:11:28 +08:00
|
|
|
|
}
|
2021-01-05 16:49:51 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (!UiLogin.login("DP", "wx999", "!@#qwe123", "192.168.0.168", DateTime.Today.ToString("yyyy-MM-dd"), AccID, Serial))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(UiLogin.ErrDescript);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-05 11:11:28 +08:00
|
|
|
|
|
|
|
|
|
|
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"));
|
|
|
|
|
|
|
2021-01-05 16:49:51 +08:00
|
|
|
|
|
2021-01-05 11:11:28 +08:00
|
|
|
|
}
|
2021-01-06 12:43:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
2021-01-13 13:30:24 +08:00
|
|
|
|
|
2021-01-07 14:06:26 +08:00
|
|
|
|
|
2021-01-13 13:30:24 +08:00
|
|
|
|
|
2021-01-07 14:06:26 +08:00
|
|
|
|
|
2021-01-07 17:01:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
2021-01-07 14:06:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-05 11:11:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|