Exemplo n.º 1
0
        /// <summary>
        /// 根据条件获得用户组信息
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="code">代码</param>
        /// <param name="ifEnable">启用标识</param>
        /// <param name="pageM">分页对象</param>
        /// <returns>用户组信息</returns>
        public List <V_UserGroup> GetUserGroupInfoByWhere(string name, string code, bool?ifEnable, MPagingModel pageM)
        {
            Expression <Func <V_UserGroup, bool> > expression = m => true;

            if (!string.IsNullOrEmpty(name))
            {
                expression = LinqManager.And(expression, m => m.Name.Contains(name));
            }
            if (!string.IsNullOrEmpty(code))
            {
                expression = LinqManager.And(expression, m => m.Code == code);
            }
            if (ifEnable != null)
            {
                expression = LinqManager.And(expression, m => m.IfEnable == ifEnable.Value);
            }
            pageM.DataCount = _DB.V_UserGroup.Count(expression.Compile());
            List <V_UserGroup> listM = null;

            if (pageM.DataCount > 0)
            {
                listM = _DB.V_UserGroup.Where(expression.Compile()).Skip((pageM.PagingIndex - 1) * pageM.PagingSize).Take(pageM.PagingSize).OrderBy(m => m.CreateTime).ToList();
            }
            return(listM);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据类型和启用标识获得顶层权限信息
        /// </summary>
        /// <param name="type">权限类型</param>
        /// <param name="ifEnable">启用标识</param>
        /// <returns>所有权限信息</returns>
        public List <T_Permissions> GetPermissionsInfoByTypeAndEnable(PermissionsTypesEnum type, bool?ifEnable)
        {
            Expression <Func <T_Permissions, bool> > expression = m => m.Type == (byte)type && !m.IfDelete && m.FK_ParentID == null;

            if (ifEnable != null)
            {
                expression = LinqManager.And(expression, m => m.IfEnable == ifEnable.Value);
            }
            List <T_Permissions> listM = _DB.T_Permissions.Where(expression.Compile()).OrderByDescending(m => m.Ranks).ToList();

            return(listM);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据权限代码和启用状态获得权限信息
        /// </summary>
        /// <param name="code">权限代码</param>
        /// <param name="ifEnable">启用标识</param>
        /// <returns>权限信息</returns>
        public V_Permissions GetPermissionsInfoByCodeAndEnable(string code, bool?ifEnable)
        {
            Expression <Func <V_Permissions, bool> > expression = m => m.Code == code;

            if (ifEnable != null)
            {
                expression = LinqManager.And(expression, m => m.IfEnable == ifEnable.Value);
            }
            V_Permissions resM = _DB.V_Permissions.Where(expression.Compile()).FirstOrDefault();

            return(resM);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 根据条件获得用户信息
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="mobile">手机</param>
        /// <param name="weChatWorkUserID">微信企业号账户</param>
        /// <param name="email">邮箱</param>
        /// <param name="trueName">真实姓名</param>
        /// <param name="nickName">昵称</param>
        /// <param name="ifEnable">启用标识</param>
        /// <param name="pageM">分页对象</param>
        /// <returns>用户信息</returns>
        public List <V_User> GetUserInfoByWhere(string userName, string mobile, string weChatWorkUserID, string email, string trueName, string nickName, bool?ifEnable, MPagingModel pageM)
        {
            Expression <Func <V_User, bool> > expression = m => true;

            if (!string.IsNullOrEmpty(userName))
            {
                expression = LinqManager.And(expression, m => m.UserName == userName);
            }
            if (!string.IsNullOrEmpty(mobile))
            {
                expression = LinqManager.And(expression, m => m.Mobile == mobile);
            }
            if (!string.IsNullOrEmpty(weChatWorkUserID))
            {
                expression = LinqManager.And(expression, m => m.WeChatWorkUserID == weChatWorkUserID);
            }
            if (!string.IsNullOrEmpty(email))
            {
                expression = LinqManager.And(expression, m => m.Email == email);
            }
            if (!string.IsNullOrEmpty(trueName))
            {
                expression = LinqManager.And(expression, m => m.TrueName.Contains(trueName));
            }
            if (!string.IsNullOrEmpty(nickName))
            {
                expression = LinqManager.And(expression, m => m.NickName.Contains(nickName));
            }
            if (ifEnable != null)
            {
                expression = LinqManager.And(expression, m => m.IfEnable == ifEnable.Value);
            }
            pageM.DataCount = _DB.V_User.Count(expression.Compile());
            List <V_User> listM = null;

            if (pageM.DataCount > 0)
            {
                listM = _DB.V_User.Where(expression.Compile()).Skip((pageM.PagingIndex - 1) * pageM.PagingSize).Take(pageM.PagingSize).OrderBy(m => m.CreateTime).ToList();
            }
            return(listM);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 根据条件获得试题信息
        /// </summary>
        /// <param name="title">试题标题</param>
        /// <param name="IsEnable">启用状态</param>
        /// <param name="pageM">分页对象</param>
        /// <returns>试题信息</returns>
        public List <V_Paper> GetPaperViewInfoByWhere(string title, bool?IsEnable, MPagingModel pageM)
        {
            Expression <Func <V_Paper, bool> > searchPredicate = LinqManager.True <V_Paper>();

            if (!string.IsNullOrEmpty(title))
            {
                searchPredicate = LinqManager.And(searchPredicate, m => m.Title.Contains(title));
            }
            if (IsEnable != null)
            {
                searchPredicate = LinqManager.And(searchPredicate, m => m.IsEnable == IsEnable.Value);
            }
            pageM.DataCount = _DB.V_Paper.Where(searchPredicate.Compile()).Count();
            List <V_Paper> resM = new List <V_Paper>();

            if (pageM.DataCount > 0)
            {
                resM = _DB.V_Paper.Where(searchPredicate.Compile()).OrderByDescending(m => m.CreateTime).Skip((pageM.PagingIndex - 1) * pageM.PagingSize).Take(pageM.PagingSize).ToList();
            }
            return(resM);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 根据条件获得用户信息
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="trueName">真实姓名</param>
        /// <param name="pageM">分页对象</param>
        /// <returns>用户信息</returns>
        public List <V_User> GetUserViewInfoByWhere(string userName, string trueName, MPagingModel pageM)
        {
            Expression <Func <V_User, bool> > expression = m => true;

            if (!string.IsNullOrEmpty(userName))
            {
                expression = LinqManager.And(expression, m => m.UserName == userName);
            }
            if (!string.IsNullOrEmpty(trueName))
            {
                expression = LinqManager.And(expression, m => m.TrueName.Contains(trueName));
            }
            pageM.DataCount = _DB.V_User.Count(expression.Compile());
            List <V_User> listM = null;

            if (pageM.DataCount > 0)
            {
                listM = _DB.V_User.Where(expression.Compile()).Skip((pageM.PagingIndex - 1) * pageM.PagingSize).Take(pageM.PagingSize).OrderBy(m => m.CreateTime).ToList();
            }
            return(listM);
        }