Пример #1
0
        /// <summary>
        /// 检索异常日志
        /// </summary>
        /// <returns></returns>
        public static BaseResponseList <SysExcptionLog> searchLog(VMMsgSearchExceptionLogRequest condtion)
        {
            BaseResponseList <SysExcptionLog> result = new BaseResponseList <SysExcptionLog>();

            using (var db = new SysModelContainer()) {
                var r = (from c in db.Db_SysMsgSet.OfType <Db_SysExceptionLog>().AsEnumerable()
                         where (condtion.type == null? true :c.errorCode == condtion.type.GetHashCode()) &&
                         (condtion.beginDate == null? true :c.createdOn >= condtion.beginDate) &&
                         (condtion.endDate == null? true :c.createdOn <= condtion.endDate)
                         orderby c.Id descending
                         select c.Id
                         );
                result.total = r.Count();
                if (result.total > 0)
                {
                    if (condtion.page == 0)
                    {
                        result.rows = r.Select(p => new SysExcptionLog(p)).ToList();
                    }
                    else
                    {
                        result.rows = r.Skip(condtion.getSkip()).Take(condtion.pageSize).Select(p => new SysExcptionLog(p)).ToList();
                    }
                }
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        /// 检索日志
        /// </summary>
        /// <param name="condtion"></param>
        /// <returns></returns>
        public static BaseResponseList <SysUserLog> searchLog(ViewModelMsgSearchUserLogReqeust condtion)
        {
            BaseResponseList <SysUserLog> result = new BaseResponseList <SysUserLog>();

            using (var db = new SysModelContainer()) {
                var r = (from c in db.Db_SysMsgSet.OfType <Db_SysUserLog>().AsEnumerable()
                         where ((string.IsNullOrEmpty(condtion.loginName) && string.IsNullOrEmpty(condtion.fkid))? true :(
                                    (string.IsNullOrEmpty(condtion.loginName)?false:c.Db_SysUser_loginName == condtion.loginName) || (string.IsNullOrEmpty(condtion.fkid) ? false : c.fkId == condtion.fkid)
                                    )) &&
                         (condtion.logType == null ? true : c.logType == condtion.logType.GetHashCode())
                         orderby c.createdOn descending
                         select c.Id);
                result.total = r.Count();
                if (result.total > 0)
                {
                    if (condtion.page == 0)
                    {
                        result.rows = r.Select(p => new SysUserLog(p)).ToList();
                    }
                    else
                    {
                        result.rows = r.Skip(condtion.getSkip()).Take(condtion.pageSize).Select(p => new SysUserLog(p)).ToList();
                    }
                }
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        /// 检索用户
        /// </summary>
        /// <param name="condtion"></param>
        /// <returns></returns>
        internal static BaseResponseList <SysManagerUser> searchUserList(ViewModelSearchUserBaseRequest condtion)
        {
            BaseResponseList <SysManagerUser> res = new BaseResponseList <SysManagerUser>();

            using (var db = new SysModelContainer()) {
                var r = (from x in db.Db_SysUserSet.OfType <Db_ManagerUser>().AsEnumerable()
                         where !x.isDeleted &&
                         (condtion.roles.Count == 0 ? true : condtion.roles.Contains(x.role)) &&
                         (condtion.loginName.Count == 0 ? true : condtion.loginName.Contains(x.loginName)) &&
                         (string.IsNullOrEmpty(condtion.q) ? true : (x.loginName.Contains(condtion.q) || x.fullName.Contains(condtion.q) || (string.IsNullOrEmpty(x.mobilePhone) ? false : x.mobilePhone.Contains(condtion.q))))
                         select new { x.loginName, x.createdOn });
                res.total = r.Count();
                if (res.total > 0)
                {
                    r = r.OrderByDescending(p => p.createdOn);
                    if (condtion.page == 0)
                    {
                        res.rows = r.Select(p => new SysManagerUser(p.loginName)).ToList();
                    }
                    else
                    {
                        res.rows = r.Skip(condtion.getSkip()).Take(condtion.pageSize).Select(p => new SysManagerUser(p.loginName)).ToList();
                    }
                }
            }
            return(res);
        }
Пример #4
0
        /// <summary>
        /// 检索系统消息
        /// </summary>
        /// <param name="condtion"></param>
        /// <returns></returns>
        public static BaseResponseList <SysMsg> searchLog(VMMsgSearchMsgRequest condtion)
        {
            BaseResponseList <SysMsg> result = new BaseResponseList <SysMsg>();

            using (var db = new SysModelContainer()) {
                var r = (from c in db.Db_SysMsgSet.AsEnumerable()
                         where (condtion.msgType.Count == 0 ? true : condtion.msgType.Contains(c.msgType))
                         orderby c.Id descending
                         select c.Id);
                result.total = r.Count();
                if (result.total > 0)
                {
                    if (condtion.page == 0)
                    {
                        result.rows = r.Select(p => new SysMsg(p)).ToList();
                    }
                    else
                    {
                        result.rows = r.Skip(condtion.getSkip()).Take(condtion.pageSize).Select(p => new SysMsg(p)).ToList();
                    }
                }
            }
            return(result);
        }