コード例 #1
0
ファイル: CPLogHelper.cs プロジェクト: vebin/qMISPlat
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="userName">用户姓名</param>
        /// <param name="device">设备类型</param>
        /// <param name="operRemark">日志内容</param>
        /// <param name="operType">日志类型</param>
        /// <returns></returns>
        public bool AddLog(int userId, string userName, CPEnum.DeviceTypeEnum device, string operRemark, string operType)
        {
            CPLog log = new CPLog();

            log.UserId     = userId;
            log.UserName   = userName;
            log.OperTime   = DateTime.Now;
            log.OperDevice = device;
            log.OperRemark = operRemark;
            log.OperType   = operType;
            log.OperIP     = "";
            try
            {
                //获取操作IP
                log.OperIP = CPAppContext.GetClientIP();
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            log.OperUrl = "";
            try
            {
                //获取办理页面地址
                log.OperUrl = CPAppContext.GetHttpContext().Request.Path;
            }
            catch (Exception ex)
            {
            }
            return(this._CPLogRep.Add(log) > 0 ? true : false);
        }
コード例 #2
0
ファイル: CPLogHelper.cs プロジェクト: vebin/qMISPlat
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="userName">用户姓名</param>
        /// <param name="device">设备类型</param>
        /// <param name="operRemark">日志内容</param>
        /// <param name="operType">日志类型</param>
        /// <param name="operIP">用户操作IP</param>
        /// <param name="operUrl">用户操作页面URL</param>
        /// <returns></returns>
        public bool AddLog(int userId, string userName, CPEnum.DeviceTypeEnum device, string operRemark, string operType, string operUrl, string operIP)
        {
            CPLog log = new CPLog();

            log.UserId     = userId;
            log.UserName   = userName;
            log.OperTime   = DateTime.Now;
            log.OperDevice = device;
            log.OperRemark = operRemark;
            log.OperType   = operType;
            log.OperIP     = operIP;
            log.OperUrl    = operUrl;
            return(this._CPLogRep.Add(log) > 0 ? true : false);
        }