Piolot_Order_TH/Utils/ContextUtil.cs

39 lines
1009 B
C#
Raw Normal View History

2025-08-08 10:36:02 +08:00
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;
}
}
}