Ejemplo n.º 1
0
        /// <summary>
        /// 获取在线用户列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        public DataTable GetOnLineState(UserInfo userInfo)
        {
            var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, locker, (dbProvider, getOnLine) =>
            {
                var manager = new PiUserLogOnManager(dbProvider);
                // 设置为在线状态
                manager.OnLine(userInfo.Id);
                if (MessageService.LastCheckOnLineState == DateTime.MinValue)
                {
                    getOnLine = true;
                }
                else
                {
                    TimeSpan timeSpan = DateTime.Now - MessageService.LastCheckOnLineState;
                    if ((timeSpan.Minutes * 60 + timeSpan.Seconds) >= SystemInfo.OnLineCheck)
                    {
                        getOnLine = true;
                    }
                }

                if (OnLineStateDT == null || getOnLine)
                {
                    // 检查用户在线状态(服务器专用)
                    manager.CheckOnLine();
                    // 获取在线状态列表
                    OnLineStateDT                       = manager.GetOnLineStateDT();
                    OnLineStateDT.TableName             = PiUserTable.TableName;
                    MessageService.LastCheckOnLineState = DateTime.Now;
                }
                return(getOnLine);
            });
            return(OnLineStateDT);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 用户在线
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="onLineState">用户在线状态</param>
        public void OnLine(UserInfo userInfo, int onLineState = 1)
        {
            var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, locker, dbProvider =>
            {
                var manager = new PiUserLogOnManager(dbProvider, userInfo);
                manager.OnLine(userInfo.Id, onLineState);
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取倒序序列号
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="fullName">序列名称</param>
        /// <returns>序列号</returns>
        public string GetReduction(UserInfo userInfo, string fullName)
        {
            string returnValue = string.Empty;
            var    parameter   = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, Lock, dbProvider =>
            {
                returnValue = this.GetReduction(dbProvider, userInfo, fullName);
            });
            return(returnValue);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取新序列号
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="fullName">序列名称</param>
        /// <param name="defaultSequence">默认序列</param>
        /// <param name="sequenceLength">序列长度</param>
        /// <param name="fillZeroPrefix">是否填充补零</param>
        /// <returns>序列号</returns>
        public string GetNewSequence(UserInfo userInfo, string fullName, int defaultSequence, int sequenceLength, bool fillZeroPrefix)
        {
            string returnValue = string.Empty;
            var    parameter   = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, Lock, dbProvider =>
            {
                returnValue = new CiSequenceManager(dbProvider).GetSequence(fullName, defaultSequence, sequenceLength, fillZeroPrefix);
            });
            return(returnValue);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="openId">单点登录标识</param>
        /// <param name="createOpenId">重新创建单点登录标识</param>
        /// <param name="returnStatusCode">返回状态码</param>
        /// <param name="returnStatusMessage">返回状消息</param>
        /// <returns>用户实体</returns>
        public UserInfo UserLogOn(UserInfo userInfo, string userName, string password, string openId, bool createOpenId, out string returnStatusCode, out string returnStatusMessage)
        {
            returnStatusCode = StatusCode.DbError.ToString();
            string   returnCode     = string.Empty;
            string   returnMessage  = string.Empty;
            UserInfo returnUserInfo = null;
            var      parameter      = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, locker, dbProvider =>
            {
                var userManager = new PiUserManager(dbProvider, userInfo);
                // 先侦测是否在线
                //userLogOnManager.CheckOnLine();
                // 再进行登录
                returnUserInfo = userManager.LogOn(userName, password, openId, createOpenId);
                returnCode     = userManager.ReturnStatusCode;
                returnMessage  = userManager.GetStateMessage(returnCode);
            });
            returnStatusCode    = returnCode;
            returnStatusMessage = returnMessage;
            return(returnUserInfo);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取内部组织机构
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        public DataTable GetInnerOrganizeDT(UserInfo userInfo)
        {
            var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, locker, (dbProvider, getOnLine) =>
            {
                var organizeManager = new PiOrganizeManager(dbProvider, userInfo);
                if (MessageService.LastCheckOrgTime == DateTime.MinValue)
                {
                    getOnLine = true;
                }
                else
                {
                    TimeSpan timeSpan = DateTime.Now - MessageService.LastCheckOrgTime;
                    if ((timeSpan.Minutes * 60 + timeSpan.Seconds) >= SystemInfo.OnLineCheck * 100)
                    {
                        getOnLine = true;
                    }
                }
                if (OnLineStateDT == null || getOnLine)
                {
                    string commandText = " SELECT * "
                                         + " FROM " + PiOrganizeTable.TableName
                                         + " WHERE " + PiOrganizeTable.FieldDeleteMark + " = 0 "
                                         + " AND " + PiOrganizeTable.FieldIsInnerOrganize + " = 1 "
                                         + " AND " + PiOrganizeTable.FieldEnabled + " = 1 "
                                         + " ORDER BY " + PiOrganizeTable.FieldSortCode;
                    InnerOrganizeDT                 = organizeManager.Fill(commandText);
                    InnerOrganizeDT.TableName       = PiOrganizeTable.TableName;
                    MessageService.LastCheckOrgTime = DateTime.Now;
                }
                return(getOnLine);
            });

            return(InnerOrganizeDT);
        }