zoukankan      html  css  js  c++  java
  • User Login Control in ERP ssytem

    Remark by Jimmy on June 4th 2010 am
    According to the user's cost profit center set limit to subscribers,So that the largest number of user login to control the ERP.
    X++ code below as:
    the method inside of sysUserLog table sub insert method.
    AX 2009 test successful

    代码
    public void Jimmy_startupPostUserControl()
    {
    /**
    remark by Jimmy on June 4th 2010 am
    According to the user's cost profit center set limit to subscribers,So that the largest number of user login to control the ERP.
    X++ code below as:
    the method inside of sysUserLog table sub insert method.
    AX 2009 test successful
    */
    SysGlobalCache cache
    = appl.globalCache();
    info info
    = new info();
    xSession session;
    UserInfo userInfo;
    UserId currentUserId;
    QVS_UserLoginControl UserLoginControl;
    Str
    50 costCenter;
    int counter;
    int num = 0;
    int maxSessions = Info::licensedUsersTotal();
    ;
    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
    ++ ;
    }
    }
    }

    costCenter
    = QVS_UserInfo::find(currentUserId).Dimension[2];
    select firstonly UserLoginControl
    where UserLoginControl.Dimension[2] == costCenter
    && UserLoginControl.Actived == Noyes::Yes;

    if(num > UserLoginControl.counts && UserLoginControl)
    {
    box::info(strfmt(
    "The current user (%1) has exceeded the departments's (%2) set to the maximum extent( %3 ).",currentUserId,costCenter,numeralsToTxt_CN(UserLoginControl.counts,false,false,5)));
    cache.
    set(classstr(info), identifierstr(Autologoff), true);//自动注销保存当前所有操作
    info.shutDown(true);
    infolog.shutDown(
    true);
    return ;
    }
    if (num > 1 && !UserLoginControl)
    {

    info(strfmt(
    "%1,%2",costCenter,num));
    box::info(strfmt(
    "The same user %1 can't log in twice",currentUserId));
    cache.
    set(classstr(info), identifierstr(Autologoff), true);//自动注销保存当前所有操作
    info.shutDown(true); //
    infolog.shutDown(true);
    return;

    /*
    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);
    }
    */
    }

    }







  • 相关阅读:
    Cogs 465. 挤牛奶
    洛谷P1083 借教室
    Cogs 1264. [NOIP2012] 开车旅行(70分 暴力)
    2017-10-19 NOIP模拟赛
    Codevs 2144 砝码称重 2
    洛谷P1450 [HAOI2008]硬币购物
    洛谷P2534 [AHOI2012]铁盘整理
    洛谷P1731 生日蛋糕
    2017-10-18 NOIP模拟赛
    洛谷P1074 靶形数独
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1751196.html
Copyright © 2011-2022 走看看