This commit is contained in:
2025-08-08 10:36:02 +08:00
parent ec10996079
commit d040b97cbc
4 changed files with 67 additions and 17 deletions

38
Utils/ContextUtil.cs Normal file
View File

@@ -0,0 +1,38 @@
using GZ_LTHPilot_ORDER.Config;
using Kingdee.BOS;
using Kingdee.BOS.ServiceHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GZ_LTHPilot_ORDER.Utils
{
public class ContextUtil
{
Context ctx { get; set; }
public ContextUtil(Context ctx)
{
this.ctx = ctx;
}
public Context GetDefaultContext()
{
var userName = ContextConfig.DefaultUserName;
var userId = ContextConfig.DefaultUserId;
return GetNewContext(userId, userName);
}
public Context GetNewContext(long userId, string userName)
{
Context newCtx = DataCenterService.GetDataCenterContextByID(ctx.DBId);
newCtx.UserId = userId;
newCtx.UserName = userName;
newCtx.ServiceType = WebType.WebSite;
newCtx.CurrentOrganizationInfo.ID = 1;
return newCtx;
}
}
}