0
This commit is contained in:
38
Utils/ContextUtil.cs
Normal file
38
Utils/ContextUtil.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user