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

    }







  • 相关阅读:
    高性能无锁队列,代码注释
    阿里mysql同步工具otter的docker镜像
    webgl鱼眼算法
    国际网络环境对库的影响
    newlisp
    java面试之数据库
    java面试之遇到过的问题
    java面试之springboot
    git常用命令
    java面试之jenkins
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1751196.html
Copyright © 2011-2022 走看看