更新时间:2023-01-28 13:30:32
下面
using PX.Common;
using PX.Data;
using PX.Objects.CS;
using System.Collections;
using System.Web;
namespace AccessInfoChange
{
public class BranchMaintExtension : PXGraphExtension<BranchMaint>
{
public PXAction<BranchMaint.BranchBAccount> changeBranch;
[PXUIField(DisplayName = "Change Branch")]
[PXButton]
public virtual IEnumerable ChangeBranch(PXAdapter adapter)
{
int branchObj = 5; //BranchID of Branch you would like to switch to
PXContext.SetBranchID(branchObj);
HttpCookie branchCooky = HttpContext.Current.Response.Cookies["UserBranch"];
if (branchCooky == null)
HttpContext.Current.Response.Cookies.Add(new HttpCookie("UserBranch", "MAIN"));//BranchCD of Branch to switch
else branchCooky.Value = branchObj.ToString();//String of IntegerID for BranchID to switch
return adapter.Get();
}
}
}