Axapta : Limited users sessions

แก้ startupPost method ใน Info class ดังนี้

void startupPost()
{
int counter;
int num = 0;
int maxSessions = Info::licensedUsersTotal();
xSession session;
UserInfo userInfo;
UserId currentUserId;
;

currentUserId = curuserid();
for(counter = 1; counter < maxSessions;counter++ )
{
session = new xSession(counter, true);
if(session && session.userId())
{
select firstOnly userInfo
where userInfo.id == session.userId();

if (userInfo && (currentUserId == session.userId()))
{
num++ ;
}
}
}

if (num > 1)
{
if(box::yesno("The same user id can't log in twice. Do you want to log in anyway? ",
DialogButton::Yes, "Log in", "Log out") == DialogButton::No)
{
infolog.shutDown(true);
}
}
}

Comments

Popular posts from this blog

Artillery Hornet + OctoPrint + Klipper

ย้ายบ้าน

ใต้ร่มกาสาวพัตร